<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7655.8">
<TITLE>Problem with configuring ITK with VTK</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hi<BR>
I have problem with configuring ITK with VTK I used the example in the slide that I take from www.itk.org :<BR>
<BR>
#include &quot;itkImage.h&quot;<BR>
#include &quot;itkImageFileReader.h&quot;<BR>
#include &quot;itkImageToVTKImageFilter.h&quot;<BR>
#include &quot;vtkImageViewer.h&quot;<BR>
#include &quot;vtkRenderWindowInteractor.h&quot;<BR>
<BR>
int main( int argc, char **argv)<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::Image&lt;unsigned short,2&gt; ImageType;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::ImageToVTKImageFilter&lt;ImageType&gt; ConnectorType;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReaderType::Pointerreader= ReaderType::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConnectorType::Pointerconnector= ConnectorType::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader-&gt;SetFileName( argv[1]);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connector-&gt;SetInput( reader-&gt;GetOutput() );<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkImageViewer* viewer= vtkImageViewer::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor* renderWindowInteractor=<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor::New();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetupInteractor( renderWindowInteractor);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetInput( connector-&gt;GetOutput() );<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;Render();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorWindow( 255);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorLevel( 128);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renderWindowInteractor-&gt;Start();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<BR>
}<BR>
<BR>
<BR>
<BR>
the CMakeLists.txt is:<BR>
<BR>
<BR>
cmake_minimum_required(VERSION 2.8)<BR>
<BR>
PROJECT(myProject)<BR>
FIND_PACKAGE ( ITK)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF ( ITK_FOUND)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INCLUDE( ${USE_ITK_FILE} )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF( ITK_FOUND)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FIND_PACKAGE ( VTK)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF ( VTK_FOUND)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INCLUDE( ${USE_VTK_FILE} )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF( VTK_FOUND)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INCLUDE_DIRECTORIES( ${myProject_SOURCE_DIR} )<BR>
<BR>
ADD_EXECUTABLE( myProject myProject.cxx)<BR>
<BR>
TARGET_LINK_LIBRARIES ( myProject<BR>
ITKBasicFiltersITKCommonITKIO<BR>
vtkRenderingvtkGraphicsvtkHybrid<BR>
vtkImagingvtkIOvtkFilteringvtkCommon<BR>
)<BR>
<BR>
<BR>
<BR>
<BR>
but I don't understand why when I run the make command the output is that:<BR>
<BR>
<BR>
<BR>
<BR>
edoardo@edoardo-laptop:~/VTK/vtk-itk/bin$ make<BR>
-- Configuring done<BR>
-- Generating done<BR>
-- Build files have been written to: /home/edoardo/VTK/vtk-itk/bin<BR>
[100%] Building CXX object CMakeFiles/myProject.dir/myProject.cxx.o<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:3:38: error: itkImageToVTKImageFilter.h: Nessun file o directory<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx: In function &#145;int main(int, char**)&#146;:<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:11: error: expected initializer before &#145;&lt;&#146; token<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:12: error: &#145;Pointerreader&#146; is not a member of &#145;main(int, char**)::ReaderType&#146;<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:13: error: &#145;ConnectorType&#146; has not been declared<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:13: error: &#145;ConnectorType&#146; has not been declared<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:14: error: &#145;reader&#146; was not declared in this scope<BR>
/home/edoardo/VTK/vtk-itk/src/myProject.cxx:15: error: &#145;connector&#146; was not declared in this scope<BR>
make[2]: *** [CMakeFiles/myProject.dir/myProject.cxx.o] Errore 1<BR>
make[1]: *** [CMakeFiles/myProject.dir/all] Errore 2<BR>
make: *** [all] Errore 2<BR>
<BR>
<BR>
<BR>
<BR>
I have just configuring cmake with set ITK_DIR to the binary directory<BR>
where ITKwas built and set VTK_DIR to the binary directory where VTK was built<BR>
I don't undersand why it doesn't found the itkImageToVTKImageFilter.h library.<BR>
<BR>
Thank you very much<BR>
Edoardo<BR>
</FONT>
</P>

</BODY>
</HTML>