VTK/New CellPicker: Difference between revisions
Line 56: | Line 56: | ||
== Future Possibilities == | == Future Possibilities == | ||
* Volume ray-cast with trilinear interpolation for increased pick accuracy. | * <del>Volume ray-cast with trilinear interpolation for increased pick accuracy.</del> Done. | ||
* Support for different volume cropping modes | * Support for different volume cropping modes | ||
* <del>Create a superclass that has no dependencies on the VolumeRendering kit. The CroppingPlanes feature is the only feature that needs the VolumeRendering kit, and it would be good to have all other functionality available within Rendering.</del> Done. The superclass of vtkVolumePicker is vtkSurfacePicker. | * <del>Create a superclass that has no dependencies on the VolumeRendering kit. The CroppingPlanes feature is the only feature that needs the VolumeRendering kit, and it would be good to have all other functionality available within Rendering.</del> Done. The superclass of vtkVolumePicker is vtkSurfacePicker. | ||
* Allow Locators to be provided via an AddLocator method, so that picking of large polydata objects can be done efficiently. | * Allow Locators to be provided via an AddLocator method, so that picking of large polydata objects can be done efficiently. |
Revision as of 13:47, 30 November 2009
The new class vtkVolumePicker will shoot a ray into a renderer containing Actors, ImageActors, and Volumes, and will return information about the intersection of the ray with the objects. For vtkVolume objects, it shoots a ray into the volume and returns the point where the ray intersects an isosurface of a chosen opacity. For vtkImageActor objects, it intersects the ray with the displayed slice. For vtkActor objects, it works like vtkCellPicker but also returns the closest point within the picked cell. If the object's mapper has ClippingPlanes, then it takes the clipping into account, and will return the Id of the clipping plane that was intersected.
This new class was added to VTK cvs by David Gobbi of Atamai Inc. on November 25, 2009.
New Features
The vtkVolumePicker provides a superset of the functionality of vtkCellPicker and vtkPointPicker. The information it returns is as follows:
- The Cell Id, Sub Id, and PCoords.
- The Point Id of the point in the cell that is parametrically closest to the pick position.
- The IJK indices of the cell if the picked data is vtkImageData.
- The IJK indices of the point if the picked data is vtkImageData.
Since the pick is a ray-cast that is looking for surfaces in the data, another piece of information returned is:
- The Normal of the surface that was intersected at the pick position.
The ray-cast will intersect any clipping planes that are used in the mappers, and will return:
- The ClippingPlaneId to identify the index of the clipping plane that was intersected by the ray
- The CroppingPlaneId to identify which of the vtkVolumeMapper cropping planes was intersected
There is also a flag, PickClippingPlanesOn(), that will cause the pick ray to stop at the clipping planes and return the position and normal of the clipping plane that was intersected.
Volume Picking Specifics
Volume picking is achieved by shooting a ray through the volume and identifying an isosurface.
- The current cvs code does a ray-cast with nearest neighbor interpolation.
- The VolumeOpacityIsovalue is compared against the product of the scalar opacity and gradient opacity in order to locate the surface.
- If the volume has multiple independent components, then a ray is cast into each and information about the frontmost intersection is returned (untested)
- The normal of the surface is computed from the gradient of the volume.
- If the pick cannot penetrate the volume (i.e the outermost point is already above the selected opacity value), then the normal of the cropping plane or clipping plane at that boundary is used.
Actor Picking Specifics
The actor picking works identical to vtkCellPicker with two exceptions:
- The picker will ignore any portions of the data that are outside of the ClippingPlanes of the mapper.
- A surface normal is computed: If the data has normals, they are interpolated to get the normal. Otherwise, the polygon normal is computed.
ImageActor Specifics
The image pick simply intersects the displayed image slice. The normal of the slice plane is returned.
Caveats
Like the vtkCellPicker, this picker does not work efficiently on long triangle strips. When you prepare data with vtkStripper, use a MaximumLength of around 10.
Incomplete
- For volumes, only the Subvolume cropping method is supported.
Future Possibilities
Volume ray-cast with trilinear interpolation for increased pick accuracy.Done.- Support for different volume cropping modes
Create a superclass that has no dependencies on the VolumeRendering kit. The CroppingPlanes feature is the only feature that needs the VolumeRendering kit, and it would be good to have all other functionality available within Rendering.Done. The superclass of vtkVolumePicker is vtkSurfacePicker.- Allow Locators to be provided via an AddLocator method, so that picking of large polydata objects can be done efficiently.