[Insight-developers] Re: design problem with VectorImage and ImageAdaptor ?

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Tue Mar 7 18:03:55 EST 2006


On Tuesday 07 March 2006 22:25, Karthik Krishnan wrote:
> Gaetan Lehmann wrote:
> >Karthik, Luis,
> >
> >I get some errors when wrapping VectorImageToImageAdaptor. Some can be
> >resolved by a small change in a typedef in ImageAdaptor -
>
> Is it fixed with this fix ?
> http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkVectorImageToImageAda
>ptor.h?root=Insight&r1=1.7&r2=1.8
>

Yes, it builds, with 

  typedef typename TImage::InternalPixelType InternalPixelType;

in itkImageAdaptor.h, instead of 

  typedef typename TAccessor::InternalType InternalPixelType;

I don't know how it can break backward compatibility, and I'm even not sure 
it's a really pertinent change.

but the build fail with ImageFileReader (I have tried to built this class with 
VectorIamge before):

/usr/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h: In static 
member function 'static unsigned int 
itk::DefaultConvertPixelTraits<PixelType>::GetNumberOfComponents() [with 
PixelType = itk::VariableLengthVector<unsigned char>]':
/usr/include/InsightToolkit/IO/itkImageFileReader.txx:347:   instantiated from 
'void itk::ImageFileReader<TOutputImage, ConvertPixelTraits>::GenerateData() 
[with TOutputImage = itk::VectorImage<unsigned char, 3u>, ConvertPixelTraits 
= itk::DefaultConvertPixelTraits<itk::VariableLengthVector<unsigned char> >]'
/home/gaetan/src/WrapITK/build/IO/wrap_itkImageFileReaderPython.cxx:14669:   
instantiated from here
/usr/include/InsightToolkit/IO/itkDefaultConvertPixelTraits.h:47: error: 
'GetNumberOfComponents' is not a member of 
'itk::VariableLengthVector<unsigned char>'
/usr/include/InsightToolkit/IO/itkConvertPixelBuffer.txx: In static member 
function 'static void itk::ConvertPixelBuffer<InputPixelType, 
OutputPixelType, OutputConvertTraits>::ConvertGrayToGray(InputPixelType*, 
OutputPixelType*, int) [with InputPixelType = unsigned char, OutputPixelType 
= unsigned char, OutputConvertTraits = 
itk::DefaultConvertPixelTraits<itk::VariableLengthVector<unsigned char> >]':
/usr/include/InsightToolkit/IO/itkConvertPixelBuffer.txx:43:   instantiated 
from 'static void itk::ConvertPixelBuffer<InputPixelType, OutputPixelType, 
OutputConvertTraits>::Convert(InputPixelType*, int, OutputPixelType*, int) 
[with InputPixelType = unsigned char, OutputPixelType = unsigned char, 
OutputConvertTraits = 
itk::DefaultConvertPixelTraits<itk::VariableLengthVector<unsigned char> >]'
/usr/include/InsightToolkit/IO/itkImageFileReader.txx:433:   instantiated from 
'void itk::ImageFileReader<TOutputImage, 
ConvertPixelTraits>::DoConvertBuffer(void*, long unsigned int) [with 
TOutputImage = itk::VectorImage<unsigned char, 3u>, ConvertPixelTraits = 
itk::DefaultConvertPixelTraits<itk::VariableLengthVector<unsigned char> >]'


I'm using ITK 2.4.1. ITK cvs would solve that problem ?

> >  void SetPixel(const IndexType &index, const PixelType & value)
> >    { m_PixelAccessor.Set( m_Image->GetPixel(index), value ); }
> >
> >give the error
> >
> >
> >
> >There is this error message because GetPixel() in VectorImage does not
> > return a reference to the pixel:
>
> GetPixel() in VectorImage cannot return a reference to a pixel. It
> returns a VariableLengthVector< T > pixel created on the stack. This is
> because the data buffer does not actually contain references and
> pointers types of VariableLengthVector< T >, but 'n' pixels of type T
> itself.
>
> >An important design problem to use VectorImage with ImageAdaptor ?
>
> Not really. I was just an example. Since you've wrapped VectorImage and
> VariableLengthVector, it should generally suffice.
>

How do you extract a normal image from a vector image without it ?



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20060308/3a212f58/attachment.pgp


More information about the Insight-developers mailing list