[Insight-users] itk::VTKImageImport - How to get the ImageType
Luis Ibanez
luis.ibanez at kitware.com
Mon Feb 15 17:14:26 EST 2010
Hi Christian,
You may want to look at the following Insight Journal paper:
"Seamless VTK-ITK pipeline connection for image data handling"
http://www.insight-journal.org/browse/publication/146
http://hdl.handle.net/1926/495
It describes the classes:
vtkKWImage
vtkKWImageIO
Than you will find in the InsightApplication directory:
InsightApplications/Auxiliary/vtk
These classes provide an easy way of converting
vtkImageData to itkImages and back.
Regards
Luis
-----------------------------------------------------------------
On Sat, Feb 13, 2010 at 4:00 PM, Christian Werner
<christian.werner at rwth-aachen.de> wrote:
> Hello!
>
> I am writing a little vtk2itk2vtk converter which should be fully automated.
> I found a header file vtk2itk2vtk.h in the web which connects a
> vtkImageExporter and a itk:VTKImageImporter and the other way round (
> ConnectPipelines(in, out) ), but this does only half the job.
>
> This way, I still have to provide the kind of data when setting up the
> itkImporter:
>
> typedef itk::Image<short,3> InputType;
> typedef itk::VTKImageImport<InputType> ImageImportType;
>
> vtkImageImport* vtkImporter = ImageImportType::New();
>
> That's bad, because I do not know what I get from vtk, it could be any
> combination of 1-3 dimensions, long/int/char/float ...
>
> What I finally want to set up is a pipeline like:
> VTKReader=>ConvertToITK-Filter=>ITKNiftyComplexFilter=>ConvertToVTK=> ...
> that works with all Image types without me having to inform the Importer.
> This is what I did for the exporter which should work fine:
>
> template <typename ITK_ImageData>
> vtkImageData* itk2vtk(ITK_ImageData* itkOutImage)
> {
> vtkImageImport* vtkImporter = vtkImageImport::New();
> typedef itk::VTKImageExport<ITK_ImageData> ImageExportType;
> ImageExportType* itkExporter;
> itkExporter = ImageExportType::New();
> itkExporter->SetInput( itkOutImage->GetOutput() );
> ConnectPipelines( itkExporter, vtkImporter );
> return vtkImporter->GetOutput();
> }
>
> Does anyone have any idea how I could implement the counterpart?
>
>
> Best regards,
> Christian
> _____________________________________
> 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
>
More information about the Insight-users
mailing list