[Insight-users] Error in compilation of WatershedImageFilter in a standalone
Feng Ma
mafeng at hotmail . com
Wed, 17 Sep 2003 13:31:53 -0400
Luis:
By the way, the Makefile I generated would include a VHDIO library which is
my IO factory to/from ITK. It does not matter because I did not use it in
this test project.
I will also study the VolView plug in example. Thanks.
-Feng
>From: Luis Ibanez <luis . ibanez at kitware . com>
>To: Feng Ma <mafeng at hotmail . com>
>CC: insight-users at itk . org
>Subject: Re: [Insight-users] Error in compilation of WatershedImageFilter
>in a standalone project
>Date: Wed, 17 Sep 2003 11:32:08 -0400
>
>Hi Feng,
>
>
>You are probably missing to link with the library
>
> ITKAlgorithms
>
>Note that
>
> itkWatershedMiniPipelineProgressCommand.cxx
>
>is actually compiled and packaged in to that library,
>(It is one of those rare ITK classes that are not templated)
>
>
>Please make sure that you add this library to your
>CMakeLists.txt file.
>
>
>-----
>
>
>It is entirely possible to wrap ITK code into C functions.
>
>This is exactly what we did for implementing the VolView
>plugins available in InsightApplications, and works fine.
>
>As you said,
>this will be a very common approach for integrating
>ITK functionalities into other projects.
>
>
>
> Regards,
>
>
> Luis
>
>
>---------------------------------------
>Feng Ma wrote:
>>Hi,
>>
>> I am working on a project which call ITK watershed library inside a C
>>function. To do this, I wrote a C++ wrapper which uses
>>itk::ResampleImageFilter, itk::CurvatureAnisotropicDiffusionImageFilter,
>>itk::GradientMagnitudeImageFilter and itk::WatershedImageFilter. Basically
>>the same operation as we saw in the watershed example. Then the main C
>>function will call this c++ wrapper. The wrapper is compiled using c++
>>compiler (g++). The main function is compiled using c compiler (gcc). The
>>project is finally linked using g++. I do declare the wrapper function to
>>be extern "C" in order to be able to call from a C function.
>>
>> I use cmake to construct the project. However, I got the following error
>>during the final link stage, related to watershed image filter:
>>
>>/r2net/r2/fma/ITK/lib/InsightToolkit/libITKWrapLib.a(itkWatershed3DSeg.o):
>>In function `itk::WatershedImageFilter<itk::Image<float, 3>
>> >::WatershedImageFilter(void)':
>>itkWatershed3DSeg.o(.itk::WatershedImageFilter<itk::Image<float, 3>
>> >::gnu.linkonce.t.(void)+0x5a7): undefined reference to
>>`itk::WatershedMiniPipelineProgressCommand type_info function'
>>itkWatershed3DSeg.o(.itk::WatershedImageFilter<itk::Image<float, 3>
>> >::gnu.linkonce.t.(void)+0x5d9): undefined reference to
>>`itk::WatershedMiniPipelineProgressCommand type_info function'
>>itkWatershed3DSeg.o(.itk::WatershedImageFilter<itk::Image<float, 3>
>> >::gnu.linkonce.t.(void)+0x65b): undefined reference to
>>`itk::WatershedMiniPipelineProgressCommand virtual table'
>>/r2net/r2/fma/ITK/lib/InsightToolkit/libITKWrapLib.a(itkWatershed3DSeg.o):
>>In function `itk::WatershedImageFilter<itk::Image<float, 3>
>> >::GenerateData(void)':
>>itkWatershed3DSeg.o(.itk::WatershedImageFilter<itk::Image<float, 3>
>> >::gnu.linkonce.t.GenerateData(void)+0x1ab): undefined reference to
>>`itk::WatershedMiniPipelineProgressCommand type_info function'
>>collect2: ld returned 1 exit status
>>
>> If I commented out parts related to watershed, there is no error.
>>
>> If I remove the extern "C" for the wrapper, also change the caller to
>>be a c++ file and compile the calling function using c++, I got the same
>>error.
>>
>> If I build the same application inside InsightApplication tree, without
>>using wrappers, I don't have any error.
>>
>> Any thoughts on this? I am thinking my situation may be a common
>>situation for some users. We want to call ITK functions from some legacy
>>code which is c-compatible. To use ITK library, one easy way is to write a
>>c wrapper.
>>
>> If needed, I will post my code here. I am using CVS version of ITK. I
>>could not remember the exact date I checked out, but should be after 1.2
>>release. My "cvs status" shows:
>>===================================================================
>>File: itkWatershedMiniPipelineProgressCommand.cxx Status: Needs
>>Patch
>>
>> Working revision: 1.2
>> Repository revision: 1.3
>>/cvsroot/Insight/Insight/Code/Algorithms/itkWatershedMiniPipelineProgressCommand.cxx,v
>>
>> Sticky Tag: (none)
>> Sticky Date: (none)
>> Sticky Options: (none)
>>
>> Is this a known problem and fixed in cvs already?
>>
>> Thanks a lot.
>>
>>-Feng
>>
>>_________________________________________________________________
>>Try MSN Messenger 6.0 with integrated webcam functionality!
>>http://www . msnmessenger-download . com/tracking/reach_webcam
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk . org
>>http://www . itk . org/mailman/listinfo/insight-users
>>
>
>
>
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk . org
>http://www . itk . org/mailman/listinfo/insight-users
_________________________________________________________________
Get a FREE computer virus scan online from McAfee.
http://clinic . mcafee . com/clinic/ibuy/campaign . asp?cid=3963