[Insight-users] read image error in Examples

Luis Ibanez luis.ibanez at kitware.com
Sun Nov 22 18:51:24 EST 2009


Hi Xi,

Yes, adding the line

> cmake_minimum_required(VERSION 2.8)

Is necessary when you move the examples out of the ITK
source tree (which is the right thing to do in your case).

When the examples are inside the ITK source tree, this line is not
needed and that's the reason why you don't see this line in any of
the CMakeLists.txt files of the examples.


The lines

> FIND_PACKAGE(ITK REQUIRED)
> INCLUDE(${ITK_USE_FILE})

are also required (as you already discovered).


You will save a lot of time if you actually read the Tutorials:

         http://www.itk.org/ITK/help/tutorials.html

in particular, you must read:

http://www.itk.org/CourseWare/Training/GettingStarted-I.pdf

All these details about the CMakeLists.txt file are
described there.

You will find this instructions in the ITK Software Guide
as well.

   http://www.itk.org/ItkSoftwareGuide.pdf



   Regards,


         Luis


----------------------------------------------------------------
2009/11/22 Xi LIANG <liangxi1986317 at hotmail.com>:
> Dear all,
>
> Im trying to learn to use ITK by running some samples under Centos 5. I run
> a read image code from
>
> Examples/DataRepresentation/Image/
>
> When I configue -> generate, the error suggests me to add the following
> line, then I add it, the command cmake is happy. I found most of examples
> dont include this line.
>
> cmake_minimum_required(VERSION 2.8)
>
> When I run the generated Makefile >make, it gives me the error of the
> follwoing:
> [  6%] Building CXX object CMakeFiles/Image1.dir/Image1.cxx.o
> /home/fsl/ITK/Workspace/test/ReadImage/Image1.cxx:36:22: error: itkImage.h:
> No such file or directory
> /home/fsl/ITK/Workspace/test/ReadImage/Image1.cxx: In function 'int
> main(int, char**)':
> /home/fsl/ITK/Workspace/test/ReadImage/Image1.cxx:51: error: 'itk' has not
> been declared
>
> I assume this is because some package or lib is not included properly, then
> I added the following lines, then >make works fine.
> # Find ITK.
> FIND_PACKAGE(ITK REQUIRED)
> INCLUDE(${ITK_USE_FILE})
>
> I guess I didnt compile or include something property, and I shouldnt need
> to manually add those lines.
>
> --------------------------------
> Xi Liang
>
> 梁茜
> --------------------------------
>> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list