[vtkusers] From vtkContourWidget to Mask

George gcl22 at case.edu
Thu Jul 14 15:13:05 EDT 2011


Dear VTK Users,

I am trying to do something that seems to be very simple.  The user drags
around their vtkContourWidget, and I would like to be able to generate a
mask based on their selection.  A mask would simply mean that the closed
area that the user defines would be black, and everything else would be
intact.

I have tried many ways to do this, but they have either been too slow, or
unsuccessful.  First I used Delaunay2D to generate a surface from the closed
contour.  Then I looped through the image and used a CellLocator to check if
each pixel was inside the surface.  This worked, but it was dreadfully
slow--on the order of seconds for a 512x512 image.  Secondly I tried using
the vtkLassooStencilSource<http://vtk.org/gitweb?p=VTK.git;a=blob;f=Imaging/vtkLassooStencilSource.h;h=5e88f891edf5b983b118cab19d9c008253e21ea3;hb=df58dd14>,
which was designed for this, but it was also slow--took me nearly 200ms for
a 512x512 image.  Thirdly, I converted my vtkContourWidgetRepresentation
into a vtkPolyData, and I was going to use my own simple algorithm that
traverses each scanline to make the mask.  However, the vtkPoints I
retrieved from the vtkPolyData were not dense enough--I needed a point for
every pixel in the Y direction (every scanline), and it did not provide
enough.

If you have any thoughts or suggestions, I would greatly appreciate it.

-George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110714/7d7862cd/attachment.htm>


More information about the vtkusers mailing list