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

Luis Ibanez luis.ibanez@kitware.com
Fri, 24 Jan 2003 13:00:38 -0500


Hi John,

Your instantiation of the ImportImageFilter
looks ok. If this is generating compiling
errors there may we something for us to fix.

About the option of the ImageAdaptor.
Please take a look at the following
classes:

Insight/Code/Common/
         itkBluePixelAccessor.h
         itkGreenPixelAccessor.h
         itkRedPixelAccessor.h

They are designed to be used in conjunction
with the itkImageAdaptor.

The combination is pretty simple. The
Adaptor is templated over the PixelAccessor.

The PixelAccessor above allow you to use
an RGB image as a set of three scalar images
with each one with one of the R, G, B components.

An example on how to do this is available
under


Insight/Testing/Code/Common
            itkImageAdaptorTest.cxx


Please let us know if you have any questions
on how to use these classes.

Thanks


Luis


=-=-----------------------------------------

John David Fleig wrote:

> 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.
>>
>>
>>
> 
>