Exemplo n.º 1
0
        public override DICOMImage Parse()
        {
            // Read the pixel data from the image, frame 0
            IPixelData pixelData = PixelDataFactory.Create(image.PixelData, 0);

            // Get the pixels from the pixel data
            ushort[] pixels = ((GrayscalePixelDataU16)pixelData).Data;

            // Get the multiplier
            int min = image.PixelData.BitDepth.MinimumValue;
            int max = image.PixelData.BitDepth.MaximumValue;

            if (min != 0)
            {
                throw new FormatException("Error in the minimum value of the pixel data");
            }

            float multiplier = ushort.MaxValue / max;

            // Apply the multiplier to the pixels
            for (int i = 0; i < pixels.Length; i++)
            {
                pixels[i] = (ushort)(pixels[i] * multiplier);
            }

            return(DICOMImage.FromData(image.Width, image.Height, pixels));
        }
Exemplo n.º 2
0
        public override DICOMImage Parse()
        {
            ReadData();

            return(DICOMImage.FromData(width, height, pixelData));
        }