[vtkusers] ImageToPolyData separate output for each color?

Thomas Sundgaard Pedersen sundgaard at inropa.com
Wed Aug 24 07:27:03 EDT 2005


Hello,
I need to create polydata, from a green colored area of a
bitmap-image(.bmp). I can create polydata for the entire image, by the
following code. But how do I isolate the green cells in one polydata
opject?
 
My code until now (Render and other graphics stuff created else where):
 
vtkBMPReader *reader = vtkBMPReader::New();
reader->SetFileName("C:\\scan2Doutput\\bil016.bmp");
 
vtkImageToPolyDataFilter *i2pd = vtkImageToPolyDataFilter::New();
 
i2pd->SetInput(reader->GetOutput());
i2pd->SetLookupTable((vtkScalarsToColors*)reader->GetLookupTable());
i2pd->SetColorModeToLinear256();
i2pd->SetOutputStyleToRunLength();//SetOutputStyleToPolygonalize();
i2pd->SetError(0);
i2pd->DecimationOn();
i2pd->SetDecimationError(200.0);
i2pd->SetSubImageSize(25);
 
// Need a triangle filter because the polygons are complex and concave
vtkTriangleFilter *tf = vtkTriangleFilter::New();
tf->SetInput(i2pd->GetOutput());
 
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(tf->GetOutput());
 
vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
 
// Add the actor to the renderer
ren->AddActor(actor);
 
 
Best Regards
 
Inropa ApS                  
Thomas Sundgaard Pedersen
Bredgade 5
DK-9700 Brønderslev
Denmark
 
Phone: +45 9646 1177
E-mail: thomas at inropa.com
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050824/0a5c70f6/attachment.htm>


More information about the vtkusers mailing list