[Insight-users] DICOM Pixel Type

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Feb 5 07:55:53 EST 2014


Hello,

You need to get the appropriate ImageIO for the file. Then determine the pixel type. Last you need to dispatch with a switch statement to a function templated over the pixel type

This was the best example I could find:
http://www.itk.org/Wiki/ITK/Examples/IO/ReadUnknownImageType

This is a little bit of a shameless plug but here is how I do it in SimpleITK:
In SimpleITK the image class template free, but type aware. I have a large case statement to pick up type/dimension of the file type:

https://github.com/SimpleITK/SimpleITK/blob/master/Code/IO/src/sitkImageReaderBase.cxx#L62

Which eventually get dispatched to a template function:
https://github.com/SimpleITK/SimpleITK/blob/master/Code/IO/src/sitkImageFileReader.cxx#L92

Here is also a another example from a Slicer3d CLI;
https://github.com/Slicer/Slicer/blob/master/Modules/CLI/ConnectedComponent/ConnectedComponent.cxx#L76

Hope this helps,
Brad

On Feb 5, 2014, at 4:34 AM, Ricardo A Corredor <ra.corredor at gmail.com> wrote:

> Hi everyone, 
> 
> I still have a question that I know you can answer very precisely and
> quickly. 
> 
> In the DICOM read examples  it is assumed a pixel data type of signed short.
> Even the itkUserGuide says that "we assume a signed short pixel type that is
> commonly used for X-Rays CT Scanners". However, in the DICOM standard
> description it seems to appear a flag for unsigned and signed data, and even
> if the pixel type is not implicit, it seems that it is possible to have
> DICOM images in different types (the MeVisLab documentation says that DICOM
> supports only integer types, is it correct?
> http://www.mevislab.de/docs/2.2.1/MeVisLab/Resources/Documentation/Publish/SDK/GettingStarted/ch11s07.html). 
> 
> So my question is:
> 
> - How can you determine the pixel data before the instantiation of the
> DICOMReader according to the DICOM Metadata Tags? Normally, you define
> statically the pixel type -in the template- before reading the tags. Is it
> mandatory to define a sort of parameter to define manually the type of image
> to be read (signed, unsigned, short, int, char?
> 
> Thank you in advance for your replies!
> 
> 
> 
> -------------------------------------------------------------
> Ricardo A. Corredor
> Medical Image Processing and SW Engineering
> @rcorredorj
> RaC
> 
> 
> 
> 
> --
> View this message in context: http://itk-users.7.n7.nabble.com/DICOM-Pixel-Type-tp33330.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list