Skip to content

Commit

Permalink
Merge pull request #2025 from blowekamp/FixSignedMaurerDistanceMapZer…
Browse files Browse the repository at this point in the history
…oDivide

Fix signed maurer distance map zero divide
  • Loading branch information
blowekamp committed Sep 30, 2020
2 parents 4e556d4 + b706cf6 commit c2b399e
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -106,10 +106,10 @@ BinaryContourImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData(
OutputImagePointer output = this->GetOutput();
InputImageConstPointer input = this->GetInput();

RegionType reqRegion = output->GetRequestedRegion();
SizeValueType pixelcount = reqRegion.GetNumberOfPixels();
SizeValueType xsize = reqRegion.GetSize()[0];
SizeValueType linecount = pixelcount / xsize;
const RegionType & reqRegion = output->GetRequestedRegion();
const SizeValueType pixelcount = reqRegion.GetNumberOfPixels();
const SizeValueType xsize = reqRegion.GetSize()[0];
const SizeValueType linecount = (xsize > 0 ? pixelcount / xsize : 0);

m_ForegroundLineMap.clear();
m_ForegroundLineMap.resize(linecount);
Expand All @@ -123,8 +123,8 @@ void
BinaryContourImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
const RegionType & outputRegionForThread)
{
OutputImagePointer output = this->GetOutput();
InputImageConstPointer input = this->GetInput();
OutputImageType * output = this->GetOutput();
const InputImageType * input = this->GetInput();

using InputLineIteratorType = ImageScanlineConstIterator<InputImageType>;
InputLineIteratorType inLineIt(input, outputRegionForThread);
Expand Down

0 comments on commit c2b399e

Please sign in to comment.