[Insight-users] Bug in itk::kdTree ?

motes motes mort.motes at gmail.com
Thu Nov 26 13:55:49 EST 2009


The value is:

m_radius = 262

when I do std::cout << "m_radius" << std::endl; I  have also tried:

            static_cast<double>(m_kernel_radius)/1.0;

But I still get the error.




When I look in the implementation (itkKdTree.txx) in the ::SearchLoop
function (a recursive function) I see that the radius is used:


    // search the other node, if necessary
    tempValue = lowerBound[partitionDimension];
    lowerBound[partitionDimension] = partitionValue;
    if ( this->BoundsOverlapBall(query, lowerBound, upperBound,
                           m_SearchRadius) )
      {
      SearchLoop(node->Right(), query, lowerBound, upperBound);
      }
    lowerBound[partitionDimension] = tempValue;


My thought was therefore (under the assumption that a "bad" radius is
supplied) that the function never terminates since its a recursive
function.








On Thu, Nov 26, 2009 at 7:46 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Motes,
>
> What is the value of m_radius   ?
>
> Please report this to the mailing list.
>
>
>     Thanks
>
>
>           Luis
>
>
> -----------------------------------------
> On Thu, Nov 26, 2009 at 1:32 PM, motes motes <mort.motes at gmail.com> wrote:
>> For the last couple of days I have tried to find a solution for a
>> segmentation fault that happens when I use the itk::kdTree.
>>
>> I am using the version of search where the radius is specified:
>>
>>  /** Searches the neighbors fallen into a hypersphere */
>>  void Search(const MeasurementVectorType &query,
>>              double radius,
>>              InstanceIdentifierVectorType& result) const;
>>
>>
>>
>>
>> From my function I call it with:
>>
>>    VectorType vectorPoint;
>>    for (int i=0; i<NDimensions; i++) {
>>      vectorPoint[i] = point[i];
>>    }
>>
>>    NeighborsType neighbors;
>>    tree->Search(vectorPoint, m_radius, neighbors);
>>
>>
>>
>>
>>
>> Where radius is computed like:
>>
>>  unsigned int FVOrder = 3;
>>  double Order = (double)(FVOrder+1.0);
>>  double  m_radius =  (1.0*maxValue * Order)/2.0;
>>
>>
>> Now if I do:
>>
>>    tree->Search(vectorPoint, 5.0, neighbors);
>>
>> it works fine without any segmentation errors. But if I do:
>>
>>    tree->Search(vectorPoint, m_radius, neighbors);
>>
>> where m_radius is compted as above I get the segmentation error (after
>> a few thousand calls).
>>
>> Could this be a bug or am I doing something wrong here?
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>


More information about the Insight-users mailing list