[Insight-developers] point locator for kd tree

Nicholas Tustison ntustison at gmail.com
Mon May 30 13:23:50 EDT 2011


Hi Luis,

I don't know if you saw my response to your code review but in case you 
hadn't, I wanted to raise some of the issues I mentioned there.  I really
don't care what route we go, I just want to put something in place so I can
potentially submit a couple of point set metrics before the release date.

I had seen your PointLocator2 class with the same functionality that I 
wanted, namely to be able to locate the nearest neighbors of a user-specified
point within a given point set.  However, there were a couple of issues
which led me to implement the point set location functionality within the 
point set itself.  Geometric information, in the form of the bounding box, 
is already being computed in the point set as requested by the user so
adding the kd-tree does not seem incongruous.
Additionally, you already have the function FindClosestPoint() in the
point set class, although it isn't implemented properly, and that's very similar
to wanting the nearest N neighbors.  So if you look at my submission, I
have 

FindClosestPoint()
FindClosetsNPoints()
FindPointsWithinRadius()

all based on the kd-tree.

Also, I believe the code entanglements that you mention is what led me to 
implement the VectorContainerToListSampleAdaptor class which seems a 
much better use of the data then the PointSetToListSampleAdaptor class 
which ignores everything in the point set class except for what is housed in the 
PointSetContainer class which is a VectorContainer type.

So, although what I propose is one possible solution, another solution would
be to submit the PointSetLocator2 class (with a possible deletion of  the 
FindClosestPoint() function in the PointSet class?).   What are your thoughts 
in favoring one over the other?

Nick


More information about the Insight-developers mailing list