QueryRetrieveInformationModels CreateQueryRetrieveInformationModels(bool randomizeFirst, string directory) { WriteInformation(string.Format("Creating the QR information model based on data directory : {0}", directory)); QueryRetrieveInformationModels queryRetrieveInformationModels = new QueryRetrieveInformationModels(); //Specify directory for temp DCM files //String tempDir = Path.Combine(Path.GetTempPath(), "DVTkStorageSCP"); //if (!Directory.Exists(tempDir)) //{ // Directory.CreateDirectory(tempDir); //} queryRetrieveInformationModels.DataDirectory = directory; DirectoryInfo directoryInfo = new DirectoryInfo(directory); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { if ((fileInfo.Extension.ToLower() == ".dcm") || (fileInfo.Extension == "") || (fileInfo.Extension == null)) { try { DvtkHighLevelInterface.Dicom.Files.DicomFile dicomFile = new DvtkHighLevelInterface.Dicom.Files.DicomFile(); dicomFile.Read(fileInfo.FullName, this); if (randomizeFirst) { dicomFile.DataSet.Randomize("@"); } queryRetrieveInformationModels.Add(dicomFile, false); } catch (Exception) { string theErrorText = string.Format("Invalid DICOM File - {0} will be skiped from QR information model.", fileInfo.FullName); WriteInformation(theErrorText); } } } return(queryRetrieveInformationModels); }
/// <summary> /// Create the QR information model on the fly /// </summary> /// <param name="randomizeFirst"></param> /// <param name="isCreationForDisplay"></param> /// <param name="patientRoot"></param> /// <param name="studyRoot"></param> /// <param name="patientStudyRoot"></param> /// <param name="dicomThread"></param> /// <returns></returns> public static QueryRetrieveInformationModels CreateQueryRetrieveInformationModels(bool randomizeFirst, bool isCreationForDisplay, bool patientRoot, bool studyRoot, bool patientStudyRoot, DicomThread dicomThread) { QueryRetrieveInformationModels queryRetrieveInformationModels = new QueryRetrieveInformationModels(); //Specify directory for temp DCM files queryRetrieveInformationModels.DataDirectory = dataDirectoryForTempFiles; DirectoryInfo directoryInfo = new DirectoryInfo(dataDirectory); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { try { DvtkHighLevelInterface.Dicom.Files.DicomFile dicomFile = new DvtkHighLevelInterface.Dicom.Files.DicomFile(); if (isCreationForDisplay) dicomFile.DataSet.StoreOBOFOWValuesWhenReading = false; dicomFile.Read(fileInfo.FullName, dicomThread); if (randomizeFirst) dicomFile.DataSet.Randomize("@"); //queryRetrieveInformationModels.Add(dataSet, true); if (patientRoot) queryRetrieveInformationModels.PatientRoot.AddToInformationModel(dicomFile, true); if (studyRoot) queryRetrieveInformationModels.StudyRoot.AddToInformationModel(dicomFile, true); if (patientStudyRoot) queryRetrieveInformationModels.PatientStudyOnly.AddToInformationModel(dicomFile, true); } catch (Exception) { string theErrorText = string.Format("Invalid DICOM File - {0} will be skiped from QR information model.", fileInfo.FullName); dicomThread.WriteInformation(theErrorText); } } return (queryRetrieveInformationModels); }
QueryRetrieveInformationModels CreateQueryRetrieveInformationModels(bool randomizeFirst, string directory) { WriteInformation(string.Format("Creating the QR information model based on data directory : {0}", directory)); QueryRetrieveInformationModels queryRetrieveInformationModels = new QueryRetrieveInformationModels(); //Specify directory for temp DCM files //String tempDir = Path.Combine(Path.GetTempPath(), "DVTkStorageSCP"); //if (!Directory.Exists(tempDir)) //{ // Directory.CreateDirectory(tempDir); //} queryRetrieveInformationModels.DataDirectory = directory; DirectoryInfo directoryInfo = new DirectoryInfo(directory); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { if ((fileInfo.Extension.ToLower() == ".dcm") || (fileInfo.Extension == "") || (fileInfo.Extension == null)) { try { DvtkHighLevelInterface.Dicom.Files.DicomFile dicomFile = new DvtkHighLevelInterface.Dicom.Files.DicomFile(); dicomFile.Read(fileInfo.FullName, this); if (randomizeFirst) dicomFile.DataSet.Randomize("@"); queryRetrieveInformationModels.Add(dicomFile, false); } catch (Exception) { string theErrorText = string.Format("Invalid DICOM File - {0} will be skiped from QR information model.", fileInfo.FullName); WriteInformation(theErrorText); } } } return (queryRetrieveInformationModels); }