Try this:<br><br>input = self.GetInputDataObject(0, 0)<br>inp_copy = input.NewInstance()<br>inp_copy.ShallowCopy(input)<br>inp_copy.UnRegister(None)<br>cutter = vtk.vtkCutter()<br>plane = vtk.vtkPlane()<br>plane.SetOrigin(0,0,0)<br>
plane.SetNormal(0,1,0)<br>cutter.SetCutFunction(plane)<br>cutter.SetInput(inp_copy)<br>cutter.Update()<br>self.GetOutputDataObject(0).ShallowCopy(cutter.GetOutputDataObject(0))<br><br>or even better:<br><br>input = self.GetInputDataObject(0, 0)<br>
origin = self.GetInputDataObject(0, 1).GetPoints().GetPoint(0)<br>
inp_copy = input.NewInstance()<br>inp_copy.ShallowCopy(input)<br>inp_copy.UnRegister(None)<br>cutter = vtk.vtkCutter()<br>plane = vtk.vtkPlane()<br>plane.SetOrigin(origin)<br>plane.SetNormal(0,1,0)<br>cutter.SetCutFunction(plane)<br>
cutter.SetInput(inp_copy)<br>cutter.Update()<br>self.GetOutputDataObject(0).ShallowCopy(cutter.GetOutputDataObject(0))<br><br>-berk<br><br><div class="gmail_quote">On Mon, Feb 22, 2010 at 4:04 AM, Thorsten Hater <span dir="ltr"><<a href="mailto:th@tp1.rub.de">th@tp1.rub.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff">
Here my probably faulty python code:<br>
<br>
<p style="margin: 0px; text-indent: 0px;">slice =
vtk.vtkCutter()</p>
<p style="margin: 0px; text-indent: 0px;">plane =
vtk.vtkPlane()</p>
<p style="margin: 0px; text-indent: 0px;">plane.SetOrigin(0,0,0)</p>
<p style="margin: 0px; text-indent: 0px;">plane.SetNormal(0,1,0)</p>
<p style="margin: 0px; text-indent: 0px;">slice.SetCutFunction(plane)</p>
<p style="margin: 0px; text-indent: 0px;">slice.SetInput(field)</p>
<p style="margin: 0px; text-indent: 0px;">slice.Update()</p>
<p style="margin: 0px; text-indent: 0px;">out.SetFieldData(slice.GetFieldData())<br>
</p>
<p style="margin: 0px; text-indent: 0px;"><br>
The result is an empty Output Window popping up along with an empty
output field.<br>
<br>
</p>
<br>
<br>
Am 20.02.2010 02:08, schrieb Berk Geveci:
<div><div></div><div class="h5"><blockquote type="cite">To make sure that I understand, vtkCutter does not work,
right? Why? Are you trying to extract a cut/slice or a subset with
constant i, j or k from an image data?<br>
<br>
-berk<br>
<br>
<div class="gmail_quote">On Fri, Feb 19, 2010 at 10:12 AM, Thorsten
Hater <span dir="ltr"><<a href="mailto:th@tp1.rub.de" target="_blank">th@tp1.rub.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff">
Thanks for this! But contrary to my earlier optimism it seems not so
easy to <br>
use a slice filter in a programmable filter (I played mostly with the
pvpython<br>
up to this point)<br>
The python vtk module does not export ExtractVOI or ImageSlice filter,<br>
the generic cutter does not work for me.<br>
If I import paraview.simple a new connection pops up and PV itself is
messed up,<br>
so I can't use simple's Slice. Can I work around this behaviour?<br>
<br>
<br>
Am 19.02.2010 01:42, schrieb Berk Geveci:
<div>
<div>
<blockquote type="cite">self.GetInputDataObject(0, n)<br>
<br>
should return the nth input.<br>
<br>
-berk<br>
<br>
<div class="gmail_quote">On Thu, Feb 18, 2010 at 4:45 PM,
Thorsten
Hater <span dir="ltr"><<a href="mailto:th@tp1.rub.de" target="_blank">th@tp1.rub.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Most
of
building blocks I was able to figure out, but how do<br>
I retrieve the second input from the servermanager?<br>
<div><br>
Berk Geveci wrote:<br>
> It is definitely doable with the programmable filter although not
as<br>
> trivial as it would be with a tool like VisTrails. The programmable<br>
> filter can accept multiple inputs. You could use the point from on
of<br>
> its inputs to setup the parameter of an internal slice filter -
which<br>
> requires importing the vtk.graphics module. If you can't figure it<br>
> out, let me know, I'll help.<br>
><br>
> -berk<br>
><br>
> On Wed, Feb 17, 2010 at 10:46 AM, Thorsten Hater <<a href="mailto:th@tp1.rub.de" target="_blank">th@tp1.rub.de</a><br>
</div>
<div>> <mailto:<a href="mailto:th@tp1.rub.de" target="_blank">th@tp1.rub.de</a>>>
wrote:<br>
><br>
> Hello,<br>
><br>
> I have encountered the following problem in a set of
animations:<br>
> There is a moving particle in a field and I want to slice the
field<br>
> at the particle's position (effectively the y-component of the<br>
> position).<br>
> Additionally the slice should move automatically with the
particle<br>
> for making an animation.<br>
> Has anybody done something like this before?<br>
> The programmable filter seems a good point to start, but I need<br>
> at least two inputs for figuring out the offset.<br>
> Thanks in advance for any pointers or help!<br>
><br>
> Cheers,<br>
> Thorsten<br>
><br>
> --<br>
> Thorsten Hater<br>
> Institut fuer Theoretische Physik I<br>
> Ruhr-Universitaet Bochum<br>
</div>
> E-Mail: <a href="mailto:tp1@tp1.rub.de" target="_blank">tp1@tp1.rub.de</a>
<mailto:<a href="mailto:tp1@tp1.rub.de" target="_blank">tp1@tp1.rub.de</a>><br>
<div>> Tel.: 0234/32-23-441<br>
><br>
> _______________________________________________<br>
</div>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div>
<div>><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the ParaView Wiki at:<br>
> <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
><br>
><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</blockquote>
<br>
<br>
</div>
</div>
<pre cols="72"><font color="#888888">--
Thorsten Hater
Institut fuer Theoretische Physik I
Ruhr-Universitaet Bochum
E-Mail: <a href="mailto:tp1@tp1.rub.de" target="_blank">tp1@tp1.rub.de</a></font><div>
Tel.: 0234/32-23-441
</div></pre>
</div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br>
</blockquote>
</div>
<br>
</blockquote>
<br>
<br>
<pre cols="72">--
Thorsten Hater
Institut fuer Theoretische Physik I
Ruhr-Universitaet Bochum
E-Mail: <a href="mailto:tp1@tp1.rub.de" target="_blank">tp1@tp1.rub.de</a>
Tel.: 0234/32-23-441
</pre>
</div></div></div>
</blockquote></div><br>