<div dir="ltr">This was fixed yesterday in the master branch I think.<div>See: <a href="http://review.source.kitware.com/#/c/14367/">http://review.source.kitware.com/#/c/14367/</a></div><div>Try back porting that fix to your VTK 5.10 an let us know if it fixes the problem for you.</div>

<div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><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>
<br><br><div class="gmail_quote">On Tue, Feb 18, 2014 at 7:48 AM, Nens <span dir="ltr"><<a href="mailto:nicolas.narbonne@gmail.com" target="_blank">nicolas.narbonne@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello,<br>
<br>
I have a problem to draw the correct surface. Indeep, the surface created by<br>
the code bellow don't have the correct coordinate. The surface seems good<br>
but values are false.<br>
<br>
I try to reset origin and spinning, but i didn't find how to do this good.<br>
<br>
I use vtk 5.<br>
<br>
*Code :*<br>
<br>
 vtkSmartPointer<vtkPolyData> polydata =<br>
vtkSmartPointer<vtkPolyData>::New();<br>
        polydata->SetPoints(points);<br>
        double bounds0[6];<br>
        polydata->GetBounds(bounds0);<br>
        // Find min and max z<br>
        double min0z = bounds0[4];<br>
        double max0z = bounds0[5];<br>
        std::cout << "min0z: " << min0z << std::endl;<br>
        std::cout << "max0z: " << max0z << std::endl;<br>
<br>
<br>
        // // Construct the surface and create isosurface.<br>
        vtkSmartPointer<vtkSurfaceReconstructionFilter> surf =<br>
vtkSmartPointer<vtkSurfaceReconstructionFilter>::New();<br>
#if VTK_MAJOR_VERSION <= 5<br>
        surf->SetInput(polydata);<br>
#else<br>
        surf->SetInputData(polydata);<br>
#endif<br>
        surf->Update();<br>
<br>
        std::cout << "t 0" <<  std::endl;<br>
<br>
        // Create a new instance of the same type as surf->GetOutput() and<br>
make it<br>
        // a shallow copy<br>
        vtkImageData* signedDist  = surf->GetOutput()->NewInstance();<br>
        signedDist->ShallowCopy(surf->GetOutput());<br>
<br>
//               vtkInformation* signedDistInfo =<br>
surf->GetOutputPortInformation(0);<br>
//        vtkInformation* signedDistInfo = polydata->GetInformation();<br>
//        double *spacing = signedDistInfo->Get(vtkDataObject::SPACING());<br>
//        signedDist->SetSpacing(spacing);<br>
//------------------------------------->crash<br>
<br>
std::cout << "t 1" <<  std::endl;<br>
<br>
//        signedDist->SetSpacing((bounds0[1] - bounds0[0])/XY.dim1()<br>
,(bounds0[3] - bounds0[2])/XY.dim2()  , (bounds0[5] - bounds0[4]) );<br>
<br>
        std::cout << "bounds : " << bounds0[0] <<" / "<<  bounds0[1] <<" /<br>
"<< bounds0[2] <<" / "<< bounds0[3] <<" / "<< bounds0[4] <<" / "<<<br>
bounds0[5] <<" / "<< std::endl;<br>
        std::cout << "dim XY : "<< XY.dim1()<<" / "<< XY.dim2() <<<br>
std::endl;<br>
        std::cout << "dim field : "<< field.dim1()<<" / "<< field.dim2() <<<br>
std::endl;<br>
        std::cout << bounds0[1]-bounds0[0] / XY.dim1()<<" 000 "<br>
<<bounds0[3]-bounds0[2] / XY.dim2() &lt;&lt;  std::endl;<br>
<br>
        std::cout &lt;&lt; &quot;t 2&quot; &lt;&lt;  std::endl;<br>
<br>
//        double *origin = signedDistInfo->Get(vtkDataObject::ORIGIN());<br>
        signedDist->SetOrigin(bounds0[0],bounds0[2], bounds0[4]);<br>
//        signedDist->SetOrigin(0,0, 0);<br>
<br>
        std::cout << "t 3" <<  std::endl;<br>
<br>
        vtkSmartPointer<vtkContourFilter> contourFilter =<br>
vtkSmartPointer<vtkContourFilter>::New();<br>
//        contourFilter->SetInputConnection(surf->GetOutputPort());<br>
        contourFilter->SetInput(signedDist);<br>
        double bounds1[6];<br>
        contourFilter->GetOutput()->GetBounds(bounds1);<br>
<br>
        // Find min and max z<br>
        double min1z = bounds1[4];<br>
        double max1z = bounds1[5];<br>
        std::cout << "min1z: " << min1z << std::endl;<br>
        std::cout << "max1z: " << max1z << std::endl;<br>
<br>
         // Sometimes the contouring algorithm can create a volume whose<br>
gradient<br>
        // vector and ordering of polygon (using the right hand rule) are<br>
        // inconsistent. vtkReverseSense cures this problem.<br>
        vtkSmartPointer<vtkReverseSense> reverse =<br>
vtkSmartPointer<vtkReverseSense>::New();<br>
        reverse->SetInput(contourFilter->GetOutput());<br>
        reverse->ReverseCellsOn();<br>
        reverse->ReverseNormalsOn();<br>
        reverse->Update();<br>
<br>
<br>
        // // Color surface<br>
        vtkPolyData* outputPolyData = reverse->GetOutput();<br>
<br>
        double bounds[6];<br>
        outputPolyData->GetBounds(bounds);<br>
<br>
        // Find min and max z<br>
        double minz = bounds[4];<br>
        double maxz = bounds[5];<br>
        std::cout << "minz: " << minz << std::endl;<br>
        std::cout << "maxz: " << maxz << std::endl;<br>
<br>
<br>
*Console return :*<br>
<br>
min0z: -3.63994                       // correct values<br>
max0z: 8.62691                       //<br>
t 0<br>
t 1<br>
bounds : -100 / 100 / -100 / 100 / -3.63994 / 8.62691 /<br>
dim XY : 21 / 41<br>
dim field : 21 / 41<br>
104.762 000 102.439<br>
t 2<br>
t 3<br>
min1z: 1<br>
max1z: -1<br>
minz: -1.93855                     // wrong values<br>
maxz: -0.409277                  //<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/vtkSurfaceReconstruction-coordinate-error-tp5725988.html" target="_blank">http://vtk.1045678.n5.nabble.com/vtkSurfaceReconstruction-coordinate-error-tp5725988.html</a><br>


Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>