ITK/Complete Setup: Difference between revisions

From KitwarePublic
< ITK
Jump to navigationJump to search
No edit summary
m (moved Complete Setup to ITK/Complete Setup: Naming convention.)
 
(13 intermediate revisions by 3 users not shown)
Line 7: Line 7:
*make
*make
*cmake
*cmake
*cvs
*libc6-dev


For VTK, install the following packages:
For VTK, install the following packages:
Line 16: Line 18:
*libfltk1.1-dev
*libfltk1.1-dev
*libglu1-mesa-dev
*libglu1-mesa-dev
*fluid


For QT, install the following packages:
For QT, install the following packages:
*q3-apps-dev
*qt3-apps-dev
*qt3-dev-tools
*qt3-dev-tools
*libqt3-i18n
*libqt3-i18n
Line 55: Line 58:
Asssuming you did all this in your home directory, you have the directories Insight, InsightDocuments, InsightApplications, VTK, VTKData, KWWidgets
Asssuming you did all this in your home directory, you have the directories Insight, InsightDocuments, InsightApplications, VTK, VTKData, KWWidgets


==Make and Compile==
==Compiling the sources==
===ITK===
===ITK===
As in the ITK Software Guide:
As in the ITK Software Guide:
Line 64: Line 67:
Hit c to configure, then g if everything went well.  Then type
Hit c to configure, then g if everything went well.  Then type
   make
   make
This will take a while, depending on the speed of your machine.  It took about ~4hrs on a P4-2.8GHz with 2GB RAM.
This will take a while, depending on the speed of your machine.  It took about ~4hrs on a P4-2.8GHz with 2GB RAM. If you want to speed up the compilation, you can set the variables BUILD_TESTING and BUILD_EXAMPLES to OFF.


===VTK===
===VTK===
Line 84: Line 87:


Hit c to configure, then g if everything went well.
Hit c to configure, then g if everything went well.
KWWidgets won't build if the VTK installation it uses doesn't have certain flags set. You need
  VTK_WRAP_TCL=ON
  VTK_USE_TK=ON


==Running the Examples==
==Running the Examples==
Line 102: Line 109:
[[SubsampleVolume-alex.cxx CMakeLists.txt]]
[[SubsampleVolume-alex.cxx CMakeLists.txt]]


==Writing a Simple Program (ITK+FLTK)==
Take a look at some InsightApplications.  Many of them have FLTK-based GUIs.  You will need to use the fluid application in order to design the GUI.
I was able to modify an application in place, and recompile InsightApplications to see the results.  It is not clear to me how to do an out-of-tree build that uses both FLTK and ITK.  It'd be nice to link here to a sample CMakeLists.txt file that does this.


==Writing a Simple Program (VTK)==
==Writing a Simple Program (VTK)==
Read the Examples subdirectory of the VTK distribution.  Start with VTK/Examples/Tutorial/README.txt
Read the Examples subdirectory of the VTK distribution.  Start with VTK/Examples/Tutorial/README.txt
==Writing a Simple Program (ITK+VTK)==
http://www.na-mic.org/Wiki/images/e/ed/Insight-VTK.ppt
http://www.itk.org/Wiki/Itk_FAQ#How_to_combine_ITK_and_VTK_in_my_application
See also InsightApplications/Auxiliary/vtk/
Here's a simple program I wrote which reads in a 3D Image via ITK and uses the itkImageToVTKImageFilter to convert it to a vtkVolume and display it.
[[test.cxx]] [[test.cxx_CMakeLists.txt]]
The programs above use the itkImageToVTKImageFilter to convert an itk::Image to a vtkImage.  There's also a itkMeshTovtkPolyData class (type that into Google).
==Writing a Simple Program (ITK+VTK+KWWidgets)==
I extended the above ITK+VTK example by creating a vtkKWApplication with a vtkKWRenderWidget and assigning my renderer to it.  I also added a widget which allows you to modify the opacity in real-time (vtkKWPiecewiseFunctionEditor).
[[KWHelloWorldExample-alex.cxx]] [[KWHelloWorldExample-alex.cxx_CMakeLists.txt]]
{{CompleteSetup/Template/Footer}}

Latest revision as of 20:06, 10 February 2012

This page will describe setting up the Kitware tools on an Ubuntu (or any Debian, really) workstation. I assume that you have a basic install of Debian/Ubuntu.

Preparing your system

For ITK, install the following packages:

  • gcc
  • g++
  • make
  • cmake
  • cvs
  • libc6-dev

For VTK, install the following packages:

  • tcl8.4-dev
  • tk8.4-dev
  • libgl1-mesa-dev

For FLTK, install the following packages:

  • libfltk1.1-dev
  • libglu1-mesa-dev
  • fluid

For QT, install the following packages:

  • qt3-apps-dev
  • qt3-dev-tools
  • libqt3-i18n

Getting the sources

Do this in your home directory. It will take a long time, depending on your connection speed.

ITK

 cvs -d :pserver:anonymous@www.itk.org:/cvsroot/Insight login

password: insight

 cvs -d :pserver:anonymous@www.itk.org:/cvsroot/Insight co Insight

You can also get the Insight documentation (optional):

 cvs -d :pserver:anonymous@www.itk.org:/cvsroot/Insight co InsightDocuments

A variety of Insight demo applications are available in the InsightApplications module (optional):

 cvs -d :pserver:anonymous@www.itk.org:/cvsroot/Insight co InsightApplications 

VTK

 cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK login

password: vtk

 cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK checkout VTK

For testing purposes you might wish to checkout the CVS VTKData (optional):

 cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTKData login

password: vtk

 cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTKData checkout VTKData

KWWidgets

 cvs -d :pserver:anoncvs@www.kwwidgets.org:/cvsroot/KWWidgets login

password: <just hit return>

 cvs -d :pserver:anoncvs@www.kwwidgets.org:/cvsroot/KWWidgets co KWWidgets

Asssuming you did all this in your home directory, you have the directories Insight, InsightDocuments, InsightApplications, VTK, VTKData, KWWidgets

Compiling the sources

ITK

As in the ITK Software Guide:

 mkdir $HOME/Insight-bin
 cd $HOME/Insight-bin
 ccmake ../Insight

Hit c to configure, then g if everything went well. Then type

 make

This will take a while, depending on the speed of your machine. It took about ~4hrs on a P4-2.8GHz with 2GB RAM. If you want to speed up the compilation, you can set the variables BUILD_TESTING and BUILD_EXAMPLES to OFF.

VTK

 cd $HOME/VTK
 ccmake .

Hit c to configure, then g if everything went well. You will probably have to hit c a number of times, setting variables in between. I set BUILD_EXAMPLES and VTK_WRAP_TCL to ON. When I tried to compile InsightApplications later, it required VTK built with VTK_USE_HYBRID, so set that too.

InsightApplications

 mkdir $HOME/IA-bin
 cd $HOME/IA-bin
 ccmake ../InsightApplications

Hit c to configure, then g if everything went well. I set ITK_DIR to $HOME/Insight-bin, VTK_DIR to $HOME/VTK and USE_FLTK to ON

KWWidgets

 cd $HOME/KWWidgets
 ccmake .

Hit c to configure, then g if everything went well.

KWWidgets won't build if the VTK installation it uses doesn't have certain flags set. You need

 VTK_WRAP_TCL=ON
 VTK_USE_TK=ON

Running the Examples

 $HOME/Insight-bin/bin

will have all of the examples in the ITK Software Guide. They are standalone executables.

 $HOME/KWWidgets/bin 

will have all the examples from KWWidgets. They are standalone executables. KWWidgetsSetupPaths.sh is a useful script that you should run before trying to run any tcl or python code that uses KWWidgets.

 $HOME/VTK/bin

will also have a bunch of executable files. An important one is $HOME/VTK/bin/vtk, use that one to run any examples written in tcl:

 $HOME/VTK/bin/vtk $HOME/VTK/Examples/ImageProcessing/Tcl/Contours2D.tcl

Writing a Simple Program (ITK)

Read the ITK Software Guide. Start with the Hello World example there. All of the code in the ITK Software Guide is in the Examples subdirectory of the InsightToolkit. Most simple command-line programs can be made by slightly modifying one of the examples from the ITK Software Guide. For example, I modified the Examples/Filtering/SubsampleVolume.cxx file to use the WindowedSincInterpolateImageFunction with the Welch window.

SubsampleVolume-alex.cxx SubsampleVolume-alex.cxx CMakeLists.txt

Writing a Simple Program (ITK+FLTK)

Take a look at some InsightApplications. Many of them have FLTK-based GUIs. You will need to use the fluid application in order to design the GUI.

I was able to modify an application in place, and recompile InsightApplications to see the results. It is not clear to me how to do an out-of-tree build that uses both FLTK and ITK. It'd be nice to link here to a sample CMakeLists.txt file that does this.

Writing a Simple Program (VTK)

Read the Examples subdirectory of the VTK distribution. Start with VTK/Examples/Tutorial/README.txt

Writing a Simple Program (ITK+VTK)

http://www.na-mic.org/Wiki/images/e/ed/Insight-VTK.ppt http://www.itk.org/Wiki/Itk_FAQ#How_to_combine_ITK_and_VTK_in_my_application

See also InsightApplications/Auxiliary/vtk/

Here's a simple program I wrote which reads in a 3D Image via ITK and uses the itkImageToVTKImageFilter to convert it to a vtkVolume and display it.

test.cxx test.cxx_CMakeLists.txt

The programs above use the itkImageToVTKImageFilter to convert an itk::Image to a vtkImage. There's also a itkMeshTovtkPolyData class (type that into Google).

Writing a Simple Program (ITK+VTK+KWWidgets)

I extended the above ITK+VTK example by creating a vtkKWApplication with a vtkKWRenderWidget and assigning my renderer to it. I also added a widget which allows you to modify the opacity in real-time (vtkKWPiecewiseFunctionEditor).

KWHelloWorldExample-alex.cxx KWHelloWorldExample-alex.cxx_CMakeLists.txt



Complete Setup: [Welcome | Site Map]