[Insight-users] problem with itkImageToVTKImageFilter.h

Ryma rima.sb4 at gmail.com
Tue Feb 14 09:44:21 EST 2012


Hi David,
I also thought that is not necessary to copy them, but i was obliged to try
all the possibilities.
CMakeLists:
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  ITKBasicFilters ITKCommon ITKIO
vtkRendering  vtkGraphics vtkHybrid vtkImaging vtkIO vtkFiltering vtkCommon)

myProject.cxx file:
#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;
}

Ryma
 

daviddoria wrote:
> 
> On Tue, Feb 14, 2012 at 9:26 AM, Ryma <rima.sb4 at gmail.com> wrote:
>>
>> Now it's ok, i can run my example, i've just copied the following files
>> in my
>> project directory:
>> itkImageToVTKImageFilter.h
>> itkImageToVTKImageFilter.txx
>> itkVTKImageToImageFilter.h
>> itkVTKImageToImageFilter.txx
>> Thank you again itkusers.
>> Ryma
> 
> This should not be necessary. Please post a minimal CMakeLists.txt and
> cpp file that produces the error (when you don't have those files in
> your project directory).
> 
> David
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 
-- 
View this message in context: http://old.nabble.com/problem-with-itkImageToVTKImageFilter.h-tp33309697p33322373.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list