[Insight-users] Problem in Setting pixel values to different color

Luis Ibanez luis.ibanez at kitware.com
Sun Nov 22 16:20:54 EST 2009


Hi Harish,

In order to color encode an image,
you may want to use the new filter:

  Insight/Code/Review/
       itkScalarToRGBColormapImageFilter.h

that is described in the following Insight Journal paper:

   http://www.insight-journal.org/browse/publication/285
"Meeting Andy Warhol Somewhere Over the Rainbow: RGB Colormapping and ITK"
by Tustison N., Zhang H., Lehmann G., Yushkevich P., Gee J.
http://hdl.handle.net/1926/1452

You may have to customize one of the colormap classes.


Another option is to use random color encoding,
as described in the Watershed example:

  Insight/Examples/Segmentation/
               WatershedSegmentation1.cxx
               WatershedSegmentation2.cxx

with the filter:

  typedef itk::Functor::ScalarToRGBPixelFunctor<unsigned long>
    ColorMapFunctorType;
  typedef itk::UnaryFunctorImageFilter<LabeledImageType,
    RGBImageType, ColorMapFunctorType> ColorMapFilterType;

  ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();



   Regards,


         Luis

--------------------------------------------------------------------------------
On Tue, Nov 17, 2009 at 3:37 PM, Harish Doddi <harish.slicer at gmail.com> wrote:
> Hi all,
>
> I am using MRI gray scale images as input to an algorithm, creating a output
> image out of it. Now in my final output image, I want some pixel values to
> be set to green color and some to red color.
>
> So if "it" is an iterator on outputImage then I am doing
> it.set(GreenPixelValue)
>
> Now what is the GreenPixelValue I need to give. Initially I copy the input
> gray scale image to outputImage but after some processing, I want to set new
> pixel values like green color, red color etc. How can I do this in ITK.
>
> Thanks,
> Harish
>
> _____________________________________
> 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.html
>
> 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