[Insight-users] connectpipelines in python

Charl P. Botha c.p.botha at ewi.tudelft.nl
05 Apr 2004 18:45:27 +0200


On Mon, 2004-04-05 at 17:31, xujf wrote:
> Hi,Charl P. Botha:
>    with your help,ConnectVTKITK module has been found.thank you very much.
> 
> import sys,os
> import paths
> import InsightToolkit as itk
> from vtkMINCReader  import *
> import ConnectVTKITK as connect
> 
> reader=vtkMINCReader()
> vtkexport=vtkImageExport()
> vtkimport=vtkImageImport()
> 
> vtkexport.SetInput(reader.GetOutput())
> reader.SetFileName("E:/atamai/2003-01-27/atamai/examplesPmw/sbrain.mnc")
> 
> itkimport=itk.itkVTKImageImportF3_New()
> itkexport=itk.itkVTKImageExportF3_New()
> 
> connect.ConnectVTKToITKF3(vtkexport,itkimport)
> 
> I think the function of ConnectVTKToITK() in python is the same as 
> connectpipelines() in c++,so I write my programe as below.
> 
> however another error is found:
> TypeError:Type error.Got _p_itk__SmartPointerTitk__VTKImageImporterTitk__ImageTf
> -loat_3_t_t_t,expected _p_itk__VTKImageImporterTitk__ImageTfloat_3_t_t

Please see the GeodesicActiveContour*.py example that you mentioned
previously.  You have to do:
connect.ConnectVTKToITKF3(vtkexport, itkimport.GetPointer())

Good luck,
Charl

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/