[vtkusers] Help with vtkMarchingSquares urgently needed
Anja Ende
anja.ende at googlemail.com
Sun Jul 20 09:54:31 EDT 2008
Hello everyone,
I urgently need some help with vtkMarchingSquares algorithm. I have a
binary egmentation and I am trying to convert it to a vtkPolyData
representation using vtkMarchingSquares. The approach works fine for
most segmentation regions but I have problems when there are curves
which are only a single voxel. They do not show up in the output of
the vtkMarchingSquares.
I have the following setup:
vtkDICOMImageReader * currentSegmentation = vtkDICOMImageReader::New();
currentSegmentation->SetFileName(segmentedFiles.at(i).c_str());
currentSegmentation->Update();
vtkMarchingSquares * ms = vtkMarchingSquares::New();
double * range = currentSegmentation->GetOutput()->GetScalarRange();
ms->SetInput(currentSegmentation->GetOutput());
ms->GenerateValues(1, 255, 255);
ms->Update();
vtkStripper * stripper = vtkStripper::New();
stripper->SetInput(ms->GetOutput());
stripper->Update();
vtkPolyData * polyData = vtkPolyData::New();
polyData->SetPoints(stripper->GetOutput()->GetPoints());
polyData->SetPolys(stripper->GetOutput()->GetLines());
vtkCellArray * ca = polyData->GetPolys();
ca->InitTraversal();
vtkIdType npts;
vtkIdType *pts;
while (ca->GetNextCell(npts, pts))
{
// convert the data points to my representation
}
Does anyone know why the single voxel input regions are not
discretized by the algorithm? I would very much appreciate any help as
I have a very urgent requirement with this!
Thanks,
Anja
More information about the vtkusers
mailing list