[vtkusers] filling in a sphere's intersection with a plane
David Gobbi
david.gobbi at gmail.com
Fri Jan 11 11:37:59 EST 2019
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> 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> wrote:
>
>> On Thu, Jan 10, 2019 at 12:13 PM The Merper <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/04598975/attachment.html>
More information about the vtkusers
mailing list