[Insight-users] Get ID from a neighbor found using a kd-tree?

motes motes mort.motes at gmail.com
Mon Nov 2 10:49:09 EST 2009


Hm maybe implementing my own "InstanceIdentifier" type could be a
solution since the neighbors are basically a list of
InstanceIdentifiers:

  typedef std::vector< InstanceIdentifier > InstanceIdentifierVectorType;

(from itkKdTree.h)



On Mon, Nov 2, 2009 at 4:40 PM, motes motes <mort.motes at gmail.com> wrote:
> I am using the itk::kdtree to find the k-nearest neighbors from a
> queryPoint within a specified radius.From the example: KdTree.cxx it
> looks something like this:
>
>  double radius = 437.0;
>  tree->Search( queryPoint, radius, neighbors ) ;
>  std::cout << "kd-tree radius search result:" << std::endl
>            << "query point = [" << queryPoint << "]" << std::endl
>            << "search radius = " << radius << std::endl;
>  std::cout << "measurement vector : distance" << std::endl;
>  for ( unsigned int i = 0 ; i < neighbors.size() ; ++i )
>    {
>    std::cout << "[" << tree->GetMeasurementVector( neighbors[i] )
>              << "] : "
>              << distanceMetric->Evaluate(
>                  tree->GetMeasurementVector( neighbors[i]))
>              << std::endl;
>    }
>
>
> But each neighbors is actually an object that contains a deformation
> vector and a unique identifier: ID.
>
> How do I lookup the ID and the deformation vector from the neighbors
> returned from the "Search" call?
>
> It seems that this is not possible with the above implementation of a
> kd-tree since a neighbor is only identified by a vector which does not
> allow for any extra information.
>


More information about the Insight-users mailing list