[Insight-users] how to Include itk library in QT Desainer: Use Flat ITK Installation

Luis Ibanez luis.ibanez at kitware.com
Fri Mar 12 14:06:35 EST 2010


Hi  Sutrisno,


When you install ITK, it doesn't install by default all the
header files in a single directory.

Therefore passing only the directory

               /usr/local/include/InsightToolkit

to your linker is not enough.


You need to pass all the subdirectories of that directory as well.

There are two options for making this process easier:



  A) Configure your Eclipse application with CMake,   or
  B) Install ITK using the "Flat" option


Option (A) is self-explanatory, so let me just describe a bit
the process for Option (B):


What you should do is to reconfigure your ITK build with
CMake and turn ON the option:

                 ITK_USE_FLAT_DIRECTORY_INSTALL

Then, do

                                   make install


Once you do this, ITK will install its headers in a smaller set
of subdirectories (still is not a single directory, but at least
they will be a smaller set).

At that point, in your application that uses ITK you MUST add
the -I options for ALL the sub directories that you will see in
the InsightToolkit/include directory.



      Regards,


              Luis


------------------------------------------------------------------------------------------------------
On Thu, Mar 11, 2010 at 2:56 AM, SUTRISNO SUTRISNO
<sutrisno_link at yahoo.com> wrote:
> Hi luis,
> I'm a student of Electrical Eng. ITS Indonesia , my final Project is about
> Medical Image.
> I am new in ITK and I just installed the program and run some itk examples
> with Cmake, it run successfully.
>
> But when I use QT Desainer , and try to uses itk&vtk header: (see in my
> attachment file)
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkGradientMagnitudeImageFilter.h"
>
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkPolyDataMapper.h"
>
> libs path : -L/usr/lib/vtk-5.0 -L/usr/local/lib/InsightToolkit
> includepath : /usr/include/vtk-5.0 /usr/local/include/InsightToolkit
>
> I don't understand why when I run the qmake command the output is that:
>
> sutrisno at sutrisno-pc:~/project-sut/project11$ qmake
> sutrisno at sutrisno-pc:~/project-sut/project11$ make
> /usr/share/qt3/bin/uic form1.ui -o .ui/form1.h
> g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
> -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I.
> -I/usr/include/vtk-5.0 -I/usr/local/include/InsightToolkit
> -I/usr/include/qt3 -I.ui/ -I. -I.moc/ -o .obj/main.o main.cpp
> /usr/share/qt3/bin/uic form1.ui -i form1.h -o .ui/form1.cpp
> g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT
> -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I.
> -I/usr/include/vtk-5.0 -I/usr/local/include/InsightToolkit
> -I/usr/include/qt3 -I.ui/ -I. -I.moc/ -o .obj/form1.o .ui/form1.cpp
> In file included from .ui/form1.cpp:19:
> .ui/../form1.ui.h:1:22: error: itkImage.h: No such file or directory
> .ui/../form1.ui.h:2:32: error: itkImageFileReader.h: No such file or
> directory
> .ui/../form1.ui.h:3:45: error: itkGradientMagnitudeImageFilter.h: No such
> file or directory
> In file included from /usr/include/c++/4.3/backward/strstream:51,
>                  from /usr/include/vtk-5.0/vtkIOStream.h:36,
>                  from /usr/include/vtk-5.0/vtkSystemIncludes.h:40,
>                  from /usr/include/vtk-5.0/vtkIndent.h:24,
>                  from /usr/include/vtk-5.0/vtkObjectBase.h:43,
>                  from /usr/include/vtk-5.0/vtkObject.h:41,
>                  from /usr/include/vtk-5.0/vtkViewport.h:32,
>                  from /usr/include/vtk-5.0/vtkRenderer.h:32,
>                  from .ui/../form1.ui.h:6,
>                  from .ui/form1.cpp:19:
> /usr/include/c++/4.3/backward/backward_warning.h:33:2: warning: #warning
> This file includes at least one deprecated or antiquated header which may be
> removed without further notice at a future date. Please use a non-deprecated
> interface with equivalent functionality instead. For a listing of
> replacement headers and interfaces, consult the file backward_warning.h. To
> disable this warning use -Wno-deprecated.
> In file included from .ui/form1.cpp:16:
> /usr/include/qt3/qimage.h: In member function ‘bool
> QImageTextKeyLang::operator<(const QImageTextKeyLang&) const’:
> /usr/include/qt3/qimage.h:61: warning: suggest parentheses around && within
> ||
> make: *** [.obj/form1.o] Error 1
>
> Best regards,
> Sutrisno
>
>
>
> ________________________________
> Menambah banyak teman sangatlah mudah dan cepat.
> Undang teman dari Hotmail, Gmail ke Yahoo! Messenger sekarang!


More information about the Insight-users mailing list