/// <summary> /// Add the given Dataset to the Information Model. The data is normalised into the Information Model. /// </summary> /// <param name="dataset">Dataset to add to Informatio Model.</param> public override void AddToInformationModel(DataSet dataset) { // PATIENT level PatientInformationEntity patientInformationEntity = null; // check if the patient IE is already in the patientRootList foreach (PatientInformationEntity lPatientInformationEntity in Root) { if (lPatientInformationEntity.IsFoundIn(dataset)) { patientInformationEntity = lPatientInformationEntity; break; } } // patient IE is not already in the patientRootList if (patientInformationEntity == null) { // create a new patient IE from the dataset and add to the patientRootList patientInformationEntity = new PatientInformationEntity(); patientInformationEntity.CopyFrom(dataset); Root.Add(patientInformationEntity); } // STUDY level StudyInformationEntity studyInformationEntity = null; // check if the study IE is already in the patient IE children foreach (StudyInformationEntity lStudyInformationEntity in patientInformationEntity.Children) { if (lStudyInformationEntity.IsFoundIn(dataset)) { studyInformationEntity = lStudyInformationEntity; break; } } // study IE is not already in the patient IE children if (studyInformationEntity == null) { // create a new study IE from the dataset and add to the patient IE children studyInformationEntity = new StudyInformationEntity(); studyInformationEntity.CopyFrom(dataset); patientInformationEntity.AddChild(studyInformationEntity); } // SERIES level SeriesInformationEntity seriesInformationEntity = null; // check if the series IE is already in the study IE children foreach (SeriesInformationEntity lSeriesInformationEntity in studyInformationEntity.Children) { if (lSeriesInformationEntity.IsFoundIn(dataset)) { seriesInformationEntity = lSeriesInformationEntity; break; } } // series IE is not already in the study IE children if (seriesInformationEntity == null) { // create a new series IE from the dataset and add to the study IE children seriesInformationEntity = new SeriesInformationEntity(); seriesInformationEntity.CopyFrom(dataset); studyInformationEntity.AddChild(seriesInformationEntity); } // IMAGE (Instance) level InstanceInformationEntity instanceInformationEntity = null; // check if the instance IE is already in the series IE children foreach (InstanceInformationEntity lInstanceInformationEntity in seriesInformationEntity.Children) { if (lInstanceInformationEntity.IsFoundIn(dataset)) { instanceInformationEntity = lInstanceInformationEntity; break; } } // instance IE is not already in the series IE children if (instanceInformationEntity == null) { // create a new instance IE from the dataset and add to the series IE children instanceInformationEntity = new InstanceInformationEntity(dataset.Filename); instanceInformationEntity.CopyFrom(dataset); seriesInformationEntity.AddChild(instanceInformationEntity); } }
/// <summary> /// Add the given dataset present in a Dicom File to the Information Model. The data is normalised into the Information Model. /// </summary> /// <param name="dicomFile">The dicom File containing the dataset to be added.</param> /// <param name="storeFile">Boolean indicating whether the dataset should be stored or not.</param> public override void AddToInformationModel(DvtkData.Media.DicomFile dicomFile, bool storeFile) { // PATIENT level PatientInformationEntity patientInformationEntity = null; this.IsDataStored = storeFile; // check if the patient IE is already in the patientRootList foreach (PatientInformationEntity lPatientInformationEntity in Root) { if (lPatientInformationEntity.IsUniqueTagFoundIn(dicomFile.DataSet)) { patientInformationEntity = lPatientInformationEntity; //patientInformationEntity.CheckForSpecialTags(dicomFile.DataSet); break; } } // patient IE is not already in the patientRootList if (patientInformationEntity == null) { // create a new patient IE from the dataset and add to the patientRootList patientInformationEntity = new PatientInformationEntity(); patientInformationEntity.CopyFrom(dicomFile.DataSet); Root.Add(patientInformationEntity); } // STUDY level StudyInformationEntity studyInformationEntity = null; // check if the study IE is already in the patient IE children foreach (StudyInformationEntity lStudyInformationEntity in patientInformationEntity.Children) { if (lStudyInformationEntity.IsUniqueTagFoundIn(dicomFile.DataSet)) { studyInformationEntity = lStudyInformationEntity; //studyInformationEntity.CheckForSpecialTags(dicomFile.DataSet); break; } } // study IE is not already in the patient IE children if (studyInformationEntity == null) { // create a new study IE from the dataset and add to the patient IE children studyInformationEntity = new StudyInformationEntity(); studyInformationEntity.CopyFrom(dicomFile.DataSet); patientInformationEntity.AddChild(studyInformationEntity); } // SERIES level SeriesInformationEntity seriesInformationEntity = null; // check if the series IE is already in the study IE children foreach (SeriesInformationEntity lSeriesInformationEntity in studyInformationEntity.Children) { if (lSeriesInformationEntity.IsUniqueTagFoundIn(dicomFile.DataSet)) { seriesInformationEntity = lSeriesInformationEntity; //seriesInformationEntity.CheckForSpecialTags(dicomFile.DataSet); break; } } // series IE is not already in the study IE children if (seriesInformationEntity == null) { // create a new series IE from the dataset and add to the study IE children seriesInformationEntity = new SeriesInformationEntity(); seriesInformationEntity.CopyFrom(dicomFile.DataSet); studyInformationEntity.AddChild(seriesInformationEntity); } // IMAGE (Instance) level InstanceInformationEntity instanceInformationEntity = null; // check if the instance IE is already in the series IE children foreach (InstanceInformationEntity lInstanceInformationEntity in seriesInformationEntity.Children) { if (lInstanceInformationEntity.IsUniqueTagFoundIn(dicomFile.DataSet)) { instanceInformationEntity = lInstanceInformationEntity; //instanceInformationEntity.CheckForSpecialTags(dicomFile.DataSet); break; } } // instance IE is not already in the series IE children if (instanceInformationEntity == null) { // Store the dicom File as a DCM file if requested. if (storeFile == true) { StoreDicomFile(dicomFile); } // create a new instance IE from the dataset and add to the series IE children instanceInformationEntity = new InstanceInformationEntity(dicomFile.DataSet.Filename); instanceInformationEntity.CopyFrom(dicomFile.DataSet); seriesInformationEntity.AddChild(instanceInformationEntity); } patientInformationEntity.CheckForSpecialTags(dicomFile.DataSet); studyInformationEntity.CheckForSpecialTags(dicomFile.DataSet); seriesInformationEntity.CheckForSpecialTags(dicomFile.DataSet); instanceInformationEntity.CheckForSpecialTags(dicomFile.DataSet); }