Skip to content

Commit 4c6220c

Browse files
committed
BUG: Adding of a missing condition in order to remove the run smaller than the minimum run length specified by the user
1 parent dc42b84 commit 4c6220c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/itkRunLengthTextureFeaturesImageFilter.hxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
266266
}
267267
}
268268
// Increase the corresponding bin in the histogram
269+
269270
this->IncreaseHistogram(histogram, totalNumberOfRuns,
270-
currentInNeighborhoodPixelIntensity,
271-
offset, pixelDistance);
271+
currentInNeighborhoodPixelIntensity,
272+
offset, pixelDistance);
273+
272274
}
273275
}
274276
// Compute the run length features
@@ -283,9 +285,9 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
283285

284286
for(unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis)
285287
{
286-
delete histogram[axis];
288+
delete[] histogram[axis];
287289
}
288-
delete histogram;
290+
delete[] histogram;
289291
}
290292

291293
template<typename TInputImage, typename TOutputImage>
@@ -405,11 +407,9 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
405407
offsetDistance += (offset[i]*m_Spacing[i])*(offset[i]*m_Spacing[i]);
406408
}
407409
offsetDistance = std::sqrt(offsetDistance);
408-
409410
int offsetDistanceBin = static_cast< int>(( offsetDistance*pixelDistance - m_MinDistance)/
410411
( (m_MaxDistance - m_MinDistance) / (float)m_NumberOfBinsPerAxis ));
411-
412-
if (offsetDistanceBin < static_cast< int >( m_NumberOfBinsPerAxis ))
412+
if (offsetDistanceBin < static_cast< int >( m_NumberOfBinsPerAxis ) && offsetDistanceBin >= 0)
413413
{
414414
++totalNumberOfRuns;
415415
++histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin];

0 commit comments

Comments
 (0)