internal static void FillDataSet(IDicomAttributeProvider dataSet, VolumeSlice slice)
        {
            // generate values for SC Equipment Module
            var scEquipment = new ScEquipmentModuleIod(dataSet);

            scEquipment.ConversionType = @"WSD";
            scEquipment.SecondaryCaptureDeviceManufacturer           = @"ClearCanvas Inc.";
            scEquipment.SecondaryCaptureDeviceManufacturersModelName = ProductInformation.GetName(false, false);
            scEquipment.SecondaryCaptureDeviceSoftwareVersions       = new[] { ProductInformation.GetVersion(true, true, true, true) };

            // generate values for the General Image Module
            dataSet[DicomTags.ImageType].SetStringValue(@"DERIVED\SECONDARY");
            dataSet[DicomTags.DerivationDescription].SetStringValue(@"Multiplanar Reformatting");
            dataSet[DicomTags.DerivationCodeSequence].Values = new[] { ImageDerivationContextGroup.MultiplanarReformatting.AsDicomSequenceItem() };

            // update the Image Plane Module
            dataSet[DicomTags.PixelSpacing].SetStringValue(slice.PixelSpacing);
            dataSet[DicomTags.ImageOrientationPatient].SetStringValue(slice.ImageOrientationPatient);
            dataSet[DicomTags.ImagePositionPatient].SetStringValue(slice.ImagePositionPatient);
            dataSet[DicomTags.SliceThickness].SetStringValue(slice.SliceThickness);

            // update the spacing between slices, even though it's only part of modality-specific modules
            dataSet[DicomTags.SpacingBetweenSlices].SetStringValue(slice.SpacingBetweenSlices);

            // update the Image Pixel Module
            dataSet[DicomTags.Rows].SetInt32(0, slice.Rows);
            dataSet[DicomTags.Columns].SetInt32(0, slice.Columns);

            // generate values for Multi-Frame Module
            dataSet[DicomTags.NumberOfFrames].SetInt32(0, 1);

            // generate values for SOP Common Module
            dataSet[DicomTags.SopClassUid].SetStringValue(SopClass.SecondaryCaptureImageStorageUid);
            dataSet[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
        }
        private static void FillScEquipmentModule(IDicomAttributeProvider target, string manufacturer, string modelName, string softwareVersions)
        {
            var targetModule = new ScEquipmentModuleIod(target);

            targetModule.ConversionType = @"WSD";
            // modality is already filled in by General Series module
            targetModule.SecondaryCaptureDeviceManufacturer           = manufacturer;
            targetModule.SecondaryCaptureDeviceManufacturersModelName = modelName;
            targetModule.SecondaryCaptureDeviceSoftwareVersions       = new[] { softwareVersions };
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EncapsulatedPdfIod"/> class.
        /// </summary>
        /// <param name="dicomAttributeProvider">The DICOM attribute provider.</param>
        public EncapsulatedPdfIod(IDicomAttributeProvider dicomAttributeProvider)
        {
            _dicomAttributeProvider = dicomAttributeProvider;

            _patientModule = new PatientModuleIod(_dicomAttributeProvider);
            _clinicalTrialSubjectModule       = new ClinicalTrialSubjectModuleIod(_dicomAttributeProvider);
            _generalStudyModule               = new GeneralStudyModuleIod(_dicomAttributeProvider);
            _patientStudyModule               = new PatientStudyModuleIod(_dicomAttributeProvider);
            _clinicalTrialStudyModule         = new ClinicalTrialStudyModuleIod(_dicomAttributeProvider);
            _encapsulatedDocumentSeriesModule = new EncapsulatedDocumentSeriesModuleIod(_dicomAttributeProvider);
            _clinicalTrialSeriesModule        = new ClinicalTrialSeriesModuleIod(_dicomAttributeProvider);
            _generalEquipmentModule           = new GeneralEquipmentModuleIod(_dicomAttributeProvider);
            _scEquipmentModule          = new ScEquipmentModuleIod(_dicomAttributeProvider);
            _encapsulatedDocumentModule = new EncapsulatedDocumentModuleIod(_dicomAttributeProvider);
            _sopCommonModule            = new SopCommonModuleIod(_dicomAttributeProvider);
        }
Example #4
0
        public FusionSopDataSource(ISopDataSource realSopDataSource, PETFusionType type, IEnumerable <IDicomAttributeProvider> overlayFrames)
        {
            _realSopDataSource = realSopDataSource;
            _fusionHeaders     = new DicomAttributeCollection();

            var scEquipment = new ScEquipmentModuleIod(_fusionHeaders);

            scEquipment.ConversionType = @"WSD";
            scEquipment.SecondaryCaptureDeviceManufacturer           = @"ClearCanvas Inc.";
            scEquipment.SecondaryCaptureDeviceManufacturersModelName = ProductInformation.GetName(false, false);
            scEquipment.SecondaryCaptureDeviceSoftwareVersions       = new[] { ProductInformation.GetVersion(true, true, true, true) };

            // generate values for the General Image Module
            _fusionHeaders[DicomTags.ImageType].SetStringValue(@"DERIVED\SECONDARY");
            _fusionHeaders[DicomTags.SourceImageSequence].Values = UpdateSourceImageSequence(realSopDataSource, overlayFrames);
            UpdateDerivationType(type);
        }
Example #5
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);
        }
Example #6
0
            public static VolumeSopDataSourcePrototype Create(IList <IDicomAttributeProvider> sourceSops, int bitsAllocated, int bitsStored, bool isSigned)
            {
                const string enumYes      = "YES";
                const string enumNo       = "NO";
                const string enumLossy    = "01";
                const string enumLossless = "00";

                VolumeSopDataSourcePrototype prototype     = new VolumeSopDataSourcePrototype();
                DicomAttributeCollection     volumeDataSet = prototype._collection;
                IDicomAttributeProvider      source        = sourceSops[0];

                // perform exact copy on the Patient Module
                foreach (uint tag in PatientModuleIod.DefinedTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on the Clinical Trial Subject Module
                foreach (uint tag in ClinicalTrialSubjectModuleIod.DefinedTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on the General Study Module
                foreach (uint tag in GeneralStudyModuleIod.DefinedTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on the Patient Study Module
                foreach (uint tag in PatientStudyModuleIod.DefinedTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on the Clinical Trial Study Module
                foreach (uint tag in ClinicalTrialStudyModuleIod.DefinedTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on the General Series Module except for tags that will be overridden as part of reformatting
                foreach (uint tag in GeneralSeriesModuleIod.DefinedTags.Except(new[] { DicomTags.LargestPixelValueInSeries, DicomTags.SmallestPixelValueInSeries, DicomTags.SeriesInstanceUid }))
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on the Clinical Trial Series Module
                foreach (uint tag in ClinicalTrialSeriesModuleIod.DefinedTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on additional modality specific modules in the series IE
                foreach (uint tag in ModalitySpecificSeriesModuleTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // perform exact copy on the General Equipment Module
                foreach (uint tag in GeneralEquipmentModuleIod.DefinedTags)
                {
                    volumeDataSet[tag] = source[tag].Copy();
                }

                // generate values for SC Equipment Module
                var scEquipment = new ScEquipmentModuleIod(volumeDataSet);

                scEquipment.ConversionType = @"WSD";
                scEquipment.SecondaryCaptureDeviceManufacturer           = @"ClearCanvas Inc.";
                scEquipment.SecondaryCaptureDeviceManufacturersModelName = ProductInformation.GetName(true, false);
                scEquipment.SecondaryCaptureDeviceSoftwareVersions       = new[] { ProductInformation.GetVersion(true, true, true) };

                // fill series-consistent values for the Frame of Reference Module
                volumeDataSet[DicomTags.FrameOfReferenceUid] = source[DicomTags.FrameOfReferenceUid].Copy();

                // generate values for the General Image Module
                var burnedInAnnotationValues         = sourceSops.Select(s => s[DicomTags.BurnedInAnnotation].GetBoolean(0, enumYes, enumNo)).ToList();
                var burnedInAnnotation               = burnedInAnnotationValues.Any(v => v.GetValueOrDefault(false)) ? true : (burnedInAnnotationValues.All(v => !v.GetValueOrDefault(true)) ? false : (bool?)null);
                var recognizableVisualFeaturesValues = sourceSops.Select(s => s[DicomTags.RecognizableVisualFeatures].GetBoolean(0, enumYes, enumNo)).ToList();
                var recognizableVisualFeatures       = recognizableVisualFeaturesValues.Any(v => v.GetValueOrDefault(false)) ? true : (recognizableVisualFeaturesValues.All(v => !v.GetValueOrDefault(true)) ? false : (bool?)null);
                var lossyImageCompressionValues      = sourceSops.Select(s => s[DicomTags.LossyImageCompression].GetBoolean(0, enumLossy, enumLossless)).ToList();
                var lossyImageCompression            = lossyImageCompressionValues.Any(v => v.GetValueOrDefault(false)) ? true : (lossyImageCompressionValues.All(v => !v.GetValueOrDefault(true)) ? false : (bool?)null);
                var lossyImageCompressionRatioValues = sourceSops.Select(s => s[DicomTags.LossyImageCompressionRatio].GetFloat32(0, 0)).ToList();
                var lossyImageCompressionRatio       = lossyImageCompressionRatioValues.Max();

                volumeDataSet[DicomTags.ImageType].SetStringValue(@"DERIVED\SECONDARY");
                volumeDataSet[DicomTags.DerivationDescription].SetStringValue(@"Multiplanar Reformatting");
                volumeDataSet[DicomTags.DerivationCodeSequence].Values = new[] { new CodeSequenceMacro {
                                                                                     CodingSchemeDesignator = "DCM", CodeValue = "113072", CodeMeaning = "Multiplanar reformatting"
                                                                                 }.DicomSequenceItem };
                volumeDataSet[DicomTags.BurnedInAnnotation].SetBoolean(0, burnedInAnnotation, enumYes, enumNo);
                volumeDataSet[DicomTags.RecognizableVisualFeatures].SetBoolean(0, recognizableVisualFeatures, enumYes, enumNo);
                volumeDataSet[DicomTags.LossyImageCompression].SetBoolean(0, lossyImageCompression, enumLossy, enumLossless);
                if (lossyImageCompressionRatio > 0)
                {
                    volumeDataSet[DicomTags.LossyImageCompressionRatio].SetFloat32(0, lossyImageCompressionRatio);
                }
                // TODO: there's a SourceImageSequence here that we should probably fill out

                // fill series-consistent values for the Image Plane Module
                volumeDataSet[DicomTags.PixelSpacing] = source[DicomTags.PixelSpacing].Copy();

                // fill series-consistent values for the Image Pixel Module
                volumeDataSet[DicomTags.SamplesPerPixel]           = source[DicomTags.SamplesPerPixel].Copy();
                volumeDataSet[DicomTags.PhotometricInterpretation] = source[DicomTags.PhotometricInterpretation].Copy();
                volumeDataSet[DicomTags.BitsAllocated].SetInt32(0, bitsAllocated);
                volumeDataSet[DicomTags.BitsStored].SetInt32(0, bitsStored);
                volumeDataSet[DicomTags.HighBit].SetInt32(0, bitsStored - 1);
                volumeDataSet[DicomTags.PixelRepresentation].SetInt32(0, isSigned ? 1 : 0);

                // fill series-consistent values for the SOP Common Module
                volumeDataSet[DicomTags.SopClassUid].SetStringValue(SopClass.SecondaryCaptureImageStorageUid);

                return(prototype);
            }