[Insight-users] [Gdcm2] Problem with ITK and GDCM in the same program

edoardo.belletti at alice.it edoardo.belletti at alice.it
Fri May 14 13:18:41 EDT 2010


Hi, thank you very much for your interest.
I can't use the first way because I need to extract SequenceOfUltrasoundRegion from the header dicom, which are tags that I can't extract using the embedded gdcm libraries in itk.
The second way it is not very clear for me. First of all I use Linux and not Windows, and after that I don't know how can I link ITK and GDCM libraries without cmake.

But my problem is that I have a multiple definition of `gdcm::Global::~Global() indeed my output is:
edoardo at edoardo-laptop:~/ITK/Tesi/01_Autocrop/crop/bin$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/edoardo/ITK/Tesi/01_Autocrop/crop/bin
Scanning dependencies of target cropping
[100%] Building CXX object CMakeFiles/cropping.dir/cropping.cxx.o
Linking CXX executable cropping
/usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function `gdcm::Global::Global()':
gdcmGlobal.cxx:(.text+0x0): multiple definition of `gdcm::Global::Global()'
/usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x0): first defined here
/usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function `gdcm::Global::Global()':
gdcmGlobal.cxx:(.text+0x300): multiple definition of `gdcm::Global::Global()'
/usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x80): first defined here
/usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function `gdcm::Global::~Global()':
gdcmGlobal.cxx:(.text+0x600): multiple definition of `gdcm::Global::~Global()'
/usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x100): first defined here
/usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function `gdcm::Global::~Global()':
gdcmGlobal.cxx:(.text+0x694): multiple definition of `gdcm::Global::~Global()'
/usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x14c): first defined here
collect2: ld returned 1 exit status
make[2]: *** [cropping] Errore 1
make[1]: *** [CMakeFiles/cropping.dir/all] Errore 2
make: *** [all] Errore 2

Please I need help because I have to join all my works with this piece of code that use gdcm library.
Thank you very much for interest

Edoardo


-----Messaggio originale-----
Da: Mark Roden [mailto:mmroden at gmail.com]
Inviato: gio 13/05/2010 16.05
A: edoardo.belletti at alice.it
Cc: GDCM-developers
Oggetto: Re: [Gdcm2] Problem with ITK and GDCM in the same program
 
Hi Eduardo,

There are two ways I use to get itk and gdcm to play nice with each other.

One, you can use the embedded gdcm libraries in itk.  I've attached a
class of my own that I use for reading CT image slices.  This class is
an adaptations of the example code in the itk instructions; I wrote
the class because I found myself reading CT images quite a bit.
Hopefully, it'll be helpful to you.

The CMaskLists.txt for including the class is pretty straightforward:

ADD_EXECUTABLE(myproject myproject.cxx CTSeriesReader.h
CTSeriesReader.cpp itkInclude.h)
TARGET_LINK_LIBRARIES(myproject  ITKCommon ITKIO ITKIOReview)

That compiles and works for me.

The other approach is to use the itk flat directory install CMake
option in ITK.  Once you install ITK and gdcm (and it can't be to the
default C:\program files directory on windows 7, as that's now a
protected directory), you can then link to those include directories
from your own project, and build without using cmake.  This approach
is more involved, but allows you to debug into the libraries much more
easily than the CMake version (at least, that's been my experience in
visual studio 2008).  If you don't do a flat install, you'll find
yourself tracing a very large include tree to get everything that's
necessary to just read in a file.

I hope that this helps, and please let me know if you need more,

Mark




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100514/6fc15e3b/attachment.htm>


More information about the Insight-users mailing list