Commit bed47153 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: protection against different mask and image sizes

parent ab25bb11
......@@ -19,6 +19,7 @@
#define otbMaskedIteratorDecorator_hxx
#include "otbMaskedIteratorDecorator.h"
#include "otbMacro.h"
namespace otb
{
......@@ -36,10 +37,18 @@ MaskedIteratorDecorator<TIteratorType,TMaskIteratorType>
}
else
{
m_UseMask = true;
m_ItMask = TMaskIteratorType(mask,region);
m_StartMask = TMaskIteratorType(mask,region);
m_StartImage = TIteratorType(image,region);
if (image->GetLargestPossibleRegion() != mask->GetLargestPossibleRegion())
{
m_UseMask = false;
otbWarningMacro("Input image and mask have different largest regions : mask is discarded!");
}
else
{
m_UseMask = true;
m_ItMask = TMaskIteratorType(mask,region);
m_StartMask = TMaskIteratorType(mask,region);
m_StartImage = TIteratorType(image,region);
}
}
}
......
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