<div dir="ltr">Perfect! Thank you very much for your quick reply David.<div><br></div><div>Chiranjib</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 14, 2016 at 6:43 PM, David E DeMarle <span dir="ltr"><<a href="mailto:dave.demarle@kitware.com" target="_blank">dave.demarle@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If this is a source, not a filter then call <br>this->SetNumberOfInputPorts(0); <br>in MyClass's constructor to override the default (likely 1) set by an ancestor class (vtkPolyDataAlgorithm likely).<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div>David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On Thu, Apr 14, 2016 at 5:34 AM, Chiranjib Sur <span dir="ltr"><<a href="mailto:sur.chiranjib@gmail.com" target="_blank">sur.chiranjib@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Utkarsh and team,<div>Here I come again with a very similar question.</div><div><br></div><div>I am creating a object using a C++ class in ParaView. I have implemented the RequestData function in the following way but I keep getting the error message :</div><div><br></div><div><font color="#0000ff">Input port 0 of algorithm MyClass(0x4961fc0) has 0 connections but is not optional.</font><br></div><div><br></div><div>What is going wrong here?</div><div><br></div><div>Below is my implementation of RequestData</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Chiranjib</div><div><br></div><div><br></div><div><div><font face="monospace, monospace" color="#0000ff">int MyClass::RequestData( vtkInformation* vtkNotUsed( request ),</font></div><div><font face="monospace, monospace" color="#0000ff"> vtkInformationVector** vtkNotUsed( inputVector ),</font></div><div><font face="monospace, monospace" color="#0000ff"> vtkInformationVector* outputVector )</font></div><span><div><font face="monospace, monospace" color="#0000ff">{</font></div><div><font face="monospace, monospace" color="#0000ff"> // get the info object</font></div><div><font face="monospace, monospace" color="#0000ff"> vtkInformation* outInfo = outputVector->GetInformationObject( 0 );</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div></span><div><font face="monospace, monospace" color="#0000ff"> // get the output</font></div><span><div><font face="monospace, monospace" color="#0000ff"> vtkPolyData* output = vtkPolyData::SafeDownCast( outInfo->Get( vtkDataObject::DATA_OBJECT()));</font></div></span></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();</font></div><div><font face="monospace, monospace" color="#0000ff"> points->SetDataType( VTK_DOUBLE ); // Set precision for the vtk points</font></div></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> // generate my polydata with points etc.</font></div><div><font face="monospace, monospace" color="#0000ff">....</font></div><div><font face="monospace, monospace" color="#0000ff">// at this stage polydata is generated</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><div><font face="monospace, monospace" color="#0000ff"> output->ShallowCopy(polydata);</font></div><div><font face="monospace, monospace" color="#0000ff"> output->Squeeze();</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> return 1;</font></div></div><div><font face="monospace, monospace" color="#0000ff">}<br></font></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 27, 2015 at 3:37 PM, Chiranjib Sur <span dir="ltr"><<a href="mailto:sur.chiranjib@gmail.com" target="_blank">sur.chiranjib@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Wow, This works like a magic ! <div><br></div><div>Thank you very much for the solution and sorry for my delay in updating about the problem I mentioned.</div><span><font color="#888888"><div><br></div><div>Chiranjib</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 17, 2015 at 5:54 PM, Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You're missing a call to `transformModel->Update()` before calling<br>
`transformModel->GetOutput()`. The filter never updated, and hence its<br>
output is empty.<br>
<br>
Utkarsh<br>
<div><div><br>
On Fri, Apr 17, 2015 at 6:34 AM, Chiranjib Sur <<a href="mailto:sur.chiranjib@gmail.com" target="_blank">sur.chiranjib@gmail.com</a>> wrote:<br>
> Hi All,<br>
> I want to apply the tranform filter while I create an object in paraview. TO<br>
> try with I have overloaded vtkCubeSource class and can create the object<br>
> which appears in the paraview pipeline and I can visualize the object in the<br>
> PV window.<br>
><br>
> Now I want to apply the transformation filter (vtkTransform) to the objct<br>
> when I create it. To do that I have overloaded the RequestData function like<br>
> the following.<br>
><br>
> The code is compiling and executing but when I create the object and apply<br>
> transform, nothing is appearing in the PV visualization window.<br>
><br>
> Can anybody help me pointing out what is going wrong with my implementation.<br>
><br>
> I cam copying my code below<br>
><br>
> Thanks,<br>
> Chiranjib<br>
><br>
><br>
> ------<br>
><br>
><br>
><br>
> int MyOwnCubeSource::RequestData( vtkInformation *vtkNotUsed(request),<br>
><br>
> vtkInformationVector **vtkNotUsed(inputVector),<br>
><br>
> vtkInformationVector *outputVector)<br>
><br>
> {<br>
><br>
> // get the info object<br>
><br>
> vtkInformation *outInfo = outputVector->GetInformationObject(0);<br>
><br>
><br>
><br>
> // get the ouptut<br>
><br>
> vtkPolyData *output = vtkPolyData::SafeDownCast(<br>
><br>
> outInfo->Get(vtkDataObject::DATA_OBJECT()));<br>
><br>
> ....<br>
><br>
> ....<br>
><br>
><br>
><br>
> // output (type vtkPolyData) is already ready at this stage<br>
><br>
><br>
><br>
> // If I don’t appy transform operation afterwards, I can visualize the<br>
> object in the PV pipeline<br>
><br>
><br>
><br>
><br>
><br>
> // -----------------------------------------------//<br>
><br>
><br>
><br>
> // Implementation of vtkTransform starts here<br>
><br>
><br>
><br>
> double _rotationZ = 30.0;<br>
><br>
><br>
><br>
> // Define transform<br>
><br>
> vtkSmartPointer<vtkTransform> transform =<br>
> vtkSmartPointer<vtkTransform>::New();<br>
><br>
><br>
><br>
> // Define transformModel : transform filter<br>
><br>
> vtkSmartPointer<vtkTransformFilter> transformModel =<br>
> vtkSmartPointer<vtkTransformFilter>::New();<br>
><br>
> transformModel->SetTransform(transform);<br>
><br>
><br>
><br>
> //Decoupling the pipeline and asking the transformfilter to update the<br>
> newpipeline (created out of shallowcopy)<br>
><br>
> vtkNew<vtkPolyData> cubeCopy;<br>
><br>
> cubeCopy->ShallowCopy(output);<br>
><br>
> transformModel->SetInputData(cubeCopy.GetPointer());<br>
><br>
><br>
><br>
> // Describe all the transform operations<br>
><br>
> transform->PostMultiply();<br>
><br>
> transform->RotateZ(10*_rotationZ);<br>
><br>
> transform->Update();<br>
><br>
><br>
><br>
> // getting the transformed output<br>
><br>
> vtkSmartPointer<vtkDataSet> transformedOutput =<br>
> transformModel->GetOutput();<br>
><br>
><br>
><br>
> // Shallowcopy the transformed output to the old pipeline<br>
><br>
><br>
><br>
> output->ShallowCopy(transformedOutput);<br>
><br>
><br>
><br>
> // A this stage "output" should be updated and the visualization pipeline<br>
> should show the transformed object<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Search the list archives at:<br>
> <a href="http://markmail.org/search/?q=Paraview-developers" target="_blank">http://markmail.org/search/?q=Paraview-developers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/paraview-developers" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><br>
><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=Paraview-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=Paraview-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>