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); }
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); }
private static bool IsDicomFile(string filePath) { if (DicomFile.IsDicomFile(filePath)) { return(true); } if (AcrNemaFile.IsAcrNemaFile(filePath)) { return(true); } return(false); }