image region connectivity problems

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

image region connectivity problems

Uriah Liggett
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
             }
}
_______________________________________________
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