Exemple #1
0
        public static List <VoiDataLut> Create(IDicomElementProvider elementProvider)
        {
            if (elementProvider == null)
            {
                throw new ArgumentNullException("elementProvider");
            }

            DicomElementSq voiLutSequence = elementProvider[DicomTags.VoiLutSequence] as DicomElementSq;

            if (voiLutSequence == null)
            {
                return(new List <VoiDataLut>());
            }

            DicomElementSq modalityLutSequence = elementProvider[DicomTags.ModalityLutSequence] as DicomElementSq;
            int            pixelRepresentation = GetPixelRepresentation(elementProvider);

            if (IsValidAttribute(modalityLutSequence))
            {
                return(Create(voiLutSequence, modalityLutSequence, pixelRepresentation));
            }

            DicomElement rescaleInterceptElement = elementProvider[DicomTags.RescaleIntercept];

            if (IsValidAttribute(rescaleInterceptElement))
            {
                double rescaleSlope     = GetRescaleSlope(elementProvider);
                double rescaleIntercept = rescaleInterceptElement.GetFloat64(0, 0);
                int    bitsStored       = GetBitsStored(elementProvider);

                return(Create(voiLutSequence, bitsStored, pixelRepresentation, rescaleSlope, rescaleIntercept));
            }

            return(Create(voiLutSequence, pixelRepresentation));
        }
Exemple #2
0
        private static double GetRescaleSlope(IDicomElementProvider elementProvider)
        {
            DicomElement rescaleSlopeElement = elementProvider[DicomTags.RescaleSlope];

            if (rescaleSlopeElement == null)
            {
                return(1.0);
            }
            else
            {
                return(rescaleSlopeElement.GetFloat64(0, 1));
            }
        }