diff --git a/Code/IO/otbMWImageIO.cxx b/Code/IO/otbMWImageIO.cxx index 868773dc511a1872f06f4205a82f65ce5ad5795d..acbee4fd41397528a14458109d1bfef76fa8a3cf 100644 --- a/Code/IO/otbMWImageIO.cxx +++ b/Code/IO/otbMWImageIO.cxx @@ -213,7 +213,10 @@ bool MWImageIO::InternalReadHeaderInformation(std::fstream & file, const bool re } else { - itkExceptionMacro(<< "MW : impossible to determine CodePix information of the image"); + if( reportError == true ) + { + itkExceptionMacro(<< "MW : impossible to determine CodePix information of the image"); + } return false; } diff --git a/Code/Visu/otbImageWidgetBase.txx b/Code/Visu/otbImageWidgetBase.txx index 26a4afb69f53d14adff3423bd168ac3bc4cfd88f..2f40d9147b6111fba95552933edafdd584fda6d3 100644 --- a/Code/Visu/otbImageWidgetBase.txx +++ b/Code/Visu/otbImageWidgetBase.txx @@ -506,6 +506,11 @@ namespace otb ImageWidgetBase<TPixel> ::RebuildOpenGlImageOverlayBuffer(void) { + if(m_ImageOverlay->GetNumberOfComponentsPerPixel()<3) + { + itkExceptionMacro(<<"Image overlay should have at least 3 channels."); + } + //otbMsgDebugMacro(<<"RebuildOpenGlImageOverlayBuffer"); if(m_OpenGlImageOverlayBuffer != NULL) {