[Insight-users] Image Adaptor problem

Luis Ibanez luis.ibanez at kitware.com
Sun Apr 10 12:01:42 EDT 2005



Hi Rupert,


Thanks for pointing this out.

This is a bug.

The TransformIndexToPhysicalPoint() method should be available at the
level of the ImageBase class, from which the ImageAdaptor derives.

Please add a bug entry for this issue in the bug tracker:


            http://www.itk.org/Bug/


We are not reorganizing the way the image manages orientation
information so, this is very timely.

The methods for converting Indices to Points should be at the
level of the ImageBase class because they do not depend on the
pixel type of the image.



    Thanks




        Luis





---------------------
Rpert Brooks wrote:

> Hi,
> 
> I am trying to register RGB images and, at some point, i need to
> initialize a transform with "Centered Transform Initializer".  This
> class does not like RGB images, so i made an adaptor which returns the
> magnitude of the three components.
> 
> If i declare the Initializer and adaptor like this:
> 
> MagnitudeAdaptorType::Pointer magnitudeAdaptorFixed
> =MagnitudeAdaptorType::New();\
> magnitudeAdaptorFixed->SetImage(fixedImageReader->GetOutput());\
> MagnitudeAdaptorType::Pointer magnitudeAdaptorMoving
> =MagnitudeAdaptorType::New();\
> ....
> 
>   typedef itk::CenteredTransformInitializer< \
>                                     TransformType, \
>                                     MagnitudeAdaptorType, \
>                                     MagnitudeAdaptorType > 
> TransformInitializerType;\
>   TransformInitializerType::Pointer initializer =
> TransformInitializerType::New();\
> 
> I get this error
> /home/rain/igns/tools/itk/itk-2.0_linux_root/include/InsightToolkit/Algorithms/itkImageMomentsCalculator.txx:123:
> no
>    matching function for call to `itk::ImageAdaptor<main(int,
>    char**)::FixedInputImageType, MagnitudePixelAccessor>::
>    TransformIndexToPhysicalPoint(itk::Index<2>&, itk::Point<double, 2>&) const'
> 
> 
> However, if i declare 
>   typedef itk::Image< MagnitudePixelAccessor::ExternalType, Dimension
> 
>> ScalarImageType;\
> 
> ....
>   typedef itk::CenteredTransformInitializer< \
>                                     TransformType, \
>                                     ScalarAdaptorType, \
>                                     ScalarAdaptorType > 
> TransformInitializerType;\
>   TransformInitializerType::Pointer initializer =
> TransformInitializerType::New();\
> 
> Then i get this error when i try to pass it the Adaptor - it complains
> that its not getting the type that it was declared with.
> 
> probe_2d_vector.cxx:84: no matching function for call to `
>    itk::CenteredTransformInitializer<main(int, char**)::TransformType,
>    main(int, char**)::ScalarImageType, main(int, char**)::ScalarImageType>::
>    SetFixedImage(itk::SmartPointer<itk::ImageAdaptor<main(int,
>    char**)::FixedInputImageType, MagnitudePixelAccessor> >&)'
> /home/rain/igns/tools/itk/itk-2.0_linux_root/include/InsightToolkit/Common/itkCenteredTransformInitializer.h:116:
> candidates
>    are: void itk::CenteredTransformInitializer<TTransform, TFixedImage,
>    TMovingImage>::SetFixedImage(const TFixedImage*) [with TTransform =
>    main(int, char**)::TransformType, TFixedImage = main(int,
>    char**)::ScalarImageType, TMovingImage = main(int, char**)::ScalarImageType]
> 
> In a fit of anger i cast it..... 
> initializer->SetMovingImage( (ScalarImageType *) (void *)
> magnitudeAdaptorMoving );
> and it compiles.... but i have a feeling this may cause problems later =-)
> 
> I guess i've misunderstood something, as i thought that image adaptors
> should expose the whole api for images.   What should i be doing here?
>  I'm using gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
> 
> Thanks in advance
> 
> Rupert B





More information about the Insight-users mailing list