<div dir="ltr"><div>The data from the slice lives within the server side's context (whether or not you are actually using paraview in client server mode). Insert a python programmable filter and use vtk level python coding inside it to get access to the array.<br><br></div><div>If you don't ever plan to run in client server mode, other options include servermanager.Fetch(), and source.SMProxy.GetClientSideObject()<br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div></div>
<br><div class="gmail_quote">On Thu, Oct 6, 2016 at 9:33 PM, Magnus Elden <span dir="ltr"><<a href="mailto:magnus_elden@hotmail.com" target="_blank">magnus_elden@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="#0563C1" vlink="#954F72" lang="EN-US">
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have a volume and I Slice this volume. This slice, called slice1 is coloured using a ColorTransferFunction and an OpacityTransferFunction. This works well and when I use Show() and Render() it shows up fine.<u></u><u></u></p>
<p class="MsoNormal">Now I want to access these RGBA values so that I can add that colour value to an image I have prepared using the PIL library. The problem is that no matter where I look I am unable to find any access point. No arrays I can access and no
functions I can call. The closest thing I have found is this: array = slice1.GetPointData().<wbr>GetArray(“u150-ref0”). This returns an array according, but I am not able to access it.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">dir(array) shows that there is no __getItem__ function and I couldn’t find any other access method. I went into the source code of the Paraview python modules and I found a function called
<span style="font-family:"Courier New";color:#404040;background:#fcfcfc">paraview.numpy_support.vtk_to_<wbr>numpy</span><span style="font-family:"Courier New";color:black;background:#fcfcfc">(),</span><span style="color:black;background:#fcfcfc"> but this would
not work since the objects I tried feeding it did not have __buffer__ at some level.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:black;background:#fcfcfc"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:black;background:#fcfcfc">Please refer to the source file I have attached for the full code. At the very bottom there is a double for loop, within which I want to do the extraction of the coloured pixels.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:black;background:#fcfcfc">Here is a link to an image showing a single slice rendered:
<a href="http://puu.sh/rAijX/ba71c4b7d9.png" target="_blank">http://puu.sh/rAijX/<wbr>ba71c4b7d9.png</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:black;background:#fcfcfc"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#404040;background:#fcfcfc"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#404040;background:#fcfcfc">Thank you,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#404040;background:#fcfcfc">Magnus Elden</span><u></u><u></u></p>
</div>
</div>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div>