[Paraview] Write xml for ParaView Plugin
Sebastien Jourdain
sebastien.jourdain at kitware.com
Thu Jun 7 15:59:27 EDT 2012
Hi Tuan,
a ParaView proxy is a wrapper class that allow ParaView to abstract
the real location of the vtkObject that are managed by those proxies.
Even though you are using ParaView as a single process, its design is
to also work on cluster or super computer.
Saying that, a proxy is either a regular proxy which just wrap a
vtkObject using properties, or it can be a sourceProxy. A source proxy
only handle vtkAlgorithm sub-classes which is basically any pipeline
filter from VTK that use OutputPort and Connection. Those sourceProxy
are use to compose the pipeline.
In order to control its vtkObject a proxy use an XML descriptor that
name the concrete vtk class to use and list all the methods that we
want to be exposed into ParaView in order to control that concrete
object.
Those properties are usually use to set some values to the vtkObject
itself. Or eventually query the vtkObject and retrieve those values.
But there is no way to set and get at the same time. This is precisely
why you need to provide the voi (and not you ROI like I wrote) as a
property (unless you are using a SourceProxy and you get it from your
vtkAlgorithm) and get the computation result from another information
property.
If that helps, you can look at that definition and the
vtkPVRayCastPickingHelper.h file.
We set a bunch of property and then we use an information property to
get the result of a computation. Look were we create that
PickingHelper and how we use it...
+ <Proxy name="PickingHelper"
+ class="vtkPVRayCastPickingHelper" processes="dataserver">
+ <Documentation>
+ Proxy used to pick a point of a surface mesh.
+ </Documentation>
+ <DoubleVectorProperty name="PointA"
+ command="SetPointA"
+ number_of_elements="3"
+ default_values="0.0 0.0 0.0">
+ </DoubleVectorProperty>
+ <DoubleVectorProperty name="PointB"
+ command="SetPointB"
+ number_of_elements="3"
+ default_values="0.0 0.0 1.0">
+ </DoubleVectorProperty>
+ <DoubleVectorProperty name="Intersection"
+ command="GetIntersection" information_only="1" number_of_elements="3"
+ default_values="0.0 0.0 0.0">
+ </DoubleVectorProperty>
+ <Property name="Update" command="ComputeIntersection"></Property>
+ <ProxyProperty name="Input"
+ command="SetInput">
+ <Documentation>
+ The input from which the selection is extracted.
+ </Documentation>
+ </ProxyProperty>
+ <ProxyProperty name="Selection"
+ command="SetSelection">
+ <Documentation>
+ The selection that is used to reduced the input.
+ </Documentation>
+ </ProxyProperty>
+ </Proxy>
Hope this help,
Seb
On Thu, Jun 7, 2012 at 3:30 AM, Tuan Ha Tran <tuan-ha.tran at insa-lyon.fr> wrote:
> Hi Seb,
> Thank you for your reply.
> I'm sorry that I don't quite understand your instructions. I'm really new
> to ParaView.
> With my little knowledge in ParaView, I'll try to understand as follow :
> - First, I have to write my .xml file with a tab that have "function"
> declaration? So how to declare these values cause I don't understand the
> exemples in the *.xml file (filters, writers; etc.)
> - And then by the declaration as your instructions about information_only
> yesterday?
>
> Can you be a little more explicit? What is ROI?
>
> Thank you very much for your kindness.
>
>
>
>
> ----- Original Message -----
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> To: Tuan Ha Tran <tuan-ha.tran at insa-lyon.fr>
> Cc: paraview at paraview.org, paraview-developers at paraview.org
> Sent: Thu, 07 Jun 2012 01:28:38 +0200 (CEST)
> Subject: Re: [Paraview] Write xml for ParaView Plugin
>
> You should do that in two step.
>
> On property on your proxy where you set the ROI.
> And one information property where you calculate...
>
> Seb
>
> On Wed, Jun 6, 2012 at 11:17 AM, Tuan Ha Tran wrote:
>> Hi everybody,
>> I'm writing some .xml ServerManager file for a ParaView Plugin.
>> Our class have a function likes this :
>> double calculate(vtkImagedata* voi) that return a double value calculated
>> from the vtkImageData.
>>
>> I loaded the plugin into Paraview. I use the Python Shell and when I call
>> myReturnedValue = MyFilter.calculate(proxy) (proxy is a vtkImageData
>> type),
>> I always have the following error : AttributeError : 'function' object has
>> no attribute 'calculate'
>>
>> I searched in the filters.xml and found something mention about function.
>> I
>> wonder if we can use these descriptions to access to the function (this
>> function is nothing similar to any vtk function, don't override any of
>> them). I think that I have to add something like 'function = calculate' so
>> that the function is recognized in ParaView as well as Python but I can't
>> find any exemple.
>>
>> Do you have any idea? Thank you in advance.
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>
More information about the ParaView
mailing list