[Insight-users] Flexible Vector Image class - ImageToListAdaptor

Karthik Krishnan Karthik.Krishnan at kitware.com
Tue Nov 22 15:17:58 EST 2005


ImageToListAdaptor will work only on pixeltypes where the length is 
known before hand.

For instance ImageToListAdaptor will work on
Image< FixedArray< float, 10 > , 3 >
but not
Image< VariableLengthVector< float > , 3 >
or
VectorImage< float, 3 >

Your best bet is to write a function that creates the list using the 
interfaces provided in ListSample.
If you are using ITK 2.2 and above, you should be able to instantiate a 
itk::ListSample< VariableLengthVector< float > > and manually fill it 
using the Get() inteface on the ImageIterator and PushBack() interface 
from the list.

of course, this will not be an adaptor..

thanks
karthik

Dr. Uwe Köhler wrote:

>Dear Karthik,
>
>didn't mange to get typedef 
>itk::Statistics::ImageToListAdaptor<VectorImageType > 
>    ImageToListAdaptorType ;
>to work. Gave these compiler errors:
>
>/usr/local/include/InsightToolkit/Common/itkPixelTraits.h: In instantiation of 
>`itk::PixelTraits<itk::VariableLengthVector<float> >':
>/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h:97:   
>instantiated from `itk::Statistics::ImageToListAdaptor<VectorImageType, 
>itk::VariableLengthVector<float> >'
>/home/ukoehler/devel/C++/ITK/MultiContrastTest/Vectortest.cpp:162:   
>instantiated from here
>/usr/local/include/InsightToolkit/Common/itkPixelTraits.h:39: error: `Length'
>   is not a member of type `itk::VariableLengthVector<float>'
>
>Just glad that is not internationalized to German.
>
>Any ideas?
>
>Uwe
>
>Am Freitag, 18. November 2005 23:31 schrieben Sie:
>  
>
>>Thanks very much for the bug report. One of those is a bug report, the
>>other is not. The bug is  fixed.
>>
>>Please update your CVS, (at least the files in the Statistics folder.)
>>
>>The MHD reader and all other readers/writers that support
>>multi-component images (VTK, Nrrd.... )
>>
>>The reader has to be instantiated like this:
>>
>>typedef itk::VectorImage< double, 3 > VectorImageType;
>>typedef itk::ImageFileReader< VectorImageType,
>>
>>itk::DefaultConvertPixelTraits< PixelType > > ReaderType;
>>........
>>
>>
>>The writer does not require this.
>>
>>I thought I obtained that via traits from the ImageType, but looks like
>>I forgot to do that. B
>>
>>Please see
>>Testing/Code/Common/itkVectorImageTest.cxx
>>This does IO/Iterators/Adaptors etc on the VectorImage.
>>
>>
>>Thanks
>>Regards
>>Karthik.
>>
>>    
>>
>
>  
>


More information about the Insight-users mailing list