> I think I found an alternative way which seems to work. It uses more
> VTK functionalities (vtkWindowToImageFilter in particular) as follows:
>
>  from libvtkRenderingPython import vtkWindowToImageFilter
>  from libvtkIOPython import vtkTIFFWriter
>
>  view = GetActiveView().GetRenderWindow()
>
>  w2i = vtkWindowToImageFilter()
>  w2i.SetInputBufferTypeToZBuffer ()
>  w2i.SetInput(view)
>  w2i.Update()
>
>  writer = vtkTIFFWriter()
>  writer.SetInputConnection(w2i.GetOutputPort())
>  writer.SetFileName("/scratch/depthmap.tif")
>
>  view.Render()
>  writer.Write()
>
>
This approach looks great to me as it hides much of the tedious bit
fiddling.


> Slight inconveniences are that I actually expected inverse color scheme
> (eg black for far away, white for closeup), but here it is the other
> way round. Also, I cannot write this to a PNG using vtkPNGWriter instead
> of the TIFF writer (error is: PNGWriter only supports unsigned char and
> unsigned short inputs).
> Any suggestions?
>
>
Nothing specific. You could get direct access to the array and do the Z
inversion from python.
Or you could search around for a set of vtk filters that do the flip and
also find a different writer that works directly for your needs. Consider
the nrrd writer, the nrrd library (http://teem.sourceforge.net/nrrd/) can do
array manipulation quite well.


> Thanks again,
>  Marc
>
>
> [email protected] said:
> >> I'ld try this path:
> >> from the python shell get a hold of the current render view proxy
> >> http://www.paraview.org/ParaQ/Doc/Nightly/html/classvtkSMRenderViewPro
> >> xy.html
>
> >> from that get a hold of the vtkRenderWindow http://www.vtk.org/doc/
> >> nightly/html/classvtkRenderWindow.html
>
> >> on that call GetZBufferData
>
> >> David E DeMarle
>
>
> --
>  Dr. Marc Baaden  - Institut de Biologie Physico-Chimique, Paris
>  mailto:[email protected]      -      http://www.baaden.ibpc.fr
>  FAX: +33 15841 5026  -  Tel: +33 15841 5176  ou  +33 609 843217
>
>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to