[Insight-users] problem in Getting Started with ITK+VTK

Luis Ibanez luis.ibanez at kitware.com
Fri, 20 Feb 2004 03:54:13 -0500


Hi Josh,

The files that you need are in

   InsightApplications/Auxiliary/vtk

    itkImageToVTKImageFilter.h
    itkImageToVTKImageFilter.txx
    itkVTKImageToImageFilter.h
    itkVTKImageToImageFilter.txx

Copy these files into the directory
where you are putting the code of
your example.


Regards,


   Luis



-------------
jx x wrote:

> Hello, I meet a problem when I try to run the example
> in "Getting Started II", which is "Getting Started
> with ITK+VTK". 
> 
> I used Cmake to build the project, and when I open
> myProject.dsw and try to build ALL_BUILD, there is a
> error:
> C:\workSP\testPJSOU\myProject.cxx(3): fatal error
> C1083: Cannot open include file:
> 'itkImageToVTKImageFilter.h': No such file or
> directory
> 
> I search the whole ITK_1.6 package, and I can not find
> "itkImageToVTKImageFilter.h". Am I wrong in some
> place? 
> 
> Attachment are firstIVTK.cxx and CmakeLists.txt file.
> BTW, I changed the project name to firstIVTK. 
> 
> Thanks very much!
> 
> Josh    
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail SpamGuard - Read only the mail you want.
> http://antispam.yahoo.com/tools
> 
> 
> ------------------------------------------------------------------------
> 
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "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;
> }
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> # This project is designed to be built outside the Insight source tree.
> # It uses ITK and VTK together 
> PROJECT(firstIVTK)
> 
> # Find ITK.
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
>   MESSAGE(FATAL_ERROR
>           "Cannot build without ITK.  Please set ITK_DIR.")
> ENDIF(ITK_FOUND)
> 
> # Find VTK.
> FIND_PACKAGE(VTK)
> IF(VTK_FOUND)
>   INCLUDE(${VTK_USE_FILE})
> ELSE(VTK_FOUND)
>   MESSAGE(FATAL_ERROR
>           "Cannot build without VTK.  Please set VTK_DIR.")
> ENDIF(VTK_FOUND)
> 
> INCLUDE_DIRECTORIES(${firstIVTK_SOURCE_DIR})   
> 
> ADD_EXECUTABLE(firstIVTK firstIVTK.cxx )
> 
> TARGET_LINK_LIBRARIES(firstIVTK 
>   ITKBasicFilters ITKCommon ITKIO
>   vtkRendering vtkGraphics vtkHybrid
>   vtkImaging vtkIO vtkFiltering vtkCommon)