[vtk-developers] vtkOBBTree, vtkCellLocator

David Gobbi dgobbi at irus.rri.ca
Tue Jun 26 01:49:02 EDT 2001


Hi All,

I've made some changes to vtkOBBTree that I will eventually propagate up
into vtkCellLocator.  My primary goal is to provide an efficient way
of clipping vtkImageData with with a closed vtkPolyData surface, and
my changes to vtkOBBTree are in support of that.

Here are the new (proposed) methods for vtkOBBTree/vtkCellLocator, both
methods are specific to a locator build with vtkPolyData:

// Description:
// Intersect OBB with line a0,a1, return a list of the cellId's
// and the intersection points sorted by distance from a0.
// The return value is -1 if point a0 lies outside of the
// (assumed to be) closed vtkPolyData, +1 if inside, or 0
// if indeterminate.  The returned intersection points are
// guaranteed to alternate between entering/exiting the polydata.

int IntersectWithLine(const float a0[3], const float a1[3],
                      vtkPoints *points, vtkIdList *cells);

// Description:
// Convenience method: test to see if point lies inside or
// outside the closed vtkPolyData data set.  Returns -1 if
// outside or +1 if inside.

int InsideOrOutside(const float a0[3]);

I've also fixed some bugs in code that wasn't being exercised
by the regression tests, and added tolerance checks where they
were missing.


Now, for the 'vtkImageData' part of this, the idea is to have
a vtkImageFilter that will take an image and mask out all voxels
that lie outside the vtkPolyData by changing them to a selectable
'background' color, e.g. black or (for RGBA) transparent.

Another idea I've had is to add a filter that will return all the
clipped voxels as a single-line 1D image that can be fed into
e.g. vtkImageAccumulate histogram analysis or other forms of
statistical analysis.

 - David

--
  David Gobbi, MSc                       dgobbi at irus.rri.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario





More information about the vtk-developers mailing list