Commit f6119e77 authored by Julien Michel's avatar Julien Michel

BUG: Fix bug #1963 by changing default requested region when completely...

BUG: Fix bug #1963 by changing default requested region when completely outside of input largest possible region
parent a01d7a5b
Pipeline #2584 failed with stages
in 69 minutes and 48 seconds
......@@ -232,21 +232,27 @@ StreamingWarpImageFilter<TInputImage, TOutputImage, TDisplacementField>
}
else
{
// In this case we need to generate an empty region compatible
// with cropping by input largest possible region.
inputFinalSize.Fill(0);
inputRequestedRegion.SetSize(inputFinalSize);
inputFinalIndex.Fill(0);
inputRequestedRegion.SetIndex(inputFinalIndex);
// store what we tried to request (prior to trying to crop)
inputPtr->SetRequestedRegion(inputRequestedRegion);
for(auto dim = 0U; dim < InputImageType::ImageDimension; ++dim)
{
if(inputPtr->GetLargestPossibleRegion().GetSize()[dim]>1)
{
inputFinalIndex[dim] = inputPtr->GetLargestPossibleRegion().GetIndex()[dim]+1;
inputFinalSize[dim] = 0;
}
else
{
inputFinalIndex[dim] = inputPtr->GetLargestPossibleRegion().GetIndex()[dim];
inputFinalSize[dim] = inputPtr->GetLargestPossibleRegion().GetSize()[dim];
}
}
// // build an exception
// itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
// e.SetLocation(ITK_LOCATION);
// e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
// e.SetDataObject(inputPtr);
// throw e;
inputRequestedRegion.SetSize(inputFinalSize);
inputRequestedRegion.SetIndex(inputFinalIndex);
inputPtr->SetRequestedRegion(inputRequestedRegion);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment