[ITK] [ITK-users] how to write grey images into color image using itkScalarToRGBColormapImageFilter

冯婷婷 fttfzzx227 at 126.com
Tue Jul 29 22:56:51 EDT 2014


Hi,
    I want to write some jpg (gray level) images into color image to display different intensities, the range of the intensities in the input image is 0~255.And the code I wrote is as below:


typedef itk::Image< OutputPixelType, 2 >  OutputImageType;


 typedef itk::ScalarToRGBColormapImageFilter< jpgScalarImageType, OutputImageType >  RGBFilterType;


  RGBFilterType::Pointer colormapImageFilter = RGBFilterType::New();


  colormapImageFilter->SetColormap( RGBFilterType::Hot );


  colormapImageFilter->SetInput( InputImage );
  try
    {
    colormapImageFilter->Update();
    }
  catch ( itk::ExceptionObject &err )
    {
    std::cerr << err << std::endl;


    //return EXIT_FAILURE;
    }


OutputImageType::Pointer outputImage = colormapImageFilter->GetOutput();


But after I write the outputImage ,it is all black.Did I miss something ,or is there any other solution to write a grey image into a color image?Thank you!


Best regards!


Tina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140730/01e7a4c3/attachment.html>
-------------- next part --------------
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list