<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hello,</div>
<div>im new to Paraview, and im trying to write a plugin for the application.</div>
<div>I already managed to get going a bit by using on site examples, however i have severe difficulty understanding how to pass data between filters.</div>
<div> </div>
<div>I have written a source plugin which generates some data, and a marching cubes filter to do some analyzing.</div>
<div>However, the data written to the source plugins' output data object never seems to arrive at the m.c. filters input.</div>
<div>The code below was more or less copy pasted and reworked from a couple of examples i could actually get to work,</div>
<div>and which had some sparse explanation to them.</div>
<div> </div>
<div>Heres the code i think is relevant:</div>
<div>
<div>------------------------------------------------------------------------------------------------------------------------------------------------------------------</div>
<div>//first filter</div>
<div>
<div>vtkFirst::vtkFirst() {<br/>
this->SetNumberOfInputPorts(0);<br/>
this->SetNumberOfOutputPorts(1);<br/>
}</div>
<div> </div>
<div>vtkFirst::~vtkFirst(){<br/>
}</div>
<div> </div>
<div>int vtkFirst::FillOutputPortInformation(int port, vtkInformation* info) {<br/>
if (port == 0)<br/>
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUniformGrid");<br/>
return 1;<br/>
}</div>
<div> </div>
<div>int vtkFirst::RequestDataObject(vtkInformation *vtkNotUsed(request),<br/>
vtkInformationVector **vtkNotUsed(input),<br/>
vtkInformationVector *outputVector)<br/>
{<br/>
for ( int i = 0; i < this->GetNumberOfOutputPorts(); ++i ){<br/>
vtkInformation* outInfo = outputVector->GetInformationObject( i );<br/>
vtkSmartPointer<vtkUniformGrid> output = vtkUniformGrid::SafeDownCast(outInfo->Get( vtkDataObject::DATA_OBJECT() ) );<br/>
if (!output ) {<br/>
output = vtkUniformGrid::New();<br/>
outInfo->Set( vtkDataObject::DATA_OBJECT(), output );<br/>
this->GetOutputPortInformation(i)->Set(vtkDataObject::DATA_EXTENT_TYPE(), output->GetExtentType() );<br/>
}<br/>
}<br/>
return 1;<br/>
}</div>
<div>int vtkFirst::RequestData(vtkInformation *vtkNotUsed(request),<br/>
vtkInformationVector **vtkNotUsed(input),<br/>
vtkInformationVector *outputVector)<br/>
{<br/>
vtkInformation* outInfo = outputVector->GetInformationObject(0);<br/>
vtkUniformGrid* output = vtkUniformGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));</div>
<div> //fill output with some data, for testing i set the dims</div>
<div> int dim[3] = {10,20,30};</div>
<div>
<div> output->SetDimensions(dim);</div>
<div> </div>
<div> int ext[6];</div>
</div>
<div>
<div> in_grid->GetExtents(ext);</div>
<div> cout << ext[0] << ... << ext[6] << endl;</div>
<div>}</div>
<div>//output is 0 9 0 19 0 29</div>
</div>
</div>
</div>
<div>------------------------------------------------------------------------------------------------------------------------------------------------------------------</div>
<div>
<div>//second filter</div>
<div> </div>
<div>void vtkSecond::AddSourceConnection(vtkAlgorithmOutput* input){<br/>
this->AddInputConnection(1, input);<br/>
}</div>
<div>void vtkSecond::RemoveAllSources(){<br/>
this->SetInputConnection(1, 0);<br/>
}</div>
<div> </div>
<div>int vtkSecond::FillInputPortInformation( int port, vtkInformation* info ){<br/>
if (!this->Superclass::FillInputPortInformation(port, info)) {<br/>
return 0;<br/>
}<br/>
if ( port == 0 ) {<br/>
info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUniformGrid" );<br/>
return 1;<br/>
}<br/>
return 0;<br/>
}</div>
<div> </div>
int vtkSecond::RequestData(vtkInformation *vtkNotUsed(request),
<div> vtkInformationVector **inputVector,<br/>
vtkInformationVector *outputVector)<br/>
{<br/>
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);</div>
<div>
<div> vtkDataObject* inputDataObject = inInfo->Get(vtkDataObject::DATA_OBJECT());</div>
<div> vtkSmartPointer<vtkUniformGrid> in_grid = vtkUniformGrid::SafeDownCast(inputDataObject);</div>
<div> int ext[6];</div>
<div> in_grid->GetExtents(ext);</div>
<div> cout << ext[0] << ... << ext[6] << endl;</div>
</div>
<div>}</div>
<div>//output is 0 -1 0 -1 0 -1</div>
<div>
<div>------------------------------------------------------------------------------------------------------------------------------------------------------------------</div>
<div>Its not only the data thats getting lost, if i directly compare memory adresses of the DATA_OBJECTs, they are different.</div>
<div>I didnt post the .xml files since i assumed they would throw an error if something is wrong.</div>
<div>In short, the .xml file sets no pins for the first filter, and a single input pin for the second.</div>
</div>
</div>
<div>I also would appreciate an example which is as simple as possible explaning step by step how to talk to the pipeline.</div>
<div>It seems rather hard to find anything useful on the web (because its probably pretty trivial),or at least something that is so</div>
<div>minimal that it will work out of the box, and you can learn from it by expanding a working code, not reducing a</div>
<div>broken one to get it to work. Then again maybe it really is that complicated, then i'll just write my own vis package :)</div>
<div> </div>
<div>Thanks alot,</div>
<div> Tasche</div></div></body></html>