diff --git a/Code/Common/otbExtractROIBase.txx b/Code/Common/otbExtractROIBase.txx index 874ed0e56b19a858f8ceff3a185b9c30b4e62af0..7c758fbdd8da40dc69120c8afa5ba46002311dcb 100755 --- a/Code/Common/otbExtractROIBase.txx +++ b/Code/Common/otbExtractROIBase.txx @@ -129,16 +129,16 @@ ExtractROIBase<TInputImage,TOutputImage> // Recupere Region de l'image d'entree const InputImageRegionType& inputRegion = inputPtr->GetRequestedRegion(); - if ( m_SizeX == 0 ) + if ( (m_SizeX == 0) || (m_SizeX > (inputRegion.GetSize()[0] - m_StartX)) ) { m_SizeX = inputRegion.GetSize()[0] - m_StartX; } - if ( m_SizeY == 0 ) + if ( m_SizeY == 0 || (m_SizeY > (inputRegion.GetSize()[1] - m_StartY)) ) { m_SizeY = inputRegion.GetSize()[1] - m_StartY; } - + //std::cout <<"m_Start "<<m_StartX<<" "<<m_StartY<<" m_Size "<<m_SizeX <<" "<<m_SizeY<<" "<<inputRegion.GetSize()[1] <<" "<<inputRegion.GetSize()[0]<<std::endl; InputImageIndexType start;