Skip to content

Commit

Permalink
BUG: Address bug with small size in output of SliceImageFilter
Browse files Browse the repository at this point in the history
The size of the output with a non-one step was being floored, instead
include an extra index if available. For example for a size of 5 and a
step of two the filter will now produce a size of 3.

Closes #1177.
  • Loading branch information
blowekamp authored and dzenanz committed Aug 23, 2019
1 parent 432dd1b commit 7aac4a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Modules/Filtering/ImageGrid/include/itkSliceImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ SliceImageFilter< TInputImage, TOutputImage >
if ( (m_Step[i] > 0 && stop > start) ||
( m_Step[i] < 0 && stop < start ) )
{
outputSize[i] = (stop-start)/m_Step[i];
outputSize[i] = (stop-start-Math::sgn(m_Step[i]))/m_Step[i];
outputSize[i] += 1u;
}
else
{
Expand Down

0 comments on commit 7aac4a6

Please sign in to comment.