[Paraview] Question about inheritance in paraview(vtk)

Biao She shebiao at gmail.com
Tue Mar 10 17:54:11 EDT 2009


I have soloved the problem. Thanks for this amazing community and especially
thanks to Mike.

Instead of using:

IF ( ITK_FOUND)
    INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND)

I use:

FIND_PACKAGE(ITK REQUIRED)
INCLUDE_DIRECTORIES(${ITK_INCLUDE_DIRS})
LINK_DIRECTORIES(${ITK_LIBRARY_DIRS})

TARGET_LINK_LIBRARIES (MyReader
  ITKCommon ITKIO ITKAlgorithms
)

to get my expected plugin file.
Other than "TARGET_LINK_LIBRARIES", I also have tried:
SET (PARAVIEW_ADDITIONAL_LIBRARIES
   ${PARAVIEW_ADDITIONAL_LIBRARIES}
   ${ITK_LIBRARIES}
)
There was no error in the compile and link time and I got the expected .so
file. However, when I load this .so file into ParaView as a plugin. I got an
error like this: "undefined symbol: _ZTIN3itk11LightObjectE)". This error
seems suggest that the ITK libraries aren't correctly linked.

I am not familiar with "PARAVIEW_ADDITIONAL_LIBRARIES". And I can't find any
information about "PARAVIEW_ADDITIONAL_LIBRARIES" in ParaViewUse.cmake and
ParaViewConfig.cmake files. Where is this variable defined? Or should I
define it by myself? How this works?

Biao


On Mon, Mar 9, 2009 at 7:05 PM, Mike Jackson <mike.jackson at bluequartz.net>wrote:

> It depends on how you are building your plugin. I use externally built
> libraries all the time. 2 Things to remember here:
>
> 1: Compile time Includes - you will need to make sure that
> include_directories(.. ) are called for each directory that needs to be
> included. The "ITK_USE_FILE" should be setting those includes I believe.
> 2: Link time libraries - you will need a list of all the external libraries
> that also need to be linked to your plugin. If you are creating a new
> reader/writer/filter then that means setting the
>
> SET (PARAVIEW_ADDITIONAL_LIBRARIES
>    ${PARAVIEW_ADDITIONAL_LIBRARIES}
>    ${BOOST_FILESYSTEM_LIBRARY}
>    ${HDF_LIBRARY}
> )
>
> variable like show above.
>
> That should get you started.
>
> Mike
>
>
> Biao She wrote:
>
>> Thanks for your help, Michael Jackson! I am a big fan of you. :-)
>> The problem was in my CMakeLists.txt file. Because I use ITK libraries in
>> my
>> class, I include
>> FIND_PACKAGE(ITK REQUIRED)
>> INCLUDE(${ITK_USE_FILE})
>> in my CMakeList file.
>> After I delete those code in my CMakeList file, everything worked fine.
>> However, if I included those code in the CMakeList file, even if I didn't
>> have anything related to ITK in my .cxx file, I still get the same errors
>> as
>> above mentioned.
>> Did that suggest ParaView Plug-in can't use external libraries (i.e. ITK)?
>> If not, how can I use ITK libraries in a ParaView Plug-in?
>> Thanks.
>>
>> Biao
>>
>>
>> On Mon, Mar 9, 2009 at 2:28 PM, Michael Jackson <
>> mike.jackson at bluequartz.net
>>
>>> wrote:
>>>
>>
>>  Are you including the paths to the DICOMParser and DICOMAppHelper header
>>> files? Can you do a "make VERBOSE=1"  to see the entire compile command?
>>> Maybe it is not getting included properly for some reason.
>>>
>>> _________________________________________________________
>>> Mike Jackson                  mike.jackson at bluequartz.net
>>> BlueQuartz Software                    www.bluequartz.net
>>> Principal Software Engineer                  Dayton, Ohio
>>>
>>>
>>>
>>> On Mar 9, 2009, at 2:47 PM, Biao She wrote:
>>>
>>>  Yes, I have done that in my .cxx file, but it doesn't work...
>>>
>>>> I also found a strange phenomenon. When I include the header files for
>>>> DICOMParser and DICOMAppHelper in the header file of my class, I got an
>>>> error said "it can't find those header files".
>>>>
>>>> I am wondering if this is related to the paraview plug-in CMake file. I
>>>> use the following code in the CMake file to link the paraview (vtk)
>>>> library:
>>>> FIND_PACKAGE(ParaView REQUIRED)
>>>> INCLUDE(${PARAVIEW_USE_FILE})
>>>>
>>>> Maybe this isn't enough to link the DICOMParser and DICOMAppHelper in
>>>> paraview?
>>>> Thanks,
>>>>
>>>> Biao
>>>>
>>>>
>>>>
>>>> On Mon, Mar 9, 2009 at 12:23 PM, Michael Jackson <
>>>> mike.jackson at bluequartz.net> wrote:
>>>> In your .cxx file add #include "vtkDICOMImageReaderVector.h" and the
>>>> other
>>>> classes that are just forward declared in the header file.
>>>>
>>>> _________________________________________________________
>>>> Mike Jackson                  mike.jackson at bluequartz.net
>>>> BlueQuartz Software                    www.bluequartz.net
>>>> Principal Software Engineer                  Dayton, Ohio
>>>>
>>>>
>>>>
>>>>
>>>> On Mar 9, 2009, at 2:17 PM, Biao She wrote:
>>>>
>>>> Hi everyone. This might be a silly question, but I am really confused.
>>>> I am writing a class inherites from vtkDICOMImageReader. In the header
>>>> file of vtkDICOMImageReader class, there are some forward declaration of
>>>> these classes: vtkDICOMImageReaderVector, DICOMParser and
>>>> DICOMAppHelper.
>>>> The definition of these classes are included in the .cxx file. Normally,
>>>> I
>>>> should be able to use the methods in those classes in my class. However,
>>>> I
>>>> found that whenever I want to use something like
>>>> "this->Parser->ClearAllDICOMTagCallbacks()" in my class. The compiler
>>>> gives
>>>> me back an error says that "invalid use of undefined type 'structure
>>>> DICOMParser". In the above, "Parser" is an instance of DICOMParser. The
>>>> same
>>>> situation also happen to DICOMAppHelper and vtkDICOMImageReaderVector.
>>>> Thanks very much for any of your help.
>>>>
>>>> Biao
>>>>
>>>
>
>>>> --
>>>> She, Biao
>>>> Department of Computing Science,
>>>> University of Alberta, Edmonton, Canada
>>>>
>>>


-- 
She, Biao
Department of Computing Science,
University of Alberta, Edmonton, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090310/2c47ceef/attachment.htm>


More information about the ParaView mailing list