[vtkusers] vtkTransformFilter in pipeline using Python

David Doria daviddoria+vtk at gmail.com
Wed Dec 16 09:11:33 EST 2009


On Sat, Dec 12, 2009 at 8:35 AM, Stefan Dietrich
<stef.dietrich.imap at googlemail.com> wrote:
> Hi there,
> I have a question dealing with the affine transformation in Python.
> I use an image from itk which I convert to an vtk image
>
> - itk_vtk_converter = itk.ImageToVTKImageFilter[
> image_type].New()
> - itk_vtk_converter.SetInput( gauss_filterz.GetOutput() )
> - itk_vtk_converter.Update()
>
> and afterwards I set up the transformation
> and the transformation filter.
>
> - import vtk
>
> - trans= vtk.vtkTransform()
> - trans.Translate(100,100,100)
> - trans.PostMultiply()
> - trans.RotateZ(30)
> - trans.Update()
>
> - tfilter = vtk.vtkTransformFilter()
> - tfilter.SetTransform(trans)
> - tfilter.SetInput(itk_vtk_converter.GetOutput())
> - tfilter.Update()
>
> The I tried to give the output of the transformation filter to the volume
> mapper
>
> volume_mapper = vtk.vtkVolumeRayCastMapper()
> volume_mapper.SetInput( tfilter.GetOutput() )
>
> But after execution of the script I get the empty renderer window and the
> error message
>
>
> ERROR: In ..\..\vtk-5.4.2\Filtering\vtkDemandDrivenPipeline.cxx, line 728
> vtkStreamingDemandDrivenPipeline (0D4C0AA0): Input port 0 of algorithm
> vtkVolumeRayCastMapper(0D476A48) has 0 connections but is not optional.
>
> (072A8E20) has 0 connections but is not optional.
>
>
> I think there is somethin wrong with the in- or output to or from the
> transformation filter.
>
> Maybe someone knows what I'm missing out.
>
> Thanks Stefan

Stefan,

Unfortunately I'm not a Python guy, but it sounds like the problem is
with vtkVolumeRayCastMapper, not the transform filter, no? I'd
recommend the following:

1) Make the simplest possible demo involving a transform - that is,
create a simple set of points  ( (0,0,0) and (1,1,1) for example ) and
transform it and check the result. Add this example to the wiki.

2) Make the simplest possible demo involving a vtkVolumeRayCastMapper
(I'm not exactly sure what this does, so you can try to get the
simplest functionality you're looking for). Add this example to the
wiki.

Hopefully in this process you will figure out what is wrong with your real code.

This is yet another example of why we need to beef up the examples!!

Thanks,

David



More information about the vtkusers mailing list