<div dir="ltr">Hi All,<div>I want to apply the tranform filter while I create an object in paraview. TO try with I have overloaded vtkCubeSource class and can create the object which appears in the paraview pipeline and I can visualize the object in the PV window.</div><div><br></div><div>Now I want to apply the transformation filter (vtkTransform) to the objct when I create it. To do that I have overloaded the RequestData function like the following. </div><div><br></div><div>The code is compiling and executing but when I create the object and apply transform, nothing is appearing in the PV visualization window. </div><div><br></div><div>Can anybody help me pointing out what is going wrong with my implementation.</div><div><br></div><div>I cam copying my code below</div><div><br></div><div>Thanks, </div><div>Chiranjib</div><div><br></div><div><br></div><div>------</div><div><br></div><div><p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">int MyOwnCubeSource::RequestData( vtkInformation
*vtkNotUsed(request),</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">
vtkInformationVector **vtkNotUsed(inputVector),</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">
vtkInformationVector *outputVector)</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">{</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> // get the info object</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> vtkInformation *outInfo = outputVector->GetInformationObject(0);</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> // get the ouptut</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> vtkPolyData *output = vtkPolyData::SafeDownCast(</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">
outInfo->Get(vtkDataObject::DATA_OBJECT()));</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">....</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">....</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">// output (type vtkPolyData) is already ready at this stage </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">// If I don’t appy transform operation afterwards, I can
visualize the object in the PV pipeline</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">// -----------------------------------------------//</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">// Implementation of vtkTransform starts here</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> double _rotationZ = 30.0;</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">// Define transform</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> vtkSmartPointer<vtkTransform> transform
= vtkSmartPointer<vtkTransform>::New();</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> // Define transformModel : transform filter</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> vtkSmartPointer<vtkTransformFilter>
transformModel = vtkSmartPointer<vtkTransformFilter>::New();</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> transformModel->SetTransform(transform);</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> //Decoupling the pipeline and asking the
transformfilter to update the newpipeline (created out of shallowcopy)</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> vtkNew<vtkPolyData> cubeCopy;</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> cubeCopy->ShallowCopy(output);</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">
transformModel->SetInputData(cubeCopy.GetPointer());</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> // Describe all the transform operations</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> transform->PostMultiply();</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> transform->RotateZ(10*_rotationZ);</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> transform->Update();</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> // getting the transformed output</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> vtkSmartPointer<vtkDataSet>
transformedOutput = transformModel->GetOutput();</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> // Shallowcopy the transformed output
to the old pipeline</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> output->ShallowCopy(transformedOutput);</span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:'Courier New';color:rgb(31,73,125)">// A this stage "output" should be updated and the
visualization pipeline should show the transformed object</span></p></div></div>