<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<span style="font-size:12pt;background-color:white;" dir="ltr">
<div style="margin-top:0;margin-bottom:0;">Hello all,<br>
<br>
So I wrote a couple of ParaView filters in C++, namely a reader A for a custom file format deriving from vtkUnstructuredGridAlgorithm, and a filter B that takes two of these outputs as input and does some calculation on them.<br>
<br>
Everything is working fine, but now I noticed that I need to pass a single string value (and 3-4 numbers) from each reader to the actual filter B doing stuff.<br>
A use case would be, for example, passing the input data filename from a reader to a filter on to a writer plugin, which can use it to come up with an appropriate output filename.<br>
<br>
Now the work-around I'm using at the moment to pass these data to the filter B is abusing CellData or PointData arrays of the vtkUnstructuredGrid generated in A. Needles to say this is not very elegant and creates other problems too (memory issues), and I'm
fairly sure there is a better way to do it.<br>
<br>
I think that somehow I need to create an appropriate vtkInformationKey storing the data.<br>
However, everything I tried seems to be wrong, the key seems to disappear in the pipeline between the filters.<br>
<br>
Here is some pseudocode snippet to show what I tried to add a value to an vtkInformation.
<br>
Here the reader class A:<br>
<code><br>
class A : vtkUnstructuredGridAlgorithm {<br>
static vtkInformationStringKey* MYSTRING();<br>
...<br>
}<br>
<br>
vtkInformationKeyMacro(A, MYSTRING, String);<br>
<br>
A::RequestInformation(...) {<br>
vtkSmartPointer<vtkInformation> outInfo = outputVector->GetInformationObject(0);<br>
outInfo->Set(A::MYSTRING(),"test");<br>
}<br>
</code></div>
<div style="margin-top:0;margin-bottom:0;">And the filter class B:<br>
<code><br>
#include "classA.h"<br>
class B : vtkUnstructuredGridAlgorithm {<br>
...<br>
}<br>
<br>
B::RequestInformation(...) {<br>
vtkSmartPointer<vtkInformation> inInfo = inputVector[0]->GetInformationObject(0);<br>
if (!inInfo->Has(A::MYSTRING()))<br>
std::cout << "fail" std::endl;<br>
<br>
}<br>
</code><br>
</div>
<div style="margin-top:0;margin-bottom:0;">I keep getting fails printed to my console :(<br>
<br>
So here is the question(s):<br>
A colleague of mine mentioned to check out the python interface, but I assume this can be done within vtk?<br>
Is this the correct approach using vtkInformation?</div>
<div style="margin-top:0;margin-bottom:0;"><br>
</div>
<div style="margin-top:0;margin-bottom:0;">-If yes, what am I doing wrong? I derived my code from an example which I can't seem to find anymore...
</div>
<div style="margin-top:0;margin-bottom:0;">Can someone give me a detailed explanation of the steps necessary, or a well commented example?<br>
<br>
-If no,is there a better, or more paraviewesque way to do it (not the python way), and can I get hint at what I need to look at please?<br>
Any other comments on how to pass user defined data along the pipeline?<br>
<br>
Thanks a lot for the help,<br>
Oli<br>
<br>
P.S.: I'm using ParaView 5.0.0</div>
</span>
<p><br>
</p>
</body>
</html>