[vtkusers] how to connect ITK and VTK?

Nicolas DUMONT s991848 at student.ulg.ac.be
Fri Feb 20 11:29:57 EST 2004


Hello users ! 

I'm a student, novice with itk/vtk. I'm trying to connect Itk to Vtk along the lines of 'getting started with vtk+itk , Luis Ibanez - William Schroeder'.
The problem is I cannot find the filter 'ItkImageToVTKImagefilter.h'. 

I saw that It is also possible to do it using 'itkVtkImageExport' at the end of the itk pipeline and 'vtkImageImport' at the beginning of the vtk pipeline. 
But i cant manage to use 'vtkImageImport': I read the doxygen documentation about it but I cant figure out which method to use....

Help ! Does someone have a C++ example ?

Thanks in advance, 
Nicolas Dumont.

I tried to adapt the code found in 'getting started with vtk+itk', here is it: 

*****************************************************************
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkVTKImageExport.h"

#include "vtkImageImport.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkImageViewer.h"

int main (int argc, char **argv) {
 typedef itk::Image<unsigned short,2> ImageType;
 typedef itk::ImageFileReader<ImageType> ReaderType;
 typedef itk::VTKImageExport<ImageType> ConnectorType;

 ReaderType::Pointer reader = ReaderType::New();
 ConnectorType::Pointer connector = ConnectorType::New();

 reader->SetFileName(argv[1]);
 connector->SetInput(reader->GetOutput());

vtkImageImport ?????????????????????;

 vtkImageViewer * viewer = vtkImageViewer::New();

 vtkRenderWindowInteractor * renderWindowInteractor = vtkRenderWindowInteractor::New();

 viewer->SetupInteractor(renderWindowInteractor);
 viewer->SetInput( ???????? );

 viewer->Render();
 viewer->SetColorWindow(255);
 viewer->SetColorLevel(128);
 renderWindowInteractor->Start();

 return 0;
}
**************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040220/8b4a37d8/attachment.htm>


More information about the vtkusers mailing list