Get results from filter in another branch of the pipeline

Hi Everyone,
I’m creating a Paraview case where I have two branched pipelines. In the first, the last filter used is integrate variables, in the latter is the python calculator. I need to use as a variable in the python calculator the result from the integrate filter of the other pipeline, how can be done ? This is a general question as I have other similar problems like rotating the camera by an amount corresponding to the result of an integrate variable filter. So the general question is, how to declare results of filters as variable in Paraview ?
Thank you

RessampleWithDataSet should do the trick.

This is a general question as I have other similar problems like rotating the camera by an amount corresponding to the result of an integrate variable filter.

This is a completely different question and is more complex. I can only be done in python using servermanager.fetch method.

So the general question is, how to declare results of filters as variable in Paraview ?

It depends of what you mean by Variables.

Thanks for your help Mathieu.

I sincerely don’t understand how ResampleWithDataset should get the result from IntegrateVariables. Can you explain some passages please ?

This will work only for scripting I think. Anyhow, thank you.

I mean a user defined quantity that can be called from any part (or at least from any calculator filter ) of any pipeline and has the same value everywhere.

Thank you

The Python Calculator can take multiple inputs. First, select the filter you want to apply the Python Calculator to. Second, Ctrl-click (Cmd-click on macOS) the IntegrateVariables filter. You should have two filters selected in the Pipeline Browser. Now add the Python Calculator.

The Python expression can access the different inputs through the inputs list. inputs[1] should reference the IntegrateVariables filter, and inputs[0] the first filter you clicked. To access a value produced by the IntegrateVariables filter, use an expression like inputs[1].PointData["variablename"][0]. This evaluates to the single result in the array named “variablename” that was associated with points in the input. You can use that result in a Python expression. In case you need it, inputs[1].CellData can be used for integrated cell data. Please see the attached state file from ParaView 5.7.0 for an example. IntegrateCalculatorExample.pvsm (334.2 KB)

1 Like

Thank you for your reply, this is what I was searching for. If it were possible to declare a variable instead of typing multiple times "inputs[1].PointData[“varia…” then it would be wonderful. :grinning:
But again , thank you. This is a feature so needed and not well publicized…

Programmable Filter gives you much more flexibility to define multi-line Python scripts where you can define variables in this way.

Probably this is the best way to do things, thank you.