[Insight-users] Trouble setting up ITK project

Xiaoxiao Liu xiaoxiao.liu at kitware.com
Fri Feb 22 13:37:01 EST 2013


Hi Nikhil,
Here is an example of building a "hello world" project with ITK:
http://insightsoftwareconsortium.github.com/ITKBarCamp-doc/ITK/HelloWorld/index.html
Looks like you are missing:         *include( ${ITK_USE_FILE} )*
*
*
Highly encourage you to use ITK v4:
http://sourceforge.net/projects/itk/files/itk/4.3/InsightToolkit-4.3.1.tar.gz/download

Hope this helps.
-Xiaoxiao

On Fri, Feb 22, 2013 at 12:55 PM, Nikhil Chandra <nsc2124 at columbia.edu>wrote:

> Hello,
>
> I recently installed ITK v3 on a CentOS 6 machine using ccmake with the
> following options:
>
> BUILD_DOXYGEN                         OFF
> BUILD_EXAMPLES                        ON
> BUILD_SHARED_LIBS                     ON
> BUILD_TESTING                         OFF
> CMAKE_BACKWARDS_COMPATIBILITY         2.0
> CMAKE_BUILD_TYPE                      Release
> CMAKE_INSTALL_PREFIX                  /usr/local
> ITK_USE_KWSTYLE                       OFF
>
> After pressing c + g inside ccmake, I followed this up with sudo make, and
> sudo make install.
>
> I next installed VTK with the following options:
>
> BUILD_EXAMPLES                      ON
> BUILD_SHARED_LIBS                   ON
> BUILD_TESTING                       ON
> CMAKE_BACKWARDS_COMPATIBILITY       2.0
> CMAKE_BUILD_TYPE                    Debug
> CMAKE_INSTALL_PREFIX                /usr/local
> OpenQube_DIR                        OpenQube_DIR_NOTFOUND
> QT_QMAKE_EXECUTABLE                 QT_QMAKE_EXECUTABLE-NOTFOUND
> VTKMY_WRAP_TCL                      ON
> VTK_DATA_ROOT                       VTK_DATA_ROOT-NOTFOUND
> VTK_EXTRA_COMPILER_WARNINGS         OFF
> VTK_LARGE_DATA_ROOT                 VTK_LARGE_DATA_ROOT-NOTFOUND
> VTK_USE_CHARTS                      ON
> VTK_USE_CHEMISTRY                   ON
> VTK_USE_GEOVIS                      ON
> VTK_USE_INFOVIS                     ON
> VTK_USE_N_WAY_ARRAYS                ON
> VTK_USE_PARALLEL                    ON
> VTK_USE_QT                          OFF
> VTK_USE_QTCHARTS                    OFF
> VTK_USE_RENDERING                   ON
> VTK_USE_TEXT_ANALYSIS               OFF
> VTK_USE_VIEWS                       ON
> VTK_WRAP_JAVA                       OFF
> VTK_WRAP_PYTHON                     OFF
> VTK_WRAP_PYTHON_SIP                 OFF
> VTK_WRAP_TCL                        ON
>
> Again, after pressing c + g inside ccmake, I ran sudo make, and sudo make
> install. In retrospect, I probably should have set BUILD_TESTING to OFF and
> CMAKE_BUILD_TYPE to Release, but I don't think that this would have any
> bearing on the problem I am facing currently.
>
> My next action was to create a new C++ project called ITKRegistration1 in
> my home directory, using NetBeans. Here is the code that is currently in
> main.cpp:
>
> #include <cstdlib>
>
> using namespace std;
>
> /*
>  *
>  */
> int main(int argc, char** argv) {
>
>     return 0;
> }
>
> I then tried to create a new Makefile using ccmake, by writing the
> following code in CMakeLists.txt:
>
> cmake_minimum_required(VERSION 2.8)
> project(ITKRegistration1)
> add_executable(ITKRegistration1 main.cpp)
> find_package(ITK)
> if (ITK_FOUND)
>     include_directories(${ITK_INCLUDE_DIRS})
>      target_link_libraries (ITKRegistration1 ${ITK_LIBRARIES})
> endif (ITK_FOUND)
>
> find_package(VTK)
> if (VTK_FOUND)
>     include_directories(${VTK_INCLUDE_DIRS})
>      target_link_libraries (ITKRegistration1 ${VTK_LIBRARIES})
> endif (VTK_FOUND)
>
> After hitting c + g, I tried running make, and I got the following error
> message:
>
> Scanning dependencies of target ITKRegistration1
> [100%] Building CXX object CMakeFiles/ITKRegistration1.dir/main.cpp.o
> Linking CXX executable ITKRegistration1
> /usr/bin/ld: cannot find -lITKAlgorithms
> collect2: ld returned 1 exit status
> make[2]: *** [ITKRegistration1] Error 1
> make[1]: *** [CMakeFiles/ITKRegistration1.dir/all] Error 2
> make: *** [all] Error 2
>
> In terminal, I ran the command: find /usr/local/itk -iname "*.so", and
> there is a file called libITKAlgorithms.so located in /usr/local/itk/bin,
> so I am not sure why this error message is taking place. Have I missed a
> step during the installation of ITK? Is there something wrong with the code
> I wrote for CMakeLists.txt?
>
> Any input would be appreciated, and thanks.
>
> Nikhil Chandra
>
> _____________________________________
> 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.php
>
> 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
>
>


-- 


---------------------------------------------
*Xiaoxiao Liu*, Ph.D.
R & D Engineer
Kitware Inc <http://www.kitware.com/>.
Clifton Park, NY
Phone: (518) 881-4924  or  (518) 371-3971 x124
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130222/8ef1a3d3/attachment.htm>


More information about the Insight-users mailing list