[vtkusers] How to use vtkProgrammableFilter under python?

Charl P. Botha c.p.botha at its.tudelft.nl
Wed Sep 25 04:42:03 EDT 2002


Hoi Maurice,

I don't know if it'll solve your problem, but I'd like to correct a few
issues in your code.

On Wed, 2002-09-25 at 10:29, Maurice van de Rijzen wrote:
> filter5DTo3D = vtkProgrammableFilter()
> filter5DTo3D.SetInput=sliceVector5D.GetOutput

Ouch... this should be:
filter5DTo3D.SetInput(sliceVector5D.GetOutput())
unless I am _totally_ misunderstanding your context.

> filter5DTo3D.SetExecuteMethod(create3DFrom5D(part5D.GetOutput))

This will evaluate create3DFrom5D when you call SetExecuteMethod, and
you don't want to do that.  You have to make sure that create3DFrom5D
has a suitable prototype (to be a SetExecuteMethod callback) and rather
do:
filter5DTo3D.SetExecuteMethod(create3DFrom5D)
Note the difference.  One can also make use of a lambda construct of
course.

> def create3DFrom5D(matrix5D):
>     matrix3D = Slice5DTo3D()
>     matrix3D.SetSliceIndices(filter5DTo3D.GetOutput)

> I can define  create3DFrom5D before filter5DTo3D = 
> vtkProgrammableFilter() but than I cannot use
> matrix3D.SetSliceIndices(filter5DTo3D.GetOutput).
> How can I solve this.

No idea, you didn't say where matrix3D is defined.


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



More information about the vtkusers mailing list