[vtkusers] filling in a sphere's intersection with a plane

Andras Lasso lasso at queensu.ca
Fri Jan 11 13:04:12 EST 2019


In general, vtkCutter returns a random (unordered, non-continuous) list of line segments.

Can vtkContourTriangulator deal with that (merge points and order line segments to form closed contours)?

Usually we apply vtkStripper with a very large MaximumLength on vtkCutter output to create polygons that can be triangulated and rendered. This works well almost every time, but in some cases (cutting very complex geometries with hundreds of thousand of points) stripping does not find closed polygons. It would be nice to have a somewhat simpler and more robust solution.

Andras

From: vtkusers <vtkusers-bounces at vtk.org> On Behalf Of David Gobbi
Sent: Friday, January 11, 2019 11:38 AM
To: The Merper <msmerps at gmail.com>; VTK Users <vtkusers at vtk.org>
Subject: Re: [vtkusers] filling in a sphere's intersection with a plane

If you already have the spheres as polydata, and if they are already in your volume coord system, then the simplest approach is probably to use these two filters:
- vtkCutter, to cut the sphere (this generates a polyline contour of the intersection)
- vtkContourTriangulator to fill the polyline contour with triangles

When rendering the result on the image, the polydata and your image slice will be coincident in the z-buffer.  It might be possible to fix this by calling SetResolveCoincidentTopologyToPolygonOffset() on the polydata mapper.

Rendering the filled spheres with voxels would be more complicated.  The vtkPolyDataToImageStencil class works volumetrically, i.e. it would be used to fill the entire sphere and produce a binary volume.  Then the desired slice of that volume would be rendered as an overlay.

   David


On Fri, Jan 11, 2019 at 8:02 AM The Merper <msmerps at gmail.com<mailto:msmerps at gmail.com>> wrote:
Thanks for the speedy reply, David.
The application is a GUI that allows users to mark points in a 3D MRI volume. The user browses the volume and marks the points in 2D slices of the volume, which are rendered via a vtkImageViewer2. Once a point is marked, I represent the location with a sphere. I use vtkSphereSource via vtkPolyDataMapper to render the spheres.

I'd be happy using polygons or voxels.
   thanks again,
      -Merps




On Thu, Jan 10, 2019 at 5:08 PM David Gobbi <david.gobbi at gmail.com<mailto:david.gobbi at gmail.com>> wrote:
On Thu, Jan 10, 2019 at 12:13 PM The Merper <msmerps at gmail.com<mailto:msmerps at gmail.com>> wrote:

  I have a set of spheres in a volume that I visualize in 2D slices. When the plane of a 2D slice intersects a sphere, I want the interior of the sphere to be filled.

How are the spheres defined?  Do you already have them as vtkPolyData objects, or do you just have a list of "center and radius" values to describe the spheres?

When you say "visualize in 2D slices" do you mean that you are already visualizing slices of something (e.g. of an image) and you want to display the sphere cuts as an overlay on the image?  For your application, does it matter whether the sphere cuts are displayed as voxels (i.e. a vtkImageData) vs polygons?

Also, for context, what is the general purpose of your application?

Cheers,
  David


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190111/7077bf41/attachment.html>


More information about the vtkusers mailing list