[Insight-users] Registration Example Program

Dill, John john-dill at uiowa . edu
Tue, 19 Aug 2003 17:28:45 -0500


Hi Luis.

That is the really confusing part.  The files are exactly the same.  Diff
returns no difference.

I tried the HelloWorld copied into a different directory, and it works okay,
although I still have to add those other libraries to the CMakeLists file
for it to link (don't know why).  When I try to link in itkpng instead of
png, itkpng not found, except that it's looking for Insight-1.0.0 when I
only should have Insight-1.2.0.  I think what is happening is that I had
installed an older version of ITK but didn't get it cleaned up so it's using
the wrong version when I'm compiling, and I don't believe I did a gmake
install on the 1.2.0 distribution.  I've got some cleaning to do.

Many thanks,
John

> -----Original Message-----
> From: Luis Ibanez [mailto:luis . ibanez at kitware . com]
> Sent: Tuesday, August 19, 2003 4:48 PM
> To: Dill, John
> Cc: 'insight-users at itk . org'
> Subject: Re: [Insight-users] Registration Example Program
> 
> 
> 
> Hi Dill,
> 
> 
> 1) There must be a change between the ImageRegistration2.cxx
>     in your external directory and the one in
> 
>       Insight/Examples/Registration/ImageRegistration2.cxx
> 
>     Could you please make a 'diff' and post the result to the list ?
> 
>     Something like
> 
>     diff myDirectory/ImageRegistration2.cxx
>              
> ~/src/Insight/Examples/Registration/ImageRegistration2.cxx
> 
>    (in a single line...)
> 
> 
>    I'm guessing that something like a modification in the image
>    dimension may have triggered the error that you reported.
> 
> 
> 
> 2) Your CMakeLists.txt file looks ok,
> 
>     You actually don't need to specify all these libraries.
>     CMake keeps track of the dependencies in ITK libraries.
>     So, for example, by linking with ITKIO, you will get for
>     free ITKCommon, itkpng, ITKMetaIO and pthreads.
> 
> 
>     You shold be ok by using only ITKIO and ITKBasicFilters
> 
> 
>     Note also that by adding "png" you are linking with the
>     png library installed in your system, not the one distributed
>     in Insight/Utilities. The one distributed with Insight is
>     renamed "itkpng".  In any case, you shouldn't need to add it
>     to the CMakeLists.txt file, ITKIO should pull it in as a
>     dependency.
> 
> 
> 
> Please let us know about the diff in (1),
> 
> 
> Thanks
> 
> 
> 
>    Luis
> 
> 
> 
> 
> -------------------
> Dill, John wrote:
> > 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/ImageRegistrat
> ion2.cxx: In
> > function `int main (int, 
> > char **)':
> > 
> /home/jadill/src/jadtools/MIRigid2DRegistration/ImageRegistrat
> ion2.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/itkResampleImag
> eFilter.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
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk . org
> > http://www . itk . org/mailman/listinfo/insight-users
> > 
> 
> 
>