[Insight-users] Building ITK : and using it from your own project.

Luis Ibanez luis.ibanez at kitware.com
Wed Oct 10 09:30:10 EDT 2007


Hi Rashmi,

Thanks for letting us know about the versions you are using.

   It was confusing to see that you have
   a directory named "InsightToolkit-1.2.0"...

---


The best way to get started writing your own projects is to
follow the instructions in the Tutorials:

      http://www.itk.org/HTML/Tutorials.htm

In particular

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

It will guide you step by step on the process of writing your
own examples, and in creating CMakeLists.txt files for them.

You will also find step by step instructions in the ITK Software Guide

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

in Section


If you are trying Examples from the Insight/Examples directory,
what you should do (once you read the Tutorial above and the
section of the Software Guide) is to copy the .cxx example that
you are interested on to a directory outside of ITK, and then
create for it a CMakeLists.txt file.  For example, if you want
to try out the example:

     Insight/Examples/Segmentation/ConfidenceConnected.cxx

you should take the ConfidenceConnected.cxx file, copy it to
a separate directory (for example C:\myITKExamples\Segmentation)
then write a CMakeLists.txt file like:



   PROJECT(RegionGrowingSegmentation)

   FIND_PACKAGE(ITK REQUIRED)
   IF(ITK_FOUND)
     INCLUDE(${ITK_USE_FILE})
   ENDIF(ITK_FOUND)

   ADD_EXECUTABLE(ConfidenceConnected ConfidenceConnected.cxx )
   TARGET_LINK_LIBRARIES(ConfidenceConnected ITKIO ITKCommon)



The CMake command FIND_PACKAGE(ITK..) is the one that will trigger
the search for ITK_DIR when you configure this project using CMake.

Put this CMakeLists.txt file along with the ConfidenceConnected.cxx
file in that separate directory and then configure them using CMake.


Please read the tutorial and the section of the ITK Software Guide
recommended above, and then try setting up one of the ITK examples
outside of the ITK source tree.


    Regards,


       Luis


----------------------
rashmi vaidya wrote:
> Hello Luis,
>  
> I am using ITK 3.4 release and Cmake 2.4,
> Also as you instruct the Hello World Program run succesfully....
> But as i want to configure other example then at the time of cmake 
> configure they are not asking for the ITK_DIR path and so at the time of 
> building the sample the ITK files not found error occurs.. so for that 
> what i have to do........
>  
> Thanks,
> Rashmi
>  
> 
> 
>  
> On 10/9/07, *Luis Ibanez* <luis.ibanez at kitware.com 
> <mailto:luis.ibanez at kitware.com>> wrote:
> 
> 
>     Hi Rashmi,
> 
>     A couple of questions:
> 
>     1) What compiler are you using ?
> 
>     2) What version of CMake are you using ?
> 
>     3) Why are you using ITK 1.2   !?
>        The current release of ITK is 3.4.
> 
> 
> 
>     Please let us know,
> 
> 
>        Thanks
> 
> 
>           Luis
> 
> 
> 
>     ---------------------------
>     rashmi vaidya wrote:
>      >
>      >
>      > Hello,
>      >
>      >
>      > While building ITK,
>      >
>      > I got following errors..
>      >
>      > Error 1 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 2 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 3 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Error 4 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 5 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 6 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
> 
>      >
>      > Error 7 error C2084: function 'long double abs(long double)'
>     already has
>      > a
>      > body 120
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cstdlib.h
>      > Error 8 error C2084: function 'long abs(long)' already has a
>      > body 121 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cstdlib.h
>      > Error 9 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Error 10 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
> 
>      > Error 11 error C2065: 'obj' : undeclared
>      > identifier 715 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Warning 12 warning C4346:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::value_type'
> 
>      > : dependent name is not a type 729 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 13 error C2072:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::insert_unique_noresize'
> 
>      > : initialization of a function 729 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Warning 14 warning C4346:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::value_type'
> 
>      > : dependent name is not a type 752 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 15 error C2072:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::insert_equal_noresize'
> 
>      > : initialization of a function 752 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Warning 16 warning C4346:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::reference'
> 
>      > : dependent name is not a type 756 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 17 error C2143: syntax error : missing ';' before
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::find_or_insert'
>     756 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 18 error C4430: missing type specifier - int assumed. Note: C++
>      > does not support
>      > default-int 756
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
> 
>      >
>      > Error 19 error C2888:
>      > 'hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::reference
>      > reference' : symbol cannot be defined within namespace
>      > 'itk' 756 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      >
>      > Error 20 fatal error C1903: unable to recover from previous error(s);
>      > stopping
>      > compilation 756
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
> 
>      > Error 21 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 22 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Error 23 error C2065: 'obj' : undeclared
>      > identifier 715
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
> 
>      > Warning 24 warning C4346:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::value_type'
>      > : dependent name is not a type 729 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 25 error C2072:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::insert_unique_noresize'
>      > : initialization of a function 729 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Warning 26 warning C4346:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::value_type'
>      > : dependent name is not a type 752 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 27 error C2072:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::insert_equal_noresize'
>      > : initialization of a function 752 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Warning 28 warning C4346:
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::reference'
>      > : dependent name is not a type 756 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 29 error C2143: syntax error : missing ';' before
>      >
>     'itk::hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::find_or_insert'
>     756 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 30 error C4430: missing type specifier - int assumed. Note: C++
>      > does not support
>      > default-int 756
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      >
>      > Error 31 error C2888:
>      > 'hashtable<Value,Key,HashFcn,ExtractKey,EqualKey,Alloc>::reference
>      > reference' : symbol cannot be defined within namespace
>      > 'itk' 756
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
> 
>      >
>      > Error 32 fatal error C1903: unable to recover from previous error(s);
>      > stopping
>      > compilation 756
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\common\itk_hashtable.h
>      > Error 33 error C2177: constant too big 413 C:\InsightToolkit-
>      > 1.2.0\InsightToolkit-1.2.0\Code\Numerics\vxl\vnl\vnl_numeric_limits.h
>      > Error 34 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
> 
>      >
>      > Error 35 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Warning 36 warning C4996: 'strcpy' was declared
>      > deprecated 213 C:\InsightToolkit-
>      > 1.2.0\InsightToolkit-1.2.0\Utilities\DICOMParser\DICOMAppHelper.h
>      > Warning 37 warning C4996: 'strcat' was declared
>      > deprecated 214 C:\InsightToolkit-
>     1.2.0\InsightToolkit-1.2.0\Utilities\DICOMParser\DICOMAppHelper.h
>      >
>      > Error 38 error C2084: function 'long abs(long)' already has a
>      > body 486 C:\Program Files\Microsoft Visual Studio
>     8\VC\include\math.h
>      > Error 39 error C2084: function 'long double abs(long double)' already
>      > has a body 540 C:\Program Files\Microsoft Visual Studio
>      > 8\VC\include\math.h
>      > Error 40 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 41 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 42 error C2177: constant too
>      > big 413
>     C:\InsightToolkit-1.2.0\InsightToolkit-1.2.0\Code\Numerics\vxl\vnl\vnl_numeric_limits.h
>      > Error 43 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 44 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Warning 45 warning C4996: 'strcpy' was declared
>      > deprecated 213
>     C:\InsightToolkit-1.2.0\InsightToolkit-1.2.0\Utilities\DICOMParser\DICOMAppHelper.h
> 
>      > Error 46 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 47 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Warning 48 warning C4996: 'strcat' was declared
>      > deprecated 214
>     C:\InsightToolkit-1.2.0\InsightToolkit-1.2.0\Utilities\DICOMParser\DICOMAppHelper.h
> 
>      > Error 49 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 50 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Error 51 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 52 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Warning 53 warning C4996: 'sprintf' was declared
>      > deprecated 625
>     c:\InsightToolkit-1.2.0\InsightToolkit-1.2.0\Code\IO\itkGiplImageIO.cxx
>      > Error 54 error C2084: function 'double abs(double)' already has a
>      > body 7 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 55 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Error 56 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
> 
>      > Error 57 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 58 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Error 59 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 60 error C2177: constant too big 413 C:\InsightToolkit-
>      > 1.2.0\InsightToolkit-1.2.0\Code\Numerics\vxl\vnl\vnl_numeric_limits.h
>      > Error 61 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      >
>      > Error 62 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>     1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 63 error C2084: function 'long double abs(long double)' already
>      > has a body 120 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cstdlib.h
>      > Error 64 error C2084: function 'long abs(long)' already has a
>      > body 121
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cstdlib.h
>      >
>      > Error 65 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 66 error C2084: function 'float abs(float)' already has a
>      > body 8 c:\insighttoolkit-
>      > 1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Error 67 error C2084: function 'double abs(double)' already has a
>      > body 7
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
> 
>      >
>      > Error 68 error C2084: function 'float abs(float)' already has a
>      > body 8
>     c:\insighttoolkit-1.2.0\insighttoolkit-1.2.0\code\numerics\vxl\vcl\win32\vcl_cmath.h
>      > Warning 69 warning C4996: 'sscanf' was declared
>      > deprecated 214 c:\InsightToolkit-
>      > 1.2.0\InsightToolkit-1.2.0\Code\IO\itkVTKImageIO.cxx
>      > Warning 70 warning C4996: 'sscanf' was declared
>      > deprecated 241
>     c:\InsightToolkit-1.2.0\InsightToolkit-1.2.0\Code\IO\itkVTKImageIO.cxx
>      > Warning 71 warning C4996: 'sscanf' was declared
>      > deprecated 251 c:\InsightToolkit-
>      > 1.2.0\InsightToolkit-1.2.0\Code\IO\itkVTKImageIO.cxx
>      > Warning 72 warning C4996: 'sscanf' was declared
>      > deprecated 264
>     c:\InsightToolkit-1.2.0\InsightToolkit-1.2.0\Code\IO\itkVTKImageIO.cxx
>      >
>      >
>      > Please help,
>      >
>      > Thanks,
>      >
>      > Rashmi
>      >
>      >
>      >
>      >
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      > _______________________________________________
>      > Insight-users mailing list
>      > Insight-users at itk.org <mailto:Insight-users at itk.org>
>      > http://www.itk.org/mailman/listinfo/insight-users
> 
> 


More information about the Insight-users mailing list