[ITK] Win64 Visual Studio 12 segfaults

Niels Dekker niels-xtk at xs4all.nl
Fri Jan 9 10:28:38 EST 2015


Floris and I did some testing on how to work around this Visual C++
compiler bug. It looks like the crashes (segfaults) in both
FiniteDifferenceImageFilter::InitializeFunctionCoefficients() and
ImageRegion::IsInside(const Self&) disappear when a local object is
replaced by a const-reference.

In "Core\FiniteDifference\include\itkFiniteDifferenceImageFilter.hxx"
(line 273):

 - const SpacingType spacing = outputImage->GetSpacing();
 + const SpacingType & spacing = outputImage->GetSpacing();


In "Core\Common\include\itkImageRegion.h" (line 260):

 - SizeType&  size = region.GetSize();
 + const SizeType & size = region.GetSize();


I must admit I don't know why such a modification actually does suppress
the crashes. But it seems to do the job! What do you think?

Kind regards, Niels



More information about the Community mailing list