[Insight-users] how to install the latest ITK 3.2.0 and make it work with VTK5.0.3

Ocean Spring meancity at gmail.com
Thu Aug 23 16:13:27 EDT 2007


Hello All

i just download ITK and want to compile and do some programs with it. i
refer all kinds of starting-up tutorials,
but all those are not up-to-date. i have problems occurred duiring my
compilation process. below i describe what i did and please someone kindly
diagnose my steps.


my OS : Windows XP
my compiler: MSVC 6.0
Cmake is 2.4 patch 7

what i did are

1) unpack the InsightToolkit-3.2.0.zip to my C: drive with folder name
C:\InsightToolkit-3.2.0
2) create a C:\ITK for keep the output files

3) in the Cmake
    source : C:\InsightToolkit-3.2.0
    binary:   C:\ITK
   press configure, it took quite a while, then i noticed in my C:\ITK has a
CMakeError.log, i opened and i saw loads of error messages.

here is a snapshot of the error messages

============

Performing Test VCL_HAS_EXPORT failed with the following output:
--------------------Configuration: cmTryCompileExec - Win32
Debug--------------------

Compiling...

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86

Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

cl /MDd /W3 /GR /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D
"cmTryCompileExec_EXPORTS" /D "_WINDOWS" /D "NOMINMAX" /D "VCL_HAS_EXPORT"
/D "_MBCS" /D CMAKE_INTDIR=\"Debug\" /Fo"Debug/" /Fd"Debug/" /FD /GZ
/Zm1000  /GZ  /TP /c

   "C:\InsightToolkit-
3.2.0\Utilities\vxl\config\cmake\config\vxl_platform_tests.cxx"

vxl_platform_tests.cxx

C:\InsightToolkit-
3.2.0\Utilities\vxl\config\cmake\config\vxl_platform_tests.cxx(25) : error
C2143: syntax error : missing ';' before ''template<''

C:\InsightToolkit-
3.2.0\Utilities\vxl\config\cmake\config\vxl_platform_tests.cxx(25) : error
C2501: 'export' : missing storage-class or type specifiers

Error executing cl.exe.



cmTryCompileExec.exe - 2 error(s), 0 warning(s)
============



4) in the Cmake there are only 4 cache variables:
    BUILD_EXAMPLES                                   OFF
    BUILD_SHARE_LIBRARIES                       OFF
    BUILD_TESTING                                       OFF
    CMAKE_INSTAL_PREFIX                          C:\program files\ITK

i OFFed those variables , b'coz someone in his/her tutorial said it will
speed up the building process. well so be it...

i did check the checkbox to see advance values, but just for observation. i
did not find anything like ITK_USE_VTK, since my primary objective is to use
ITK with VTK.  since i am not quite sure all these variables then i just
leave it as default.


5)press OK, then wait serveral second......

6) find the ITK.dsw in the C:\ITK folder and open it with MS studio 6.0.

7) in the MSVC 6.0 tool tar i clicked "Build" then "Set Active
Configuration" i chose Win32 Release for ALL_BUILD classes

8) then press F7 start to build ITK.  the compilation process took 100% of
my CPU, and it does not seem like what others said just 15 minutes. it took
more than that on my pc(Centrino 1.6Ghz 533FSB)


9)wait and wait.... then it finished.

10) to test whether ITK itself can work properly. copy the
C:\InsightToolkit-3.2.0\Examples\Installation out  and run CMake again
     source C:\somewhere\Installation
     binary  C:\somewhere\Hellobin

everything leave as default. but i wonder what "EXECUTABLE_OUTPUT_PATH" for
??? anyway i leave it blank as it is...
 configure and then ok.

11) go to the C:\somewhere\Hellobin  and find the HelloWorld.dsw. load it in
MSVC and build in release and then in C:\somewhere\Hellobin\release  i
found HelloWorld.exe so i run it .."ITK Hello World !".BINGO!!... so far so
good. it worked fine for this testing program. therefore i assume my
ITK was compiled successfully.



then how to make ITK work with VTK

i take the example from well-known GettingStarted-II.pdf

code
===========

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "C:\Documents and
Settings\panz\Desktop\vitkbin\itkImageToVTKImageFilter.h"
#include "vtkImageViewer.h"
#include "vtkRenderWindowInteractor.h"
int main( int argc, char **argv) {
typedef itk::Image<unsigned short,2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;

ReaderType::Pointer reader= ReaderType::New();
ConnectorType::Pointer connector= ConnectorType::New();

reader->SetFileName(argv[1]);
connector->SetInput(reader->GetOutput());
vtkImageViewer* viewer= vtkImageViewer::New();
vtkRenderWindowInteractor*
renderWindowInteractor=vtkRenderWindowInteractor::New();
viewer->SetupInteractor( renderWindowInteractor);
viewer->SetInput( connector->GetOutput() );
viewer->Render();
viewer->SetColorWindow( 255);
viewer->SetColorLevel( 128);
renderWindowInteractor->Start();
return 0;
}
===========

can not make it work since it can not find itkImageToVTKImageFilter.h
as refer
 " Where to find itkImageToVTKImageFilter.h"
http://public.kitware.com/pipermail/insight-users/2004-July/009669.html

i copied all necessary to project source code folder but still can not i
have to specify the absolute path to itkImageToVTKImageFilter.h.

how can i fix this ?


i did refer some material like

"Howto build itk with vtk4.0 and cmake ? "
http://public.kitware.com/pipermail/insight-users/2002-May/000438.html
but i just find it too much out-dated.

 <http://public.kitware.com/pipermail/insight-users/2004-July/009669.html>

 during this process i did meet project such as
 fatal error LNK1181 "ITKBasicFilters.lib" can not be found... then in the
VC6.0 tooltar   tools/options/directory there, you need to set the included
libraries.

i believe this would help some beginner to start to use latest ITK and VTK.

and ITK guru again, please give me some explanation to the questions i asked
during the process....

and i also want to know...
1)to do some VTK+ITK programming in C++ , to make thing convenient, is CMake
a must?

2) is there any tcl/tk examples in ITK. since i learn VTK by tcl, now i want
to continue exploring ITK with tcl, please give me some suggestions on this.


sorry for this long email.

thank you
Yours
Ocean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070824/edf61866/attachment.htm


More information about the Insight-users mailing list