[Insight-users] Registration Example Program

Dill, John john-dill at uiowa . edu
Tue, 19 Aug 2003 14:48:22 -0500


I am trying to modify a registration example by making my own directory and
copying the source code a generating my own CMakeLists file.  But when I try
to compile, I get this message:

Building object file ImageRegistration2.o...
/home/jadill/src/jadtools/MIRigid2DRegistration/ImageRegistration2.cxx: In
function `int main (int, 
char **)':
/home/jadill/src/jadtools/MIRigid2DRegistration/ImageRegistration2.cxx:436:
no matching function for 
call to `itk::ResampleImageFilter<main (int, char **)::MovingImageType, main
(int, char 
**)::FixedImageType>::SetTransform
(itk::SmartPointer<itk::TranslationTransform<double, 2> > &)'
/usr/local/include/InsightToolkit/BasicFilters/itkResampleImageFilter.h:109:
candidates are: void 
itk::ResampleImageFilter<TInputImage, TOutputImage>::SetTransform (typename
itk::Transform<double, 
itk::ResampleImageFilter<TInputImage, TOutputImage>::ImageDimension, 
itk::ResampleImageFilter<TInputImage,
TOutputImage>::ImageDimension>::Pointer) [with TInputImage = main 
(int, char **)::MovingImageType, TOutputImage = main (int, char
**)::FixedImageType]
gmake[1]: *** [ImageRegistration2.o] Error 1
gmake: *** [default_target] Error 2

I have just a copy of ImageRegistration2.cxx and it compiles fine and runs
when its in the Insight source tree.  Here is my CMakeLists.txt file:

# This project is designed to be built outside the Insight source tree.
PROJECT(ImageRegistration2)

# Find ITK.
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
          "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)

ADD_EXECUTABLE(ImageRegistration2 ImageRegistration2.cxx )

TARGET_LINK_LIBRARIES(ImageRegistration2 ITKNumerics ITKIO ITKMetaIO
ITKBasicFilters ITKCommon VXLNumerics png pthread dl)

I haven't had any success understanding the problem.  I also don't
understand why the CMakeLists.txt under Examples/Registration do not have
all these libraries that I seem to need to correct link time errors (if I
comment out the offending code).  Any insight would be greatly appreciated.
Thanks.

John