[Insight-users] Problem with compilation of myProject VTK-ITK

Krzysztof J. Rechowicz k.rechowicz at gmail.com
Thu Sep 27 11:29:32 EDT 2012


Hi all,

I am working on setting up ITK (4.2.0) VTK (5.10) for use in a classroom
following the example in the "Getting Started with ITK + VTK" PPT and it
seems that the some of the libraries listed in Cmakelists.txt, e.g.
ITKBasicFilters are no longer present in ver. 4.2 what leads to compiling
errors. Is there some hint which libraries to add to be able to compile
myProject?


Thank you,

Krzysztof Rechowicz

Cmakelists.txt
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)

myProject.cxx:

#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>   FilterType;
  ReaderType::Pointer reader = ReaderType::New();

  FilterType::Pointer connector = FilterType::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;

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120927/b08f4596/attachment.htm>


More information about the Insight-users mailing list