Exemple #1
0
        public static IPipeline Create(DcmDataset dataset, DcmPixelData pixelData)
        {
            PhotometricInterpretation pi = PhotometricInterpretation.Lookup(pixelData.PhotometricInterpretation);

            if (pi == PhotometricInterpretation.Monochrome1 || pi == PhotometricInterpretation.Monochrome2)
            {
                GenericGrayscalePipeline pipeline = new GenericGrayscalePipeline(pixelData.RescaleSlope, pixelData.RescaleIntercept, pixelData.BitsStored, pixelData.IsSigned);
                if (pi == PhotometricInterpretation.Monochrome1)
                {
                    pipeline.ColorMap = ColorTable.Monochrome1;
                }
                else
                {
                    pipeline.ColorMap = ColorTable.Monochrome2;
                }
                WindowLevel[] wl = WindowLevel.FromDataset(dataset);
                if (wl.Length > 0)
                {
                    pipeline.WindowLevel = wl[0];
                }
                return(pipeline);
            }
            else if (pi == PhotometricInterpretation.Rgb)
            {
                return(new RgbColorPipeline());
            }
            else
            {
                throw new DicomImagingException("Unsupported pipeline photometric interpretation: {0}", pi.Value);
            }
        }
Exemple #2
0
 public static IPipeline Create(DcmDataset dataset, DcmPixelData pixelData)
 {
     PhotometricInterpretation pi = PhotometricInterpretation.Lookup(pixelData.PhotometricInterpretation);
     if (pi == PhotometricInterpretation.Monochrome1 || pi == PhotometricInterpretation.Monochrome2) {
         GenericGrayscalePipeline pipeline = new GenericGrayscalePipeline(pixelData.RescaleSlope, pixelData.RescaleIntercept, pixelData.BitsStored, pixelData.IsSigned);
         if (pi == PhotometricInterpretation.Monochrome1)
             pipeline.ColorMap = ColorTable.Monochrome1;
         else
             pipeline.ColorMap = ColorTable.Monochrome2;
         WindowLevel[] wl = WindowLevel.FromDataset(dataset);
         if (wl.Length > 0)
             pipeline.WindowLevel = wl[0];
         return pipeline;
     }
     else if (pi == PhotometricInterpretation.Rgb)
     {
         return new RgbColorPipeline();
     }
     else if (pi == PhotometricInterpretation.YbrFull || pi == PhotometricInterpretation.YbrFull422)
     {
         return new RgbColorPipeline();
     }
     else
     {
         throw new DicomImagingException("Unsupported pipeline photometric interpretation: {0}", pi.Value);
     }
 }