[vtkusers] vtkVoxelContoursToSurfaceFilter : Scaling input contour data depend on the resolution ?

Ashika Umanga Umagiliya aumanga at biggjapan.com
Tue Jul 19 04:23:49 EDT 2011


Greetings all,

I use vtkVoxelContoursToSurfaceFilter generate mesh from a stack of
contours.
My input contours have the resolution starting from 800x800 .
Here is a sample image -

http://oi51.tinypic.com/2h7hpp1.jpg

http://oi53.tinypic.com/29yrsr5.jpg

Sometimes vtkVoxelContoursToSurfaceFilter  filter cannot allocate enough
memory for the mesh/(or vertices?) because the resolution is too high.
So,I divide the original 2D coordinates with a constant value as follows:


//Create New PolyData
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();

vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
points->SetNumberOfPoints(curve->getNodeCount() + 1);
cells->Allocate(1, curve->getNodeCount() + 1);
cells->InsertNextCell(curve->getNodeCount() + 1);

//"tmp" is the datastructure holding 2D coordinates of each node.

int curveNodeCounter = 0;

do {
  double nx = tmp->getX() / GLOBALSCALE;     //Divide original coordinate
  double ny = tmp->getY() / GLOBALSCALE;     //Divide original coordinate

  points->SetPoint(curveNodeCounter, nx, ny, nz);
  cells->InsertCellPoint(curveNodeCounter);
  curveNodeCounter++;
  tmp = tmp->getNextNode();

} while (tmp != head);

polyData->Initialize();
polyData->SetPolys(cells);
polyData->SetPoints(points);

At the moment this GLOBALSCALE is set to 5.But when I want to create mesh
from the images with higher resolutions like 1000x1000 ,vtk crashing because
it cannot alloate enough memory.
Again it works when its set to 15 , but then the meshes generated from
smaller resolution  images (500x500) lose details.

Any tips on adjusting this  GLOBALSCALE depend on the resolution ?

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110719/2dece3f4/attachment.htm>


More information about the vtkusers mailing list