[Insight-developers] Get dicom data value in rgb format

Andinet Enquobahrie andinet.enqu at kitware.com
Tue Jan 24 15:48:48 EST 2006


Hello Huiliang,

>When I read a series of 2D dicom file and get the 3D volume, I want to 
>further process the data in my application. So I copy the 3D volume 
>data to a local buffer. But the value inside the 3D volume is unsigned 
>long. How can I map the unsigned long value to rgb value between 0~255?
>_______________________________________________
>
>
>  
>
Try the following....

typedef itk::RGBPixel<unsigned char>   RGBPixelType;
typedef itk::Image<RGBPixelType, 3>    RGBImageType;
typedef itk::Image<unsigned long, 3>   LabeledImageType;

typedef itk::Functor::ScalarToRGBPixelFunctor<unsigned long>
    ColorMapFunctorType;
  typedef itk::UnaryFunctorImageFilter<LabeledImageType,
    RGBImageType, ColorMapFunctorType> ColorMapFilterType;
  ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();
  

-Andinet




More information about the Insight-developers mailing list