[vtkusers] surface from contours

Kenneth Sloan kennethrsloan at gmail.com
Wed Apr 23 13:40:36 EDT 2008


One issue is the distance between contours.  If the contour spacing  
(z) is comparable to the x-y resolution in each plane, then reducing  
the problem to something that MC can handle is appropriate.

If, on the other hand, the contours are more widely spaced, then  
older methods are more appropriate.  See:
     http://portal.acm.org/citation.cfm? 
id=130881.131213&coll=GUIDE&dl=GUIDE

and the references (the paper probably addresses a harder problem  
than the one you have).
There are probably 3 methods described in the references that will  
work - the choice depends on what your data look like.

I'm not aware of any vtk implementations.  Perhaps I'll have a  
student do one next year, just for old times' sake.



On Apr 23, 2008, at 11:35 AM, Simon ESNEAULT wrote:

> Hi,
>
> We're facing the same problem here for the evaluation of a liver  
> segmentation algorithm. In order to reconstruct a surface from some  
> manually selected points, we've tried :
> - vtkDelaunay3D : works very bad in our case
> - vtkSurfaceReconstructionFilter : can reconstruct a surface from  
> unorganized points, but the result isn't very good in my opinion,  
> some points are ignored or moved ...
> - vtkPowerCrustSurfaceReconstruction (not official find it here :  
> http://www.sq3.org.uk/powercrust/) gives better result, but it is  
> still buggy sometimes
>
> - now we're using a home made solution following these steps :
>         - spline interpolation for each contour
>         - build a 2D binary image for each contour with 1 inside  
> the spline, and 0 outside
>         - append all the 2D images
>         - marchingcubes ...
>
> But it is "de la cuisine"
>
> Does anyone know a (vtk) way to build a surface from several 2D  
> contours (vtkParametricSpline in our case) ?
> Thanks
>
>
> On Wed, Apr 23, 2008 at 5:08 PM, Carsten Barkow  
> <carsten.barkow at googlemail.com> wrote:
> Hi,
>
> we've implemented a 3D segmentation algorithm and want to evaluate  
> it. Due to this we get some manual segmented data, but those are  
> only 2D contours for each section of the volume. So we want to  
> generate a 3D surface from this contours.
> In VTK there are classes for this purpose like  
> vtkVoxelContoursToSurface or vtkRuledSurfaceFilter. Unfortunately  
> we can not make it show us a surface. Has anybody an idea where the  
> fault is? Here is the code:
>
>   vtkPoints *points = vtkPoints::New();
>   vtkCellArray *cells = vtkCellArray::New();
>   int index = 0;
>   int temp;
>   VoxelXYZ v;
>   double x, y, z;
>   std::vector<VoxelXYZ> contour;
> // --- writing points and lines  
> ----------------------------------------------------------------
>   for(int sec = 0; sec < borderPoints->getZRes(); ++sec){
>           if(borderPoints->getContour(sec, contour)){
>               //remember first point index of actual  
> contour                         temp = index;
>               for(std::vector<VoxelXYZ>::iterator it = contour.begin 
> (); it!=contour.end(); ++it){
>                   v = *it;
>                   x = static_cast<double>(v.getX());
>                   y = static_cast<double>(v.getY());
>                   z = static_cast<double>(v.getZ());
>                   points->InsertPoint(index, v.getX(), v.getY(),  
> v.getZ());
>                   vtkLine *line = vtkLine::New();
>                   line->GetPointIds()->SetId(0, index);
>                   if((index-temp) == contour.size()-1)
>                         //reached last point of actual contour and  
> close contour
>                         line->GetPointIds()->SetId(1, temp);
>                   else
>                        line->GetPointIds()->SetId(1, index+1);
>                   cells->InsertNextCell(line);
>                   line->Delete();
>                   ++index;
>              }
>         }
>   }
> //  
> ---------------------------------------------------------------------- 
> ----------------------
>  // Insert points and cells
>   vtkPolyData *pointCloud = vtkPolyData::New();
>   pointCloud->SetPoints(points);
>   pointCloud->SetPolys(cells); // it also doesn't work with  
> pointCloud->SetLines(cells);
>
> // --- just show contours for testing and this works fine we guess  
> --------------------------------------
>   vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();
>   contourMapper->SetInput(pointCloud);
>   vtkActor *contourActor = vtkActor::New();
>   contourActor->SetMapper(contourMapper);
>   contourActor->GetProperty()->SetColor(1, 0, 0);
>   contourActor->GetProperty()->SetAmbient(1);
>   contourActor->GetProperty()->SetDiffuse(0);
>   contourActor->GetProperty()->SetRepresentationToWireframe();
>   renSurface->AddActor(contourActor);
>   contourMapper->Delete();
>   contourActor->Delete();
> //  
> ---------------------------------------------------------------------- 
> --------------------------
>
> // vtkRuledSurfaceFilter approach
>   /*vtkRuledSurfaceFilter *ruledSurfaceFilter =  
> vtkRuledSurfaceFilter::New();
>   ruledSurfaceFilter->SetInput(pointCloud);
>   ruledSurfaceFilter->CloseSurfaceOn();*/
>   // vtkVoxelContoursToSurfaceFilter approach
>   vtkVoxelContoursToSurfaceFilter *contourToSurfaceFilter =  
> vtkVoxelContoursToSurfaceFilter::New();
>   contourToSuraceFilter->SetInput(pointCloud);
>       vtkPolyDataMapper *surfaceMapper = vtkPolyDataMapper::New();
>   //surfaceMapper->SetInputConnection(ruledSurfaceFilter- 
> >GetOutputPort());
>   surfaceMapper->SetInputConnection(contourToSurfaceFilter- 
> >GetOutputPort());
>     vtkActor *surfaceActor = vtkActor::New();
>   surfaceActor->SetMapper(surfaceMapper);
>   surfaceActor->GetProperty()->SetDiffuseColor(1.0000, 0.3882,  
> 0.2784);
>   surfaceActor->GetProperty()->SetSpecularColor(1, 1, 1);
>   surfaceActor->GetProperty()->SetSpecular(.4);
>   surfaceActor->GetProperty()->SetSpecularPower(50);
>     renSurface->AddActor(surfaceActor);
>     points->Delete();
>   cells->Delete();
>   pointCloud->Delete();
>   surfaceMapper->Delete();
>   surfaceActor->Delete();
>   renSurface->Delete();
>
> ***thx for any hints/help***
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/ 
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> -- 
> ------------------------------------------------------------------
> Simon Esneault
> Laboratoire Traitement du Signal et de l'Image, (LTSI, UMR-INSERM 642)
> Université de Rennes I, Campus de Beaulieu,
> 35042 Rennes Cedex, France.
> Tel : +33 (0)6 64 61 30 94
> Mail : simon.esneault at univ-rennes1.fr
> ------------------------------------------------------------------
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/ 
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

--
Kenneth Sloan                                           
KennethRSloan at gmail.com
Computer and Information Sciences                        +1-205-934-2213
University of Alabama at Birmingham              FAX +1-205-934-5473
Birmingham, AL 35294-1170                http://KennethRSloan.com/





More information about the vtkusers mailing list