[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/insight-users/attachments/20140730/01e7a4c3/attachment.html>


More information about the Insight-users mailing list