[Insight-users] vtk -> itk -> (itk process) -> itk -> vtk

John David Fleig fleig@bmi.osu.edu
Fri, 24 Jan 2003 12:14:34 -0500 (EST)


I tried for option 2 first, and tried:

typedef itk::RGBPixel< unsigned char > PixelType;
typedef itk::Image<PixelType, 3> ImageType;
typedef itk::ImportImageFilter< PixelType , 3 > ImportFilterType;

but this gave me compile errors, so I'm guessing that it really does 
expect TPixel and forcing it to accept a RGBPixel isn't going to work.

Then I tried looking back into option 1.

I saw in itkConvertPixelBuffer, that more or less the conversions were 
done manually:

  OutputConvertTraits
        ::SetNthComponent(0, *outputData, 
                          static_cast<OutputComponentType>
                          (*inputData));

looping over each pixel between input and output.

Is this the only way to say take three input images and merge them 
together into an rgb, or is there another filter that I'm overlooking that 
will be easier.

Thanks,
David


On Fri, 24 Jan 2003, Luis Ibanez wrote:

> Hi John,
> 
> Probably the real solution is for us to
> extend the VTK/ITK import mechanism for
> supporting Color images.
> 
> In the meantime, both of your (1) and (2)
> options are feasible.
> 
> For option (1) you may want to look at the
> ImageAdaptors in ITK. They allow to merge
> three scalar images into a single RGBImage.
> You could do this both as a filter or as
> an Adaptor. The adaptor is probably the best
> tradeoff in memory.
> 
> For option (2) the limitation is that
> the pipeline updates between ITK and VTK
> will have to be managed manually. But,
> if you want to solve the problem in
> less than an hour. That seems to be the
> way to go.
> 
>