[Insight-users] ITK in Paraview Plugin
Luis Ibanez
luis.ibanez at kitware.com
Thu Feb 25 11:12:48 EST 2010
Hi Christian,
Thanks for sharing the good news.
You are doing very interesting work,
it will be really useful to see it described
in a IJ paper, or a paper in "The Source"
newsletter.
---
Regarding LINK_LIBRARIES(): when you
use this CMake command, you add a list of
libraries to the link line of all the targets.
If using LINK_LIBRARIES fixed the problem, then
it might be that there was a target in your project
for which the ITKCommon library was missing.
It will be great to figure this out, because the
command LINK_LIBRARIES was deprecated
in CMake 2.6.4, and the recommended command
to use is TARGET_LINK_LIBRARIES.
...a CMake Guru will be of great help here...
You may want to post the question to the CMake
users list.
Regards,
Luis
------------------------------------------------------------
On Thu, Feb 25, 2010 at 4:57 AM, Christian Werner
<christian.werner at rwth-aachen.de> wrote:
> Luis, you led me to the right direction. Good news, everything works fine!
> By chance I found some cmake related postings where there was some problem
> with the LINK_LIBRARIES variable. I was like "Gee, this variable looks nice!
> It could replace my TARGET_LINK_LIBRARIES which does not work anyway." And
> voila, everything goes. This is what I put into my CMakeList that made
> Paraview execute my cool plugin (a itkFlipImageFilter :)
>
> LINK_LIBRARIES( vtkITKImageBox
> ITKCommon ITKIO ITKBasicFilters
> )
>
> I know, diving a little bit more into CMake would have helped in the first
> place, but you just can't study everything before getting your work done.
>
> What's a bit strange is that the plugin is very big (7MB). I am afraid that
> the vtkITKImageBox (which is about that big), or even some ITK stuff is
> cramped into the filter despite my efforts to link everything dynamically. I
> will try to find a solution to this.
>
>
> Thanks for your help with everything Luis and best regards,
> Christian
>
>
>
>
> Christian Werner wrote:
>>
>> I am afraid I did. My vtkITKImageBox was build as a shared library, too
>> and this was only possible after rebuilding ITK with shared libraries.
>>
>> Somehow, if you put that
>>
>> ADD_PARAVIEW_PLUGIN(SampleImageFilter "1.0"
>> SERVER_MANAGER_XML SampleImageFilter.xml
>> #GUI_RESOURCE_FILES SampleImageFilterGUI.xml
>> SERVER_MANAGER_SOURCES vtkITKSampleImageFilter.cxx
>> )
>>
>> into your CMakeList, the compiler does not really seem to care about which
>> libraries it has to compile against. It makes no difference for the
>> compiling and linking process. I do not even have to mention my
>> vtkITKImageBox library which is clearly needed by my filter.
>>
>> So these libraries oviously have to be available "globally" when paraview
>> runs. I added the ITK library path to the LD_LIBRARY_PATH, which I think is
>> the place where ParaView looks for shared libraries but that did not help.
>>
>> I asked the guys form ParaView too about that. If everything works fine
>> and I have the time I could write a paper about my Paraview-ITK Filtering.
>>
>> Best regards,
>> Christian
>>
>>
>> Luis Ibanez wrote:
>>>
>>> Hi Christian,
>>>
>>>
>>> Did you build ITK as a Shared library ?
>>>
>>>
>>> ---
>>>
>>> BTW: This VERY interesting, you should
>>> consider writing a paper for the Insight Journal :-)
>>>
>>> http://www.insight-journal.org
>>>
>>>
>>> Regards,
>>>
>>>
>>> Luis
>>>
>>>
>>> -------------------------------------------------------
>>> On Wed, Feb 24, 2010 at 1:38 PM, Christian Werner
>>> <christian.werner at rwth-aachen.de> wrote:
>>>
>>>>
>>>> Hello!
>>>>
>>>> I wrote a nice VTK filter that incorporates ITK filters. It works fine
>>>> in a
>>>> VTK-only environment. I was able to compile it as a ParaView plugin but
>>>> when
>>>> I want to use it, I get an error messages which seems to indicate some
>>>> missing ITK library or something:
>>>>
>>>> Attempting to load
>>>> /home/christian/.paraview-plugins/libSampleImageFilter.so
>>>>
>>>>>
>>>>> Failed to load the shared library.
>>>>> /home/christian/.paraview-plugins/libSampleImageFilter.so: undefined
>>>>> symbol:
>>>>> _ZN3itk11LightObject6DeleteEv
>>>>>
>>>>
>>>> I attached my CMakeList.txt. There's no
>>>>
>>>> TARGET_LINK_LIBRARIES(
>>>> ITKCommon ITKIO
>>>> vtkCommon vtkIO
>>>> )
>>>>
>>>> or such in my CMakeList, but that does not seem to be a problem anyway.
>>>> Everthing is compiled and linked just fine.
>>>>
>>>> Anyway, I tried
>>>>
>>>> TARGET_LINK_LIBRARIES( vtkITKImageBox #my library
>>>> ITKBasicFilters
>>>> )
>>>>
>>>> or similar. But that turned into a cmake error:
>>>>
>>>> CMake Error at CMakeLists.txt:16 (TARGET_LINK_LIBRARIES):
>>>> Cannot specify link libraries for target "vtkITKImageBox" which is not
>>>> built by this project.
>>>>
>>>> whereas ommitting one of the above libraries, e.g. writing:
>>>>
>>>> TARGET_LINK_LIBRARIES( vtkITKImageBox
>>>> )
>>>>
>>>> works just fine. On the other hand it seems to be totally unnecessary to
>>>> do
>>>> anything like that, because always everything compiles just fine, as
>>>> long as
>>>> cmake ran succesful. When I compile for VTK-only it won't compile if I
>>>> do
>>>> not add my library that I actually need for this filter...
>>>>
>>>> What do I have do write into my CMakeList??
>>>>
>>>>
>>>> Best regards,
>>>> Christian
>>>>
>>>>
>>>> # create a paraview plugin containing server manager xml and the server
>>>> # manager classes to build
>>>> # this plugin can be loaded on the server side
>>>>
>>>> cmake_minimum_required(VERSION 2.4)
>>>>
>>>> PROJECT(vtkITKSampleImageFilter)
>>>>
>>>> INCLUDE("/home/christian/programming/pv-plugins/conf.cmake")
>>>>
>>>> #find and load ParaView settings
>>>> FIND_PACKAGE(ParaView REQUIRED)
>>>> INCLUDE(${PARAVIEW_USE_FILE})
>>>>
>>>> # Find ITK & VTK
>>>> FIND_PACKAGE(ITK REQUIRED)
>>>> INCLUDE(${ITK_USE_FILE})
>>>>
>>>>
>>>> ADD_PARAVIEW_PLUGIN(SampleImageFilter "1.0"
>>>> SERVER_MANAGER_XML SampleImageFilter.xml
>>>> #GUI_RESOURCE_FILES SampleImageFilterGUI.xml
>>>> SERVER_MANAGER_SOURCES vtkITKSampleImageFilter.cxx
>>>> )
>>>>
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/products/protraining.html
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>>
>>>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list