[Insight-users] Connect VTK and ITK

Yan Yang y.yang at apu.ac.uk
Thu Mar 31 12:01:40 EST 2005


Dear all,

I got a problem about connecting ITK and VTK. I can successfully convert vtkImageData to itk image data, but I can't convert the registered itk image into vtkImageData format. There is no problem with the input to itk::VTKImageExport, because I can write a png file with caster->GetOutput().
I would be grateful if you could take a look at my code.

Kind regards,

Yan
------------------------------------------------------------------------------------------------------------------
#include "vtkImageExport.h"
#include "vtkImageImport.h"
#include "vtkTransform.h"
#include "itkVTKImageImport.h"
#include "itkVTKImageExport.h"
#include "vtkITKUtility.h"
......

  typedef itk::VTKImageExport< OutputImageType > ImageExportType; 

  ImageExportType::Pointer registeredItkExporter = ImageExportType::New();
  registeredItkExporter->SetInput( caster->GetOutput() );
  
  registeredItkExporter->Update();

  vtkImageImport *registeredVtkImporter = vtkImageImport::New();
  ConnectPipelines(registeredItkExporter, registeredVtkImporter);
  registeredVtkImporter->Update();

  this->RegisteredImage = registeredVtkImporter->GetOutput();
   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050331/aa09a963/attachment.htm


More information about the Insight-users mailing list