[vtkusers] image region connectivity problems
Uriah Liggett
uliggett at sark.com
Thu Jan 19 09:11:03 EST 2006
I need to perform a vtkConnectivityFilter on vtkImageData, and send the
resulting image data back to my application with the regions colored
differently. I'm able to retrieve all the points from the cells that
make up the regions, but I am unsure how to get the color of the
regions. How can I distinguish between the multiple regions returned by
the connectivity filter?
vtkConnectivityFilter* pConnFilterOut = vtkConnectivityFilter::New();
int dims[3]; // the output image dimensions
unsigned char *outArr; // an pointer to the output image's sclars
.....
int cellCount = pConnFilterOut->GetNumberOfCells();
for(int i=0; i < cellCount; i++)
{
float cell[3];
float tuple[3];
float color;
vtkPoints * points = pConnFilterOut->GetCell(i)->GetPoints();
for(int j=0; j < points->GetNumberOfPoints(); j++)
{
float point[3];
points->GetPoint(j, point);
outArr[int(point[1]) * dims[0] + int(point[0])] = 0xFF;
// populate the output image
}
}
More information about the vtkusers
mailing list