<div dir="ltr">Hi Mattias,<div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
So you're suggesting to make the active node coordinate part of the internal state of the pure vtk class and access it as a proxy property from the client side with the information_only flag enabled?<br>
</blockquote><div><br></div><div style>Yes</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
At what point will this property be updated? I rather thought this will be done in one of the GetActiveNodeCoord variants, something like<br>
<br>
double* vtkMyDataHandler::<u></u>GetActiveNodeCoord() {<br>
return m_data->GetPoint(m_nodeId);<br>
}<br></blockquote><div><br></div><div style>This could but since you seems to have the 'wrong' api to be wrapped, then just do something that works.</div><div style><br></div><div style>You can have a method that has no argument that trigger the computation. Like the one here.</div>
<div style><br></div><div style><div><Property command="ComputeIntersection" name="Update"></Property></div></div><div style><br></div><div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
This of course assumes that the input and node id property have been set properly by the client. Obviously, I am still missing part of the design here?!<br></blockquote><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
As for the wrapping I get even more confused. Is it really true that the header files/class defintions are specifically parsed for the appearance of the vtkSet/Get*Macros? At least I obtain different results when I use vtkGetVector3Macro and a manual expansion of the macro with exactly the same definitions. In all cases only one of the get methods are wrapped.<br>
</blockquote><div><br></div><div style>That's possible and if you implement your way the wrapped one, that should also work.</div><div style><br><div class="im"><br>
<br>
<br>
On 05/08/2013 04:33 PM, Sebastien Jourdain wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hi Matthias,<br>
<br><div class="im">
you should use the following set of macro inside your vtkObject<br>
<br>
public:<br>
vtkSetVector3Macro(<u></u>ActiveNodeCoord, double);<br>
vtkGetVector3Macro(<u></u>ActiveNodeCoord, double);<br>
<br>
protected:<br>
double ActiveNodeCoord[2];<br>
<br>
This should solve your wrapping issue.<br>
<br>
<br>
On Wed, May 8, 2013 at 9:39 AM, Matthias Schneider<br></div><div><div class="h5">
<<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.ethz.ch</a> <mailto:<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.<u></u>ethz.ch</a>>> wrote:<br>
<br>
Hi,<br>
<br>
Thanks for the useful hints. I have implemented the vtk class to<br>
interact with the vtk data object on the server side and use a proxy<br>
to interact with it from the client side as suggested by Sebastien -<br>
thanks! However, I'm still struggling with the proper xml definition<br>
for the proxy. Also there seems to be an issue with the<br>
Client/Server wrapper (see below).<br>
<br>
The pure vtk class has the interface:<br>
<br>
class vtkMyDataHandler: public vtkObject {<br>
public:<br>
[...]<br>
void SetInput(vtkAlgorithm* src);<br>
void SetActiveNode(vtkIdType id);<br>
<br>
double* GetActiveNodeCoord();<br>
void GetActiveNodeCoord(double coord[3]);<br>
[...]<br>
private:<br>
[...]<br>
vtkPolyData* m_data;<br>
vtkIdType m_nodeId;<br>
};<br>
<br>
The Set* methods are used to define a vtkAlgorithm with a<br>
vtkPolyData output and a particular node/vertex id within the<br>
vtkPolyData. Eventually, the handler is supposed to return the node<br>
coordinates (x,y,z) of the selected vertex within the data set.<br>
<br>
The xml descriptor for the class looks like this:<br>
<br>
<ServerManagerConfiguration><br>
<ProxyGroup name="utility"><br>
<Proxy name="MyProxy" class="vtkMyDataHandler" label="Data Handler"><br>
<ProxyProperty name="Input"<br>
command="SetInput" /><br>
<br>
<IdTypeVectorProperty name="ActiveNode"<br>
command="SetActiveNode"<br>
default_values="-1"<br>
number_of_elements="1" /><br>
<br>
<DoubleVectorProperty command="GetActiveNodeCoord"<br>
<br>
default_values="0.0 0.0 0.0"<br>
information_only="1"<br>
name="ActiveNodeCoord"<br>
number_of_elements="3" /><br>
</Proxy><br>
</ProxyGroup><br>
</ServerManagerConfiguration><br>
<br>
On the client side I do the following:<br>
<br>
// set up proxy on the client side<br>
<br></div></div>
vtkSMProxyManager *pxm = vtkSMProxyManager::__<u></u>GetProxyManager();<div class="im"><br>
vtkSMProxy *proxy = pxm->NewProxy("utility", "MyProxy");<br>
<br>
// set internal state of proxy<br></div>
vtkSMPropertyHelper(proxy,"__<u></u>Input").Set(properInputProxy);<br>
vtkSMPropertyHelper(proxy,"__<u></u>ActiveNode").Set(1);<div class="im"><br>
proxy->UpdateVTKObjects();<br>
<br>
// obtain information from proxy<br></div>
proxy->UpdateProperty("__<u></u>ActiveNodeCoord")<div class="im"><br>
double tmp[3] = { -1.0, -1.0, -1.0 };<br>
vtkSMPropertyHelper(proxy, "ActiveNodeCoord").Get(tmp, 3);<br>
<br>
<br>
Setting up the proxy and its initial state works perfectly fine.<br>
However, I am not able to update the desired property and invoke the<br></div>
call of vtkMyDataHandler::__<u></u>GetActiveNodeCoord.<div class="im"><br>
<br>
There are two issues that I came accross here.<br>
<br>
1) There seems to be a problem (?) with the Client/Server wrapper.<br>
For some reason the method without any argument<br>
<br>
double* GetActiveNodeCoord();<br>
<br></div>
does not get wrapped in vtkMyDataHandlerClientServer._<u></u>_cxx<div class="im"><br>
This leads to an error if I change the update command to:<br>
<br></div>
proxy->__<u></u>UpdatePropertyInformation(__<u></u>proxy->GetProperty("__<u></u>ActiveNodeCoord"));<br>
<br>
ERROR:<br>
In[...]/ParaView-3.98.1-__<u></u>source/ParaViewCore/__<u></u>ServerImplementation/Core/__<u></u>vtkPVSessionCore.cxx,<div class="im"><br>
line 389<br>
vtkPVSessionCore (0x2aa9de0): Object type: vtkMyDataHandler, could<br>
not find requested method: "GetActiveNodeCoord"<br>
or the method was called with incorrect arguments.<br>
<br>
while processing<br>
Message 0 = Invoke<br>
Argument 0 = vtk_object_pointer {vtkMyDataHandler (0x29cc970)}<br>
Argument 1 = string_value {GetActiveNodeCoord}<br>
<br>
2) With the update command used in the code snippet, the property<br>
values are set to the default values but the data handler function<br>
(GetActiveNodeCoord) doesn't get called as information only<br>
properties cannot be updated according to vtkSMProxy::UpdateProperty.<br>
<br>
So maybe I have a wrong understanding of information only<br>
properties?! I had a look at some of the xml examples in utilities.xml<br></div>
(ParaView-3.98.1-source/__<u></u>ParaViewCore/ServerManager/__<u></u>SMApplication/Resources/__<u></u>utilities.xml)<div><div class="h5"><br>
and it seemed to me like this is the way to go?!<br>
<br>
Removing the information_only tag from the xml property descriptor,<br>
the property obviously gets updated in proxy->UpdateVTKObjects(),<br>
which for obvious reasons results in an error as there is no method<br>
to *set* the node coordinates.<br>
<br>
So what am I missing here? I would be really happy about any kind of<br>
comments or hints how to do this.<br>
<br>
Best,<br>
Matthias<br>
<br>
<br>
<br>
On 04/05/2013 03:25 PM, Sebastien Jourdain wrote:<br>
<br>
Hi Matthias,<br>
<br>
However, getting access to the vtkPolyData object on the<br>
server will not be possible that easily I guess.<br>
<br>
<br>
From the client side, not really unless you know that you will<br>
only run<br>
in a built-in session.<br>
That's precisely why you need to create a pure VTK class that<br>
will be<br>
connected in some way to that object from the client side via proxy<br>
while the real connection will happen on the server side.<br>
<br>
I guess there is some kind of vtk algorithm required on the<br>
server side<br>
<br>
to do the processing which is configured from the client via a<br>
proxy.<br>
<br>
Yes, although it doesn't need to be an algorithm if it is not a<br>
'filter'<br>
type of object.<br>
But for instance you can create a VTK class that will provide an API<br>
like that:<br>
<br></div></div>
SetMyVtkObjectToLookInto(__<u></u>vtkObject* whatYouWant)<div class="im"><br>
SetActiveNodeId(int id)<br>
double* GetNewCenterOfRotation()<br>
<br>
And on the client side thanks to proxy (You will need to write a<br>
small<br>
XML file for your VTK class) you will have to write something<br>
like that.<br>
<br></div>
myProxy = pxm.NewProxy('utility','__<u></u>mySuperProxy');<br>
vtkSMPropertyHelper(myProxy, 'ProxyPropName').Set(<br>
yourProxyThatYouSelectedFromTh<u></u>__eUI );<div class="im"><br>
vtkSMPropertyHelper(myProxy, 'ActiveNode').Set( yourSelectedID );<br>
myProxy->UpdateVTKObjects(); // This will push the changes to<br>
the server<br>
<br>
// Now it's time to retreive the info from the server<br></div>
myProxy->__<u></u>UpdateInformationProperty('__<u></u>CenterOfRotation');<br>
vtkSMPropertyHelper(myProxy, 'CenterOfRotation').Get(<br>
localArrayToFillWithCenterOfRo<u></u>__tation );<div class="im"><br>
<br>
Hope this give you a feeling on how the things works...<br>
<br>
Seb<br>
<br>
PS: I just wrote things from the top of my head, so names might not<br>
exactly match but the idea is there.<br>
<br>
<br>
<br>
On Fri, Apr 5, 2013 at 8:48 AM, Matthias Schneider<br>
<<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.ethz.ch</a><br>
<mailto:<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.<u></u>ethz.ch</a>><br></div><div class="im">
<mailto:<a href="mailto:schneider@vision.ee." target="_blank">schneider@vision.ee.</a>__<a href="http://ethz.ch" target="_blank"><u></u>ethz.ch</a><br>
<mailto:<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.<u></u>ethz.ch</a>>>> wrote:<br>
<br></div><div><div class="h5">
Hi Sebastian!<br>
<br>
Thank you very much for you quick answer!<br>
I don't have any server side class yet.<br>
<br>
I used the DockWidget example to setup a GUI (QDockWidget)<br>
along<br>
with some simple elements:<br>
pqOutputPortComboBox: define source<br>
QSpinBox: define node id<br>
QPushButton: trigger event<br>
<br>
As I understand it the whole GUI processing takes place at the<br>
client side and has access to the server data via proxies only.<br>
<br>
To stick with my simple example, I'd need a way to actually<br>
access<br>
the server source, which is a vtkPolyData in my case<br>
(originating<br>
from an exported graph, i.e., nodes connected by lines).<br>
<br>
// Get source from pqOutputPortComboBox<br>
[...]<br>
vtkSMSourceProxy *source = ...<br>
<br>
// obtain requested node id from GUI element<br>
vtkIdType nodeId = [...]<br>
<br>
// If we had access to the vtkPolyData itself, we could do<br>
sth like...<br>
vtkPolyData *data = ...<br>
double coord[3];<br></div></div>
data->GetPoints()->GetPoint(__<u></u>__nodeId, coord);<div><div class="h5"><br>
<br>
<br>
// Set rotation center of current view to coord and render view<br>
[...]<br>
<br>
However, getting access to the vtkPolyData object on the<br>
server will<br>
not be possible that easily I guess. I guess there is some<br>
kind of<br>
vtk algorithm required on the server side to do the<br>
processing which<br>
is configured from the client via a proxy (set the desired<br>
source<br>
and the node id). But as I said, I do not fully understand the<br>
ServerManager concept here and couldn't find any similar<br>
examples.<br>
<br>
Hope this helps to clarify my problem...<br>
<br>
Thanks for your help,<br>
Matthias<br>
<br>
<br>
<br>
On 04/05/2013 01:47 PM, Sebastien Jourdain wrote:<br>
<br>
Hi Matthias,<br>
<br>
I guess, you already have your vtk class that will do the<br>
processing on<br>
the server side ?<br>
If so what are the methods that you want to get called<br>
and with what<br>
arguments ?<br>
<br>
Then once, I know more about your special use case, I<br>
can dive<br>
into the<br>
server manager part properly...<br>
<br>
Seb<br>
<br>
<br>
On Fri, Apr 5, 2013 at 7:16 AM, Matthias Schneider<br>
<<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.ethz.ch</a><br>
<mailto:<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.<u></u>ethz.ch</a>><br>
<mailto:<a href="mailto:schneider@vision.ee." target="_blank">schneider@vision.ee.</a>__<a href="http://ethz.ch" target="_blank"><u></u>ethz.ch</a><br>
<mailto:<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.<u></u>ethz.ch</a>>><br></div></div>
<mailto:<a href="mailto:schneider@vision.ee" target="_blank">schneider@vision.ee</a>.<br>
<mailto:<a href="mailto:schneider@vision.ee" target="_blank">schneider@vision.ee</a>.>_<u></u>___<a href="http://ethz.ch" target="_blank">ethz.ch</a> <<a href="http://ethz.ch" target="_blank">http://ethz.ch</a>><div>
<div class="h5"><br>
<br>
<mailto:<a href="mailto:schneider@vision.ee." target="_blank">schneider@vision.ee.</a>__<a href="http://ethz.ch" target="_blank"><u></u>ethz.ch</a><br>
<mailto:<a href="mailto:schneider@vision.ee.ethz.ch" target="_blank">schneider@vision.ee.<u></u>ethz.ch</a>>>>> wrote:<br>
<br>
Hi,<br>
<br>
I'm trying to implement an extension for Paraview<br>
but I'm<br>
somewhat<br>
stuck with the client/server and ServerManager<br>
concepts used in<br>
Paraview. Maybe someone could give a hint where to<br>
find<br>
some more<br>
information on that. I was looking at the plugin<br>
examples<br>
but that<br>
didn't help me too much.<br>
<br>
What I do not understand is how to establish some<br>
kind of data<br>
transfer between the server and the client. A very<br>
simple<br>
example<br>
that I was trying to implement is as follows: For a<br>
vtkPolyDataSet<br>
source define a point id via a GUI element and set<br>
the rotation<br>
center of the active view to the coordinate of<br>
this point.<br>
<br>
Based on the DockWidget example and the<br>
SelectionInspector<br>
I was<br>
able to create the GUI elements on the client side<br>
to select an<br>
appropriate source on the server side and get<br>
access to the<br>
active<br>
view. What I do not understand is how to interact<br>
with the<br>
actual<br>
data of the source to read the spatial coordinates<br>
of the<br>
user-defined vertex.<br>
<br>
On the client side I use a pqOutputPortComboBox to<br>
select<br>
the source<br>
which gives access to the current<br>
pqOutputPort/pqPipelineSource.<br>
>From this I get a<br></div></div>
vtkSMSourceProxy/______<u></u>vtkPVDataInformation which<div class="im"><br>
<br>
<br>
allows me to read basic information of the data as<br>
shown in<br>
Paraview's statistics inspector (no. of cells/points,<br>
memory size,<br>
bounds, ...).<br>
<br>
Can anybody give me a hint how to do this<br>
properly? Any help is<br>
appreciated very much.<br>
<br>
Thanks,<br>
Matthias<br>
<br></div>
______________________________<u></u>_______________________<br>
Paraview-developers mailing list<br>
Paraview-developers@paraview._<u></u>_____org<br>
<mailto:<a href="mailto:Paraview-developers@" target="_blank">Paraview-developers@</a><br>
<mailto:<a href="mailto:Paraview-developers@" target="_blank">Paraview-developers@</a>>_<u></u>___<a href="http://paraview.org" target="_blank">paraview.org</a> <<a href="http://paraview.org" target="_blank">http://paraview.org</a>><br>
<mailto:<a href="mailto:Paraview-developers@" target="_blank">Paraview-developers@</a>__<a href="http://paraview.org" target="_blank"><u></u>paraview.org</a><br>
<mailto:<a href="mailto:Paraview-developers@paraview.org" target="_blank">Paraview-developers@<u></u>paraview.org</a>>>><br>
<a href="http://public.kitware.com/______mailman/listinfo/paraview-______developers" target="_blank">http://public.kitware.com/____<u></u>__mailman/listinfo/paraview-__<u></u>____developers</a><br>
<<a href="http://public.kitware.com/____mailman/listinfo/paraview-____developers" target="_blank">http://public.kitware.com/___<u></u>_mailman/listinfo/paraview-___<u></u>_developers</a>><div class="im"><br>
<br>
<<a href="http://public.kitware.com/____mailman/listinfo/paraview-____developers" target="_blank">http://public.kitware.com/___<u></u>_mailman/listinfo/paraview-___<u></u>_developers</a><br>
<<a href="http://public.kitware.com/__mailman/listinfo/paraview-__developers" target="_blank">http://public.kitware.com/__<u></u>mailman/listinfo/paraview-__<u></u>developers</a>>><br>
<br>
<br>
<br>
<<a href="http://public.kitware.com/____mailman/listinfo/paraview-____developers" target="_blank">http://public.kitware.com/___<u></u>_mailman/listinfo/paraview-___<u></u>_developers</a><br>
<<a href="http://public.kitware.com/__mailman/listinfo/paraview-__developers" target="_blank">http://public.kitware.com/__<u></u>mailman/listinfo/paraview-__<u></u>developers</a>><br>
<br>
<<a href="http://public.kitware.com/__mailman/listinfo/paraview-__developers" target="_blank">http://public.kitware.com/__<u></u>mailman/listinfo/paraview-__<u></u>developers</a><br>
<<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" target="_blank">http://public.kitware.com/<u></u>mailman/listinfo/paraview-<u></u>developers</a>>>><br>
<br>
<br>
<br>
--<br>
Matthias Schneider<br>
Computer Vision Laboratory<br>
<br>
ETH Zürich, ETF D114.1<br>
Sternwartstrasse 7<br>
8092 Zürich, Switzerland<br>
<br>
fon: <a href="tel:%2B41%2044%2063%2020379" value="+41446320379" target="_blank">+41 44 63 20379</a> <tel:%2B41%2044%2063%2020379><br>
<tel:%2B41%2044%2063%2020379><br>
fax: <a href="tel:%2B41%2044%2063%2021199" value="+41446321199" target="_blank">+41 44 63 21199</a> <tel:%2B41%2044%2063%2021199><br></div>
<tel:%2B41%2044%2063%2021199><br>
<a href="http://www.vision.ee.ethz.ch/~____schneima/" target="_blank">www.vision.ee.ethz.ch/~____<u></u>schneima/</a><br>
<<a href="http://www.vision.ee.ethz.ch/~__schneima/" target="_blank">http://www.vision.ee.ethz.ch/<u></u>~__schneima/</a>><br>
<<a href="http://www.vision.ee.ethz.ch/__~schneima/" target="_blank">http://www.vision.ee.ethz.ch/<u></u>__~schneima/</a><br>
<<a href="http://www.vision.ee.ethz.ch/~schneima/" target="_blank">http://www.vision.ee.ethz.ch/<u></u>~schneima/</a>>><br>
<br>
<br>
</blockquote><div class="im">
<br>
-- <br>
Matthias Schneider<br>
Computer Vision Laboratory<br>
<br>
ETH Zürich, ETF D114.1<br>
Sternwartstrasse 7<br>
8092 Zürich, Switzerland<br>
<br>
fon: <a href="tel:%2B41%2044%2063%2020379" value="+41446320379" target="_blank">+41 44 63 20379</a><br></div><div class="im">
fax: <a href="tel:%2B41%2044%2063%2021199" value="+41446321199" target="_blank">+41 44 63 21199</a><br>
</div><a href="http://www.vision.ee.ethz.ch/~schneima/" target="_blank">www.vision.ee.ethz.ch/~<u></u>schneima/</a><br>
</div></div><br></div></div></div>