[Insight-users] ManagedITK DICOM Losing Color

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Nov 5 02:49:38 EST 2008


On Wed, Nov 5, 2008 at 8:42 AM, rlee <rlee at usc.edu> wrote:
>
> I'm trying to use ManagedITK 3.8 to read in a DICOM ultrasound with transfer
> syntax 1.2.840.10008.1.2.4.70 (Lossless JPEG) and convert it to a Bitmap
> using the following code:
>
> itkImageBase image = itk.itkImage_SS2.New();
> itk.itkImageFileReader_ISS2 reader = itk.itkImageFileReader_ISS2.New();
> itk.itkGDCMImageIO gdcmImageIO = itk.itkGDCMImageIO.New();
> reader.SetImageIO(gdcmImageIO);
>
> reader.FileName = dicomFileInfo.FullName;
> reader.Update();
> reader.GetOutput(image);
>
> Bitmap bitmap;
> PixelFormat format = PixelFormat.Format24bppRgb;
>
> bitmap = new Bitmap(image.Size[0], image.Size[1], format);
> itk.itkImageRegionConstIteratorWithIndex_ISS2 iterator = new
> itk.itkImageRegionConstIteratorWithIndex_ISS2(image,
> image.LargestPossibleRegion);
> int pixelCounter = 0;
>
> The salient DICOM headers are:
>
> 0028,0002 Samples Per Pixel = 3
> 0028,0004 Photometric Interpretation = RGB
> 0028,0006 Planar Configuration = 0
> 0028,0010 Rows = 480
> 0028,0011 Columns = 640
> 0028,0100 Bits Allocated = 8
> 0028,0101 Bits Stored = 8
> 0028,0102 High Bit = 7
> 0028,0103 Pixel Representation = 0
>
> Strangely, the resulting image object has a "number of components per pixel"
> = 1. When I render the bitmap, it is a shade of blue.


You are requesting for a "itkImage_SS2" type. Can you store 3comps
image in this ?
Because Pixel Rep is 0, I would use an unsigned type.

2cts
-- 
Mathieu


More information about the Insight-users mailing list