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

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


Karthik, Luis,

I get some errors when wrapping VectorImageToImageAdaptor. Some can be 
resolved by a small change in a typedef in ImageAdaptor - but it may break 
backward compatibility - but there is one I don't know how to fix:

  void SetPixel(const IndexType &index, const PixelType & value)
    { m_PixelAccessor.Set( m_Image->GetPixel(index), value ); }

give the error

/usr/include/InsightToolkit/Common/itkImageAdaptor.h: In member function 'void 
itk::ImageAdaptor<TImage, TAccessor>::SetPixel(const typename 
itk::ImageBase<itk::ImageAdaptor<TImage,TAccessor>::ImageDimension>::IndexType&, 
const typename TAccessor::ExternalType&) [with TImage = 
itk::VectorImage<unsigned char, 3u>, TAccessor = 
itk::Accessor::VectorImageToImagePixelAccessor<unsigned char>]':

/home/gaetan/src/WrapITK/build/CommonA/wrap_itkVectorImageToImageAdaptorPython.cxx:2548:   
instantiated from here

/usr/include/InsightToolkit/Common/itkImageAdaptor.h:172: error: no matching 
function for call to 'itk::Accessor::VectorImageToImagePixelAccessor<unsigned 
char>::Set(itk::VariableLengthVector<unsigned char>, const unsigned char&)'

/usr/include/InsightToolkit/Common/itkVectorImageToImageAdaptor.h:60: note: 
candidates are: void 
itk::Accessor::VectorImageToImagePixelAccessor<TType>::Set(itk::VariableLengthVector<TValueType>&, 
const TType&) const [with TType = unsigned char]


There is this error message because GetPixel() in VectorImage does not return 
a reference to the pixel:

  PixelType GetPixel(const IndexType &index )
    {
    OffsetValueType offset = m_VectorLength * this->ComputeOffset(index);
    PixelType p( &((*m_Buffer)[offset]), m_VectorLength ); 
    return p;
    }


It seem difficult in that case to return a reference to the pixel.

An important design problem to use VectorImage with ImageAdaptor ?

Gaetan

-------------- 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/20060307/923f7e3c/attachment.pgp


More information about the Insight-developers mailing list