[Insight-users] help! 1st time to run itk/vtk

Luis Ibanez luis.ibanez@kitware.com
Wed May 19 21:44:11 EDT 2004


Hi Zhong,

The simplest thing to do is to copy those
header files in the directory of your project.

It seems to be too much of a burden to require
the entire InsightApplications checkout only
for using these four files.

However, the advantage of the approach that
you suggest is that eventual updates of these
files will automatically be used in your
project...


If you are just trying to practice the examples
from the tutorial, copying the headers files
from InsigthApplications/Auxiliary/vtk is the
way to go.



   Regards,


      Luis



----------------
Zhong Li wrote:

> Hi,
> 
>  
> 
> Thanks all for your comments and suggestions.
> 
>  
> 
> This is the 1^st time I try the itk/vtk/cmaker with the demo posted on 
> the presentation of itk on the itk.org website show how to make itk/vtk 
> work together.. Attached is the CMakeLists.txt and myProject.cxx
> 
>  
> 
> The CMakeLists.txt is:
> 
> PROJECT(myProject)
> 
>  
> 
> FIND_PACKAGE ( ITK)
> 
> IF ( ITK_FOUND)
> 
>   INCLUDE( ${USE_ITK_FILE} )
> 
> ENDIF( ITK_FOUND)
> 
>  
> 
> FIND_PACKAGE ( VTK)
> 
> IF ( VTK_FOUND)
> 
>   INCLUDE( ${USE_VTK_FILE} )
> 
> ENDIF( VTK_FOUND)
> 
>  
> 
> INCLUDE_DIRECTORIES(${myProject_SOURCE_DIR})
> 
> ADD_EXECUTABLE( myProject myProject.cxx)
> 
> TARGET_LINK_LIBRARIES (  
> 
>   myProject ITKBasicFilters
> 
>   ITKCommon ITKIO vtkRendering
> 
>   vtkGraphics vtkHybrid vtkImaging
> 
>   vtkIO vtkFiltering vtkCommon
> 
> )
> 
>  
> 
> The myProject.cxx is:
> 
> #include "itkImage.h"
> 
> #include "itkImageFileReader.h"
> 
> #include "itkImageToVTKImageFilter.h"
> 
> #include "vtkImageViewer.h"
> 
> #include "vtkRenderWindowInteractor.h"
> 
>  
> 
> int main( intargc, char **argv) {
> 
>             typedef itk::Image<unsigned short,2> ImageType;
> 
>             typedef itk::ImageFileReader<ImageType> ReaderType;
> 
>             typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
> 
>            
> 
>             ReaderType::Pointerreader= ReaderType::New();
> 
>             ConnectorType::Pointerconnector= 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;
> 
> }
> 
>  
> 
> I think the make and build of itk(v1.6) and vtk(v4.2) packages are fine 
> with CMake(v2.0) vc++ 6.0 on my windows2000.
> 
>  
> 
> When I build the project, it gives the error:
> 
> fatal error C1083: Cannot open include file: 
> 'itkImageToVTKImageFilter.h': No such file or directory Error executing 
> cl.exe.
> 
>  
> 
> I find that the itkImageToVTKImageFilter.h is not under the dir of itk 
> package, but in the InsightApplications (which is a separate package 
> outside the itk). So how can I include the itkImageToVTKImageFilter.h? I 
> guess I need to put something like
> 
> FIND_PACKAGE (InsightApplication)
> 
> IF (InsightApplication_FOUND)
> 
>   INCLUDE( ${USE_InsightApplication_FILE})
> 
> ENDIF(InsightApplication_FOUND)
> 
> In the CMakeLists.txt. However I got the CMake error:
> 
> “CMake error: InsightApplication_DIR not set. It must set to the 
> directory containing InsightApplicationConfig.cmake in order to use the 
> InsightApplication.”
> 
> I can’t find any file named “InsightApplicationConfig.cmake” under the 
> insightapplication_build dir. What should I do to make the little demo run?
> 
>  
> 
> Regards
> 
>  
> 
> zhong
> 






More information about the Insight-users mailing list