[vtkusers] Problem with configuring ITK with VTK

edoardo.belletti at alice.it edoardo.belletti at alice.it
Wed Mar 10 17:07:08 EST 2010


Hi
I have problem with configuring ITK with VTK I used the example in the slide that I take from www.itk.org :

#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::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;
}



the CMakeLists.txt is:


cmake_minimum_required(VERSION 2.8)
 
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
ITKBasicFiltersITKCommonITKIO
vtkRenderingvtkGraphicsvtkHybrid
vtkImagingvtkIOvtkFilteringvtkCommon
)




but I don't understand why when I run the make command the output is that:




edoardo at edoardo-laptop:~/VTK/vtk-itk/bin$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/edoardo/VTK/vtk-itk/bin
[100%] Building CXX object CMakeFiles/myProject.dir/myProject.cxx.o
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:3:38: error: itkImageToVTKImageFilter.h: Nessun file o directory
/home/edoardo/VTK/vtk-itk/src/myProject.cxx: In function ‘int main(int, char**)’:
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:11: error: expected initializer before ‘<’ token
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:12: error: ‘Pointerreader’ is not a member of ‘main(int, char**)::ReaderType’
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:13: error: ‘ConnectorType’ has not been declared
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:13: error: ‘ConnectorType’ has not been declared
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:14: error: ‘reader’ was not declared in this scope
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:15: error: ‘connector’ was not declared in this scope
make[2]: *** [CMakeFiles/myProject.dir/myProject.cxx.o] Errore 1
make[1]: *** [CMakeFiles/myProject.dir/all] Errore 2
make: *** [all] Errore 2




I have just configuring cmake with set ITK_DIR to the binary directory
where ITKwas built and set VTK_DIR to the binary directory where VTK was built
I don't undersand why it doesn't found the itkImageToVTKImageFilter.h library.

Thank you very much 
Edoardo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100310/6ca5668f/attachment.htm>


More information about the vtkusers mailing list