[Paraview] Update Slice Filter / Python Equivalent of "Apply"

Berk Geveci berk.geveci at kitware.com
Sun Nov 2 07:22:17 EST 2008


Hi David,

The python code to achieve what you want should look like:

pm        = servermanager.ProxyManager()
mha_slice = pm.GetProxy("sources","mha_slice")
mha_slice.CutFunction[0].Normal = [1, 0, 0]

assuming that mha_slice is a Cut (slice) filter. I found a bug that
causes this to not work. I will fix it. For now, try this:

pm        = servermanager.ProxyManager()
mha_slice = pm.GetProxy("sources","mha_slice")
mha_slice.CutFunction[0].SMProxy.GetProperty("Normal").SetElement(0, 1)
mha_slice.CutFunction[0].SMProxy.GetProperty("Normal").SetElement(0, 0)
mha_slice.CutFunction[0].SMProxy.GetProperty("Normal").SetElement(0, 0)
servermanager.GetRenderView().StillRender()

PS: StillRender() is roughly equivalent to Apply

-berk

On Mon, Oct 27, 2008 at 6:23 PM, David Fuentes <fuentesdt at gmail.com> wrote:
> What is the python script equivalent of the "Apply" button for the
> "slice" filter?
>
>
> I have an image file .mha to which I applied the slice filter.
> I can change the normal direction of the slice from a python script.
>
>  pm        = servermanager.ProxyManager()
>  mha_slice = pm.GetProxy("sources","mha_slice")
>  view1     = pm.GetProxy("views","RenderViewer1")
>  widget    =
> pm.GetProxy("3d_widgets_prototypes","ImplicitPlaneWidgetRepresentation1")
>  widget.Normal =  [ 1 , 0 , 0]
>  view1.StillRender()
>
>
>
> The normal plane is updated, but I can't get the slice filter to cut the
> data and display the approriate slice plane. I'm guessing the "apply" button
> updates the Pipeline ?  so i tried
>
>  UpdatePipeline()
>  UpdatePipelineInformation()
>  Update()
>  UpdateRequired()
>  UpdateSelfAndAllInputs()
>  UpdateVTKObjects()
>
>
> but I cannot get the same behavior as the "apply" button
>
>
> ?
>
>
> thanks,
> df
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list