[Insight-users] ManagedITK DICOM Losing Color
rlee
rlee at usc.edu
Wed Nov 5 03:33:04 EST 2008
Hi Dan,
Thanks for the pointers! I'll try recompiling the ManagedITK with rgb
unsigned short and give that a try.
rlee
Dan Mueller-2 wrote:
>
> Hi rlee,
>
> The problem seems to be that you are using ManagedITK to read a signed
> short (SS2) image. By using this image you are forcing the reader to
> cast the DICOM image to a single channel (greyscale) image. You are
> then passing this single channel buffer to the bitmap (when it is
> expecting a 3 channel buffer). Instead you should read using a RGB
> image, eg.
>
> itkImageBase image = itk.Image_RGBUC2.New();
>
> Note that by default only unsigned char RGB images are wrapped... You
> will have to turn on the WRAP_rgb_unsigned_short when you compile
> ManagedITK.
>
> (BTW: you may want to look at section 4.1.6 of the ManagedITK manual
> which shows the best way to import an ITK image buffer into a .NET
> bitmap.)
>
> Hope this helps.
>
> Regards, Dan
>
> 2008/11/5 rlee <rlee at usc.edu>:
>>
>> 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.
>>
>> When I try loading DICOM images with the default transfer syntax, I
>> notice
>> the same effect. There is only one component per pixel and the bitmap
>> renders a a shade of blue.
>>
>> Can someone let me know if I'm approaching this incorrectly?
>>
>> Thanks!
>>
>> rlee
>> --
>> View this message in context:
>> http://www.nabble.com/ManagedITK-DICOM-Losing-Color-tp20337287p20337287.html
>> Sent from the ITK - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
--
View this message in context: http://www.nabble.com/ManagedITK-DICOM-Losing-Color-tp20337287p20337800.html
Sent from the ITK - Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list