[Insight-developers] Insight-developers Digest, Vol 98, Issue 28

Simon Warfield simon.warfield at childrens.harvard.edu
Fri Jun 29 12:18:49 EDT 2012


The interpolator API allows the interpolator to be called for voxels 
that are within the bounds of the image, but for which the voxels in the 
window footprint for interpolation are not.  As a result, the 
implementation will ask for data at locations of neighbor voxels that 
are outside of the image.  There is no check for this in the 
interpolator code (by design).

This is a bug in the design. The assumption of the API is that it is 
safe to call an interpolator if the continuous index at which the 
interpolation is to be computed is inside the valid range. However, 
different interpolators use different amounts of surrounding voxels to 
compute the interpolated value (nearest neighor, linear, sinc etc. use 
different window sizes). This leads the interpolation function to 
sometimes access locations that are out of bounds. Sometimes this leads 
to a seg fault, sometimes just to invalid data being interpolated.

You are getting a segmentation fault when an invalid memory location 
corresponding to a neighbor voxel that does not exist is attempted to be 
accessed.  You can correct this by modifying the interpolator (in this 
case the linear interpolator) to account for voxels that are not valid 
to dereference.

--
Simon


>
> Message: 2
> Date: Fri, 29 Jun 2012 11:15:22 +0200
> From: pj gouttenoire<goutteno at esrf.fr>
> Subject: [Insight-developers] problem with
> 	itk::LinearInterpolateImageFunction
> To: insight-developers at itk.org
> Message-ID:<4FED722A.5050707 at esrf.fr>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Hello,
>
> i use itk::RegularStepGradientDescentBaseOptimizer for computing path
> between structures, the first version is doing in a for loop and one by
> one and it works, but it's very long so i use openMP for parallel
> computation. I made the directive fot the for loop and i launch it in
> multprocessor and i have this seg fault
>
> Program received signal SIGSEGV, Segmentation fault.
>
> [Switching to Thread 1126189376 (LWP 17584)]
> 0x00000000004be7d4 in
> itk::LinearInterpolateImageFunction<itk::Image<double, 3u>,
> double>::EvaluateAtContinuousIndex (
> this=0x2aaabc028150, index=@0x43202c70)
> at
> /data/id19/bones/Creatis/All/thirdparty_install/include/InsightToolkit/Common/itkLinearInterpolateImageFunction.txx:150
> 150 value += static_cast<RealType>( this->GetInputImage()->GetPixel(
> neighIndex ) ) * overlap;
> (gdb) bt




More information about the Insight-developers mailing list