コード例 #1
0
        private AcrNemaFile LoadFile(string filePath)
        {
            AcrNemaFile file = null;

            try
            {
                if (DicomFile.IsDicomFile(filePath))
                {
                    file = new DicomFile(filePath, false);
                }
                else if (AcrNemaFile.IsAcrNemaFile(filePath))
                {
                    file = new AcrNemaFile(filePath, false);
                }
                else
                {
                    Debug.LogError("Selected file is neither a DICOM nor an ACR-NEMA file.");
                }
            }
            catch (Exception dicomFileException)
            {
                Debug.LogError($"Problems processing the DICOM file {filePath} :\n {dicomFileException}");
                return(null);
            }
            return(file);
        }
コード例 #2
0
        private static void PerformExtraction(string filePath)
        {
            AcrNemaFile file;

            if (DicomFile.IsDicomFile(filePath))
            {
                file = new DicomFile(filePath, false);
            }
            else if (AcrNemaFile.IsAcrNemaFile(filePath))
            {
                file = new AcrNemaFile(filePath, false);
            }
            else
            {
                return;
            }

            string filename   = new FileInfo(filePath).Name;
            string fileFolder = Directory.GetParent(filePath) + "\\" + filename + "_dicom";

            if (!Directory.Exists(fileFolder))
            {
                Directory.CreateDirectory(fileFolder);
            }

            ExtractDataandSave(fileFolder, file);
        }
コード例 #3
0
        private static bool IsDicomFile(string filePath)
        {
            if (DicomFile.IsDicomFile(filePath))
            {
                return(true);
            }

            if (AcrNemaFile.IsAcrNemaFile(filePath))
            {
                return(true);
            }

            return(false);
        }