<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I think I found an alternative way which seems to work. It uses more<br>
VTK functionalities (vtkWindowToImageFilter in particular) as follows:<br>
<br>
from libvtkRenderingPython import vtkWindowToImageFilter<br>
from libvtkIOPython import vtkTIFFWriter<br>
<br>
view = GetActiveView().GetRenderWindow()<br>
<br>
w2i = vtkWindowToImageFilter()<br>
w2i.SetInputBufferTypeToZBuffer ()<br>
w2i.SetInput(view)<br>
w2i.Update()<br>
<br>
writer = vtkTIFFWriter()<br>
writer.SetInputConnection(w2i.GetOutputPort())<br>
writer.SetFileName("/scratch/depthmap.tif")<br>
<br>
view.Render()<br>
writer.Write()<br>
<br></blockquote><div><br>This approach looks great to me as it hides much of the tedious bit fiddling.<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Slight inconveniences are that I actually expected inverse color scheme<br>
(eg black for far away, white for closeup), but here it is the other<br>
way round. Also, I cannot write this to a PNG using vtkPNGWriter instead<br>
of the TIFF writer (error is: PNGWriter only supports unsigned char and<br>
unsigned short inputs).<br>
Any suggestions?<br>
<br></blockquote><div><br>Nothing specific. You could get direct access to the array and do the Z inversion from python.<br>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 (<a href="http://teem.sourceforge.net/nrrd/">http://teem.sourceforge.net/nrrd/</a>) can do array manipulation quite well.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks again,<br>
Marc<br>
<div><div></div><div class="h5"><br>
<br>
<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a> said:<br>
>> I'ld try this path:<br>
>> from the python shell get a hold of the current render view proxy<br>
>> <a href="http://www.paraview.org/ParaQ/Doc/Nightly/html/classvtkSMRenderViewPro" target="_blank">http://www.paraview.org/ParaQ/Doc/Nightly/html/classvtkSMRenderViewPro</a><br>
>> xy.html<br>
<br>
>> from that get a hold of the vtkRenderWindow <a href="http://www.vtk.org/doc/" target="_blank">http://www.vtk.org/doc/</a><br>
>> nightly/html/classvtkRenderWindow.html<br>
<br>
>> on that call GetZBufferData<br>
<br>
>> David E DeMarle<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Dr. Marc Baaden - Institut de Biologie Physico-Chimique, Paris<br>
mailto:<a href="mailto:baaden@smplinux.de">baaden@smplinux.de</a> - <a href="http://www.baaden.ibpc.fr" target="_blank">http://www.baaden.ibpc.fr</a><br>
FAX: +33 15841 5026 - Tel: +33 15841 5176 ou +33 609 843217<br>
<br>
<br>
</font></blockquote></div><br>