[Paraview] ParaViewWeb, vtk filters python description
Alex
tuanha_it0306 at yahoo.com
Tue Jun 26 09:29:24 EDT 2012
Thank Seb,
I'm sorry if I forget one step. But I have always Uncaught TypeError: Object #<Paraview> has no method 'ImageThresholdPFE'
I did as follow:
File ImageThreshold.py
import paraview
paraview.simple.LoadPlugin('/home/.../vtkImageThreshold/bin/libImageThresholdSMPlugin.so',False)
paraview.simple.LoadPlugin('/home/.../vtkImageThreshold/bin/libImageThresholdSMPlugin.so',True)
My JavaScript
$ p = paraview; var reader = p.OpenDataFile('/home/.../myfile.mhd');
$ p.loadPlugins();
$ threshold = p.ImageThresholdPFE({Input:reader, ThresholdRange:[1000,1150]});
$ threshold = p.ImageThreshold();
$ var threshold = p.ImageThresholdPFE({Input:reader, ThresholdRange:[1000,1150]});
All the 3 ways have the same error Uncaught TypeError: Object #<Paraview> has no method 'ImageThreshold'
In fact, I used your advice with
def ImageThreshold(proxy,a,b):
servermanager.ActiveConnection.Modules.filters.ImageThreshold(proxy,ThresholdRange=[a,b])
but each time I called
$ var threshold = p.ImageThreshold([reader],1000,1150);
ParaViewWeb planted and I have to use kill - 9 to escape. Do you have any clue?
Thank you very much Seb
________________________________
From:Sebastien Jourdain <sebastien.jourdain at kitware.com>
To:Alex <tuanha_it0306 at yahoo.com>
Cc:"paraview at paraview.org" <paraview at paraview.org>
Sent:Tuesday, June 26, 2012 2:20 PM
Subject:Re: [Paraview] ParaViewWeb, vtk filters python description
Please read that:
http://www.paraview.org/Wiki/ParaViewWeb_Manta_setting
Then forget Manta and do your own "manta-init.py" file that will only
load your plugin... And that's it... (You can rename the file, just
make sure you keep the consistency.)
Seb
On Mon, Jun 25, 2012 at 6:52 PM, Alex <tuanha_it0306 at yahoo.com> wrote:
> I think that is the problem too (plugin is properly loaded for PWServer).
> But .... which initialization script are you talking about? XML or .py?
>
>
> ________________________________
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> To: Alex <tuanha_it0306 at yahoo.com>
> Cc: "paraview at paraview.org" <paraview at paraview.org>
> Sent: Tuesday, June 26, 2012 12:48 AM
>
> Subject: Re: [Paraview] ParaViewWeb, vtk filters python description
>
> I don't believe the plugin is properly loaded for PWServer... Did you
> write the proper initialization script ?
>
> On Mon, Jun 25, 2012 at 6:36 PM, Alex <tuanha_it0306 at yahoo.com> wrote:
>> In fact,
>> I call directly MyImageThreshold with
>> threshold=paraview.MyImageThreshold({Input:reader, ...}) and I receive
>> Uncaught TypeError : Object #<ParaView> has no method 'MyImageThreshold'
>> when I use threshold = paravie.Threshold(....) (origin threshold of
>> ParaView) then it works. That why I think that we have to use some kind of
>> descriptor?
>>
>> Alex
>>
>> ________________________________
>> From: Alex <tuanha_it0306 at yahoo.com>
>> To: Sebastien Jourdain <sebastien.jourdain at kitware.com>
>> Cc: "paraview at paraview.org" <paraview at paraview.org>
>> Sent: Tuesday, June 26, 2012 12:24 AM
>>
>> Subject: Re: [Paraview] ParaViewWeb, vtk filters python description
>>
>> Thank you Seb,
>> You mean the ParaView plugin at startup? Indeed, I copied the dynamique
>> library .so in /install/lib/paraview-3.14/plugins and the plugin is loaded
>> automatically into ParaView. It is then usable immediately in Python
>> Shell.
>> However, I doubt that I can use the plugin directly in ParaViewWeb
>> without loading it.
>> For exemple, I have a MyImageThresholdSMPlugin.so, also the plugin's
>> name
>> is MyImageThreshold. I called it sucessfully in Python Shell directly with
>> reader2=MyImageThreshold(reader,ThresholdRange=[300,600]); (the values are
>> given for exemple).
>> In ParaViewWeb, can I use it directly by calling var
>> reader2=paraview.MyImageThreshold({Input:reader,
>> ThresholdRange:[300,600]});
>> ?
>> In your previous reply, I have to load a Plugin by LoadPlugin command
>> from simple.py. And then define a function that call the
>> servermanager.Activeconnection.Modules.filters.MyImageThreshold(proxy) I
>> wonder if they are the same thing? That why I ask if we have to write a
>> MyImageThreshold.py so that our plugin is usable in ParaViewWeb.
>>
>> Alex
>>
>> ________________________________
>> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
>> To: Alex <tuanha_it0306 at yahoo.com>
>> Cc: "paraview at paraview.org" <paraview at paraview.org>
>> Sent: Tuesday, June 26, 2012 12:03 AM
>> Subject: Re: [Paraview] ParaViewWeb, vtk filters python description
>>
>> If you managed to load your plugin (the C++ ParaView one) at startup,
>> then you will be able to use your filter as any other filter in
>> ParaViewWeb without using any ParaViewWeb plugin. Otherwise, the
>> python file that you are missing is in fact an XML file that list the
>> properties for each filters and sources inside ParaView.
>>
>> PARAVIEW_src/ParaViewCore/ServerImplementation/resources/filter.xml
>>
>> The labels without space are used as filter name and properties for
>> creating and controlling those filters...
>>
>> Otherwise inside your ParaViewWeb plugin, you can provide a dictionary
>> as argument and just loop through its entry and set them in python.
>>
>> Seb
>>
>> On Mon, Jun 25, 2012 at 5:47 PM, Alex <tuanha_it0306 at yahoo.com> wrote:
>>> Hi seb, thank you for your quick reply.
>>> I found that I can use vtk Filter like Threshold, Clip, etc. in
>>> ParaViewWeb
>>> by enter the arguments like I cited in my email. Like threshold =
>>> paraview.Threshold({Input:proxy,ThresholdRange:[300,600]}).
>>> So I think there are perhaps some files like pwsimple.py that describe
>>> how
>>> can ParaViewWeb can use a Plugin. I search for all the .py file in
>>> ParaView
>>> and I can't find something like that.
>>> I did succeed in doing a ParaViewWeb plugin.
>>> I used your advice to define something as following :
>>> def SimpleImageThreshold(proxy)
>>>
>>> servermanager.Activeconnection.Modules.filter.SimpleImageThreshold(proxy)
>>>
>>> Now if I want my plugin to take ThresholdRange=[300,600] as input like
>>> the
>>> original Threshold of ParaView, is that possible?
>>> If yes, how can we define this?
>>> Thank you very much indeed
>>>
>>>
>>>
>>> ________________________________
>>> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
>>> To: Alex <tuanha_it0306 at yahoo.com>
>>> Cc: "paraview at paraview.org" <paraview at paraview.org>
>>> Sent: Monday, June 25, 2012 11:08 PM
>>> Subject: Re: [Paraview] ParaViewWeb, vtk filters python description
>>>
>>> I'm not sure I understand what you mean by "Where is the python file
>>> which describes the way of using vtk Filters in ParaViewWeb?"
>>>
>>> The one that is imported by default is the pwsimple.py which is an
>>> extension of the simple.py of regular ParaView.
>>>
>>> But having said that, you can't easily mix VTK filter and ParaView
>>> proxy together, unless you just want to do some data processing
>>> without rendering.
>>> But as I remember, you did a ParaView plugin for that, so normally,
>>> once loaded you should be able to use it.
>>>
>>> Did you try to load that plugin at startup with the extra argument of
>>> PWServer ?
>>>
>>> Seb
>>>
>>> On Mon, Jun 25, 2012 at 4:25 PM, Alex <tuanha_it0306 at yahoo.com> wrote:
>>>> Hi everybody,
>>>> Well, I found that using vtk Filter (Threshold, Clip, etc.) is simple
>>>> within ParaViewWeb, we have a list of filters so that we can use the
>>>> filters
>>>> @ http://paraview.org/Wiki/ParaView/Users_Guide/List_of_filters
>>>> We can use "threshold =
>>>> paraview.Threshold({Input:proxy,ThresholdRange:[300,600]})" to applicate
>>>> a
>>>> threshold between 300 and 600 for an image.
>>>> So, my question is : where can I find the python script .py which
>>>> describes the way of using vtk Filters in ParaViewWeb?
>>>>
>>>> If there isn't any file python script like that, how can we define a
>>>> function that take in value as described above? How can we tell the
>>>> ParaViewWeb to take in different type of variable?
>>>> I mean : def ImageThreshold(proxy,ThresholdRange......) or something
>>>> like
>>>> that?
>>>>
>>>> Thank you very much for your reply.
>>>> Good day everybody :)
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120626/5bac43fc/attachment-0001.htm>
More information about the ParaView
mailing list