[Insight-users] Image Adaptor problem
Rupert Brooks
rupe.brooks at gmail.com
Thu Apr 7 15:12:09 EDT 2005
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
--
--------------------------------------------------------------
Rupert Brooks
McGill Centre for Intelligent Machines (www.cim.mcgill.ca)
Ph.D Program in Intelligent Systems
http://www.cyberus.ca/~rbrooks
More information about the Insight-users
mailing list