ITK/Using ITK Without CMake: Difference between revisions
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
#include <itkImageFileReader.h> | #include <itkImageFileReader.h> | ||
* In your include path set the path to the file '''itkImageIOFactoryRegisterManager.h''' | * In your include path please make sure to set the path to the file '''itkImageIOFactoryRegisterManager.h''' | ||
itk\Modules\IO\ImageBase\include | itk\Modules\IO\ImageBase\include | ||
The include path should be set to | |||
INCLUDEPATH += itk/Modules/IO/ImageBase/include/ \ | |||
ITK-build-dir/Modules/IO/ImageBase/ \ | |||
itk/Modules/Core/Common/include/ \ | |||
ITK-build-dir/Modules/Core/Common/ \ | |||
itk/Modules/ThirdParty/VNL/src/vxl/vcl \ | |||
ITK-build-dir/Modules/ThirdParty/VNL/src/vxl/vcl \ | |||
itk/Modules/ThirdParty/VNL/src/vxl/core/ \ | |||
ITK-build-dir/Modules/ThirdParty/VNL/src/vxl/core/ \ | |||
ITK-build-dir/Modules/ThirdParty/KWSys/src/ \ | |||
itk/Modules/IO/NIFTI/include \ | |||
itk/Modules/ThirdParty/NIFTI/src/nifti/niftilib \ | |||
itk/Modules/ThirdParty/NIFTI/src/nifti/znzlib \ | |||
ITK-build-dir/Examples/ITKIOFactoryRegistration | |||
and the linker path should be set to | |||
LIBS += -L"ITK-build-dir/lib" | |||
Also the order in which you link the libraries, matters. Here is the order which works: | Also the order in which you link the libraries, matters. Here is the order which works: |
Latest revision as of 14:55, 6 July 2012
It is very very strongly recommended to use ITK via CMake. All of the examples on the wiki provide a CMakeLists.txt file that shows how simple it is to configure a project to use ITK through CMake. However, there are rare instances where a very big project with a complex, existing build system/infrastructure would like to start using ITK. In these cases, it is necessary to much more manually setup the project to use ITK (add include paths, linker paths, link to ITK libraries, etc). This page provides information on how to do this for several different platforms and IDEs.
Using ITK with QT/VS 2010
If you are getting this error while working with ITK - 4.1 and using QT, Visual Studio or other IDE
Could not create IO object for file <filename>.jpg Tried to create one of the following: You probably failed to set a file suffix, or set the suffix to an unsupported type.
Here are the steps by which you can avoid this:
- Build ITK using cmake.
- It happens that the ITK doesn't register the different IOs automatically. In order to register them define this variable (ITK_IO_FACTORY_REGISTER_MANAGER) before you include itkImageFileReader.h file. This will register all the different IOs and then you can use them.
#define ITK_IO_FACTORY_REGISTER_MANAGER #include <itkImageFileReader.h>
- In your include path please make sure to set the path to the file itkImageIOFactoryRegisterManager.h
itk\Modules\IO\ImageBase\include
The include path should be set to
INCLUDEPATH += itk/Modules/IO/ImageBase/include/ \ ITK-build-dir/Modules/IO/ImageBase/ \ itk/Modules/Core/Common/include/ \ ITK-build-dir/Modules/Core/Common/ \ itk/Modules/ThirdParty/VNL/src/vxl/vcl \ ITK-build-dir/Modules/ThirdParty/VNL/src/vxl/vcl \ itk/Modules/ThirdParty/VNL/src/vxl/core/ \ ITK-build-dir/Modules/ThirdParty/VNL/src/vxl/core/ \ ITK-build-dir/Modules/ThirdParty/KWSys/src/ \ itk/Modules/IO/NIFTI/include \ itk/Modules/ThirdParty/NIFTI/src/nifti/niftilib \ itk/Modules/ThirdParty/NIFTI/src/nifti/znzlib \ ITK-build-dir/Examples/ITKIOFactoryRegistration
and the linker path should be set to
LIBS += -L"ITK-build-dir/lib"
Also the order in which you link the libraries, matters. Here is the order which works:
-lITKIOVTK-4.1 \ -lITKIOStimulate-4.1 \ -lITKIOBioRad-4.1 \ -lITKIOLSM-4.1 \ -lITKIOGDCM-4.1 \ -litkgdcmMSFF-4.1 \ -litkgdcmDSED-4.1 \ -litkgdcmDICT-4.1 \ -litkgdcmIOD-4.1 \ -lITKIOHDF5-4.1 \ -lITKIOTransformHDF5-4.1 \ -litkhdf5_cpp-4.1 \ -lITKReview-4.1 \ -lITKDeprecated-4.1 \ -lITKFEM-4.1 \ -lITKIOMeta-4.1 \ -lITKIONIFTI-4.1 \ -lITKIOImageBase-4.1 \ -lITKDICOMParser-4.1 \ -lITKIOGE-4.1 \ -lITKIOBMP-4.1 \ -lITKIOPNG-4.1 \ -lITKIOGIPL-4.1 \ -litkgdcmjpeg12-4.1 \ -litkgdcmjpeg16-4.1 \ -litkgdcmjpeg8-4.1 \ -lITKIOJPEG-4.1 \ -lITKIOTIFF-4.1 \ -lITKSpatialObjects-4.1 \ -lITKMetaIO-4.1 \ -lITKEXPAT-4.1 \ -lITKniftiio-4.1 \ -lITKgiftiio-4.1 \ -lITKznz-4.1 \ -litkgdcmCommon-4.1 \ -litkjpeg-4.1 \ -litkopenjpeg-4.1 \ -litkpng-4.1 \ -litktiff-4.1 \ -litkhdf5-4.1 \ -litkzlib-4.1 \ -lITKIONRRD-4.1 \ -lITKCommon-4.1 \ -lITKNrrdIO-4.1 \ -lITKVNLInstantiation-4.1 \ -litkvnl_algo-4.1 \ -litkv3p_netlib-4.1 \ -litkv3p_lsqr-4.1 \ -litkvnl-4.1 \ -litkvcl-4.1 \ -litksys-4.1 \ -lITKStatistics-4.1 \ -lgdi32 \ -lsnmpapi -lrpcrt4 -lwsock32