/// <summary>
        /// Serializes the presentation state of the given images to the current state object.
        /// </summary>
        /// <param name="images">The images whose presentation states are to be serialized.</param>
        /// <exception cref="InvalidOperationException">Thrown if the presentation state has already been serialized to a file.</exception>
        public override void Serialize(IEnumerable <IPresentationImage> images)
        {
            CheckSerialized(false);

            // create UIDs if needed now
            this.PresentationSeriesInstanceUid = CreateUid(this.PresentationSeriesInstanceUid);
            this.PresentationSopInstanceUid    = CreateUid(this.PresentationSopInstanceUid);

            _serialized = true;

            var specificCharacterSet = _specificCharacterSet ?? string.Empty;

            DataSet.SpecificCharacterSet = specificCharacterSet;
            DataSet[DicomTags.SpecificCharacterSet].SetStringValue(specificCharacterSet);

            GeneralEquipmentModuleIod generalEquipmentModule = new GeneralEquipmentModuleIod(this.DataSet);

            generalEquipmentModule.Manufacturer                = this.Manufacturer ?? string.Empty; // this one is type 2 - all other GenEq attributes are type 3
            generalEquipmentModule.ManufacturersModelName      = string.IsNullOrEmpty(this.ManufacturersModelName) ? null : this.ManufacturersModelName;
            generalEquipmentModule.DeviceSerialNumber          = string.IsNullOrEmpty(this.DeviceSerialNumber) ? null : this.DeviceSerialNumber;
            generalEquipmentModule.SoftwareVersions            = string.IsNullOrEmpty(this.SoftwareVersions) ? null : this.SoftwareVersions;
            generalEquipmentModule.InstitutionName             = string.IsNullOrEmpty(this.Institution.Name) ? null : this.Institution.Name;
            generalEquipmentModule.InstitutionAddress          = string.IsNullOrEmpty(this.Institution.Address) ? null : this.Institution.Address;
            generalEquipmentModule.InstitutionalDepartmentName = string.IsNullOrEmpty(this.Institution.DepartmentName) ? null : this.Institution.DepartmentName;
            generalEquipmentModule.StationName = string.IsNullOrEmpty(this.StationName) ? null : this.StationName;

            GeneralSeriesModuleIod generalSeriesModule = new GeneralSeriesModuleIod(this.DataSet);

            generalSeriesModule.InitializeAttributes();
            generalSeriesModule.SeriesDateTime    = this.PresentationSeriesDateTime;
            generalSeriesModule.SeriesDescription = this.PresentationContentLabel;
            generalSeriesModule.SeriesInstanceUid = this.PresentationSeriesInstanceUid;
            generalSeriesModule.SeriesNumber      = this.PresentationSeriesNumber;

            PresentationSeriesModuleIod presentationSeriesModule = new PresentationSeriesModuleIod(this.DataSet);

            presentationSeriesModule.InitializeAttributes();
            presentationSeriesModule.Modality = Modality.PR;

            SopCommonModuleIod sopCommonModule = new SopCommonModuleIod(this.DataSet);

            sopCommonModule.SopInstanceUid = this.PresentationSopInstanceUid;
            sopCommonModule.SopClassUid    = this.PresentationSopClass.Uid;

            PresentationStateIdentificationModuleIod presentationStateIdentificationModule = new PresentationStateIdentificationModuleIod(this.DataSet);

            presentationStateIdentificationModule.InitializeAttributes();
            presentationStateIdentificationModule.ContentLabel   = this.PresentationContentLabel;
            presentationStateIdentificationModule.InstanceNumber = this.PresentationInstanceNumber;
            presentationStateIdentificationModule.PresentationCreationDateTime = Platform.Time;

            PerformSerialization(images);

            _dicomFile.SourceApplicationEntityTitle = this.SourceAETitle;
            _dicomFile.MediaStorageSopClassUid      = this.PresentationSopClassUid;
            _dicomFile.MediaStorageSopInstanceUid   = this.PresentationSopInstanceUid;
        }
Ejemplo n.º 2
0
 public RawDataIod(IDicomAttributeProvider dicomAttributeProvider)
 {
     _dicomAttributeProvider     = dicomAttributeProvider;
     _patientModule              = new PatientModuleIod(_dicomAttributeProvider);
     _clinicalTrialSubjectModule = new ClinicalTrialSubjectModuleIod(_dicomAttributeProvider);
     _generalStudyModule         = new GeneralStudyModuleIod(_dicomAttributeProvider);
     _patientStudyModule         = new PatientStudyModuleIod(_dicomAttributeProvider);
     _clinicalTrialStudyModule   = new ClinicalTrialStudyModuleIod(_dicomAttributeProvider);
     _generalSeriesModule        = new GeneralSeriesModuleIod(_dicomAttributeProvider);
     _clinicalTrialSeriesModule  = new ClinicalTrialSeriesModuleIod(_dicomAttributeProvider);
     _generalEquipmentModule     = new GeneralEquipmentModuleIod(_dicomAttributeProvider);
     _acquisitionContextModule   = new AcquisitionContextModuleIod(_dicomAttributeProvider);
     _rawDataModule              = new RawDataModule(_dicomAttributeProvider);
     _sopCommonModule            = new SopCommonModuleIod(_dicomAttributeProvider);
 }
        private static void FillGeneralSeriesModule(IDicomAttributeProvider target, IDicomAttributeProvider source, SeriesInfo seriesInfo)
        {
            var sourceModule = new GeneralSeriesModuleIod(source);
            var targetModule = new GeneralSeriesModuleIod(target);

            targetModule.Modality                  = sourceModule.Modality;
            targetModule.PatientPosition           = string.Empty;
            targetModule.SeriesDateTime            = seriesInfo.SeriesDateTime;
            targetModule.SeriesDescription         = seriesInfo.SeriesDescription;
            targetModule.SeriesInstanceUid         = seriesInfo.SeriesInstanceUid;
            targetModule.SeriesNumber              = seriesInfo.SeriesNumber;
            targetModule.AnatomicalOrientationType = sourceModule.AnatomicalOrientationType;
            // body part examined and (series) laterality are not filled in because they may vary for multiple SC images
            // we'll use Image Laterality instead, and BPE is optional anyway
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Serializes the presentation state of the given images to the current state object.
        /// </summary>
        /// <param name="images">The images whose presentation states are to be serialized.</param>
        /// <exception cref="InvalidOperationException">Thrown if the presentation state has already been serialized to a file.</exception>
        public override void Serialize(IEnumerable <IPresentationImage> images)
        {
            AssertNotSerialized();

            // create UIDs if needed now
            PresentationSeriesInstanceUid = CreateUid(PresentationSeriesInstanceUid);
            PresentationSopInstanceUid    = CreateUid(PresentationSopInstanceUid);

            _serialized = true;

            var imageList          = images.ToList();
            var sopInstanceFactory = new PrototypeSopInstanceFactory {
                Institution = Institution, StationName = StationName, SpecificCharacterSet = SpecificCharacterSet
            };

            sopInstanceFactory.InitializeDataSet(imageList.OfType <IImageSopProvider>().First().ImageSop.DataSource, DataSet);

            GeneralSeriesModuleIod generalSeriesModule = new GeneralSeriesModuleIod(DataSet);

            generalSeriesModule.InitializeAttributes();
            generalSeriesModule.SeriesDateTime    = PresentationSeriesDateTime;
            generalSeriesModule.SeriesDescription = PresentationContentLabel;
            generalSeriesModule.SeriesInstanceUid = PresentationSeriesInstanceUid;
            generalSeriesModule.SeriesNumber      = PresentationSeriesNumber;

            PresentationSeriesModuleIod presentationSeriesModule = new PresentationSeriesModuleIod(DataSet);

            presentationSeriesModule.InitializeAttributes();
            presentationSeriesModule.Modality = Modality.PR;

            SopCommonModuleIod sopCommonModule = new SopCommonModuleIod(DataSet);

            sopCommonModule.SopInstanceUid = PresentationSopInstanceUid;
            sopCommonModule.SopClassUid    = PresentationSopClass.Uid;

            PresentationStateIdentificationModuleIod presentationStateIdentificationModule = new PresentationStateIdentificationModuleIod(DataSet);

            presentationStateIdentificationModule.InitializeAttributes();
            presentationStateIdentificationModule.ContentLabel   = PresentationContentLabel;
            presentationStateIdentificationModule.InstanceNumber = PresentationInstanceNumber;
            presentationStateIdentificationModule.PresentationCreationDateTime = Platform.Time;

            PerformSerialization(imageList);

            _dicomFile.SourceApplicationEntityTitle = SourceAETitle;
            _dicomFile.MediaStorageSopClassUid      = PresentationSopClassUid;
            _dicomFile.MediaStorageSopInstanceUid   = PresentationSopInstanceUid;
        }
		public void TestGeneralSeriesModuleIod()
		{
			var dicomFile = new DicomFile();

			var module = new GeneralSeriesModuleIod(dicomFile.DataSet);
			Assert.AreEqual(module.AnatomicalOrientationType, AnatomicalOrientationType.None);

			module.AnatomicalOrientationType = AnatomicalOrientationType.Quadruped;
			Assert.AreEqual(module.AnatomicalOrientationType, AnatomicalOrientationType.Quadruped);

			dicomFile.Save("TestGeneralSeriesModuleIod.dcm");

			var reloadedDicomFile = new DicomFile("TestGeneralSeriesModuleIod.dcm");
			reloadedDicomFile.Load();

			var realoadedModule = new PatientModuleIod(reloadedDicomFile.DataSet);
			Assert.AreEqual(module.AnatomicalOrientationType, AnatomicalOrientationType.Quadruped);
		}
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScImageIod"/> class.
        /// </summary>
        /// <param name="dicomAttributeProvider">The DICOM attribute provider.</param>
        public ScImageIod(IDicomAttributeProvider dicomAttributeProvider)
        {
            _dicomAttributeProvider = dicomAttributeProvider;

            _patientModule = new PatientModuleIod(_dicomAttributeProvider);
            _clinicalTrialSubjectModule = new ClinicalTrialSubjectModuleIod(_dicomAttributeProvider);
            _generalStudyModule         = new GeneralStudyModuleIod(_dicomAttributeProvider);
            _patientStudyModule         = new PatientStudyModuleIod(_dicomAttributeProvider);
            _clinicalTrialStudyModule   = new ClinicalTrialStudyModuleIod(_dicomAttributeProvider);
            _generalSeriesModule        = new GeneralSeriesModuleIod(_dicomAttributeProvider);
            _clinicalTrialSeriesModule  = new ClinicalTrialSeriesModuleIod(_dicomAttributeProvider);
            _generalEquipmentModule     = new GeneralEquipmentModuleIod(_dicomAttributeProvider);
            _scEquipmentModule          = new ScEquipmentModuleIod(_dicomAttributeProvider);
            _generalImageModule         = new GeneralImageModuleIod(_dicomAttributeProvider);
            _imagePixelModule           = new ImagePixelMacroIod(_dicomAttributeProvider);
            _deviceModule       = new DeviceModuleIod(_dicomAttributeProvider);
            _scImageModule      = new ScImageModuleIod(_dicomAttributeProvider);
            _overlayPlaneModule = new OverlayPlaneModuleIod(_dicomAttributeProvider);
            _modalityLutModule  = new ModalityLutModuleIod(_dicomAttributeProvider);
            _voiLutModule       = new VoiLutModuleIod(_dicomAttributeProvider);
            _iccProfileModule   = new IccProfileModuleIod(_dicomAttributeProvider);
            _sopCommonModule    = new SopCommonModuleIod(_dicomAttributeProvider);
        }
Ejemplo n.º 7
0
 public SegmentationDocumentIod(IDicomAttributeProvider dicomAttributeProvider)
 {
     _dicomAttributeProvider     = dicomAttributeProvider;
     _patientModule              = new PatientModuleIod(_dicomAttributeProvider);
     _clinicalTrialSubjectModule = new ClinicalTrialSubjectModuleIod(_dicomAttributeProvider);
     _generalStudyModule         = new GeneralStudyModuleIod(_dicomAttributeProvider);
     _patientStudyModule         = new PatientStudyModuleIod(_dicomAttributeProvider);
     _clinicalTrialStudyModule   = new ClinicalTrialStudyModuleIod(_dicomAttributeProvider);
     _generalSeriesModule        = new GeneralSeriesModuleIod(_dicomAttributeProvider);
     _segmentationSeriesModule   = new SegmentationSeriesModuleIod(_dicomAttributeProvider);
     _clinicalTrialSeriesModule  = new ClinicalTrialSeriesModuleIod(_dicomAttributeProvider);
     _frameOfReferenceModule     = new FrameOfReferenceModuleIod(_dicomAttributeProvider);
     _generalEquipmentModule     = new GeneralEquipmentModuleIod(_dicomAttributeProvider);
     //_enhanceGeneralEquipmentModule = new EnhanceGeneralEquipmentModuleIod(_dicomAttributeProvider);
     _generalImageModule               = new GeneralImageModuleIod(_dicomAttributeProvider);
     _imagePixelModule                 = new ImagePixelMacroIod(_dicomAttributeProvider);
     _segmentationImageModule          = new SegmentationImageModuleIod(_dicomAttributeProvider);
     _multiFrameFunctionalGroupsModule = new MultiFrameFunctionalGroupsModuleIod(_dicomAttributeProvider);
     _multiFrameDimensionModule        = new MultiFrameDimensionModuleIod(_dicomAttributeProvider);
     _specimenModule = new SpecimenModuleIod(_dicomAttributeProvider);
     _commonInstanceReferenceModule = new CommonInstanceReferenceModuleIod(_dicomAttributeProvider);
     _sopCommonModule       = new SopCommonModuleIod(_dicomAttributeProvider);
     _frameExtractionModule = new FrameExtractionModuleIod(_dicomAttributeProvider);
 }