Esempio n. 1
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);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructs a serialization-capable DICOM softcopy presentation state object.
        /// </summary>
        /// <param name="presentationStateSopClass">The SOP class of this type of softcopy presentation state.</param>
        protected DicomSoftcopyPresentationState(SopClass presentationStateSopClass)
        {
            _presentationSopClass = presentationStateSopClass;
            _dicomFile            = new DicomFile();

            _serialized                    = false;
            _sourceAETitle                 = string.Empty;
            _stationName                   = string.Empty;
            _institution                   = Institution.Empty;
            Manufacturer                   = "ClearCanvas Inc.";
            ManufacturersModelName         = ProductInformation.GetName(false, false);
            DeviceSerialNumber             = string.Empty;
            SoftwareVersions               = ProductInformation.GetVersion(true, true, true, true);
            _presentationInstanceNumber    = 1;
            _presentationSopInstanceUid    = string.Empty;
            _presentationSeriesDateTime    = Platform.Time;
            _presentationSeriesNumber      = null;
            _presentationSeriesInstanceUid = string.Empty;
            _presentationLabel             = "FOR_PRESENTATION";
        }
        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(true, false);
            scEquipment.SecondaryCaptureDeviceSoftwareVersions       = new[] { ProductInformation.GetVersion(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[] { new CodeSequenceMacro {
                                                                           CodingSchemeDesignator = "DCM", CodeValue = "113072", CodeMeaning = "Multiplanar reformatting"
                                                                       }.DicomSequenceItem };

            // 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);
        }
Esempio n. 4
0
        private static string GetProductInformation()
        {
            var tags = new List <string>();

            if (!string.IsNullOrEmpty(ProductInformation.Release))
            {
                tags.Add(Titles.LabelNotForDiagnosticUse);
            }
            if (!ServerPlatform.IsManifestVerified)
            {
                tags.Add(ConstantResourceManager.ModifiedInstallation);
            }

            var name = ProductInformation.GetName(false, true);

            if (tags.Count == 0)
            {
                return(name);
            }

            var tagString = string.Join(" | ", tags.ToArray());

            return(string.IsNullOrEmpty(name) ? tagString : string.Format("{0} - {1}", name, tagString));
        }
Esempio n. 5
0
 /// <summary>
 /// Gets the display name for the application. Override this method to provide a custom display name.
 /// </summary>
 protected virtual string GetName()
 {
     return(ProductInformation.GetName(false, false));
 }
Esempio n. 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);
            }