diff --git a/Code/IO/otbGDALImageIO.cxx b/Code/IO/otbGDALImageIO.cxx index be8f27c4052263a76e3b6af33bf8456de1eb0fb5..a24739689694c2638264d6ca0fbc1738ccfd1023 100755 --- a/Code/IO/otbGDALImageIO.cxx +++ b/Code/IO/otbGDALImageIO.cxx @@ -377,7 +377,7 @@ void GDALImageIO::InternalReadImageInformation() m_width = m_poDataset->GetRasterXSize(); m_height = m_poDataset->GetRasterYSize(); - if( (m_width==0) & (m_height==0)) + if( (m_width==0) || (m_height==0)) { itkExceptionMacro(<<"La dimension n'est pas définie."); } diff --git a/Testing/Code/Common/otbMultiChannelExtractROI.cxx b/Testing/Code/Common/otbMultiChannelExtractROI.cxx index 8a6a5d76f3a370a53ee59b5fabe626012cb4654b..0f4845ed74f46027d343cfc4d2f1b911fe2b7fe0 100755 --- a/Testing/Code/Common/otbMultiChannelExtractROI.cxx +++ b/Testing/Code/Common/otbMultiChannelExtractROI.cxx @@ -101,7 +101,8 @@ int generic_otbMultiChannelExtractROI( int argc, char * argv[], const char * inp typename WriterType::Pointer writer = WriterType::New(); reader->SetFileName( inputFilename ); - reader->Update(); //Necessaire pour connaitre le nombre de canaux dans l'image +//THOMAS +// reader->Update(); //Necessaire pour connaitre le nombre de canaux dans l'image writer->SetFileName( outputFilename ); extractROIFilter->SetInput( reader->GetOutput() ); extractROIFilter->Update(); @@ -118,6 +119,11 @@ int generic_otbMultiChannelExtractROI( int argc, char * argv[], const char * inp std::cout << err << std::endl; return EXIT_FAILURE; } + catch( std::bad_alloc & err ) + { + std::cout << "Exception bad_alloc : "<<(char*)err.what()<< std::endl; + return EXIT_FAILURE; + } catch( ... ) { std::cout << "Exception levee inconnue !" << std::endl; diff --git a/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx b/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx index c9d583cbe5da718f5077e38f5dac6e6f77987726..0a0f8ee8d65303f69af168191c78d6a5e2b87153 100755 --- a/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx +++ b/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx @@ -58,7 +58,8 @@ int generic_otbMultiToMonoChannelExtractROI ( int argc, char * argv[], const cha typename WriterType::Pointer writer = WriterType::New(); reader->SetFileName( inputFilename ); - reader->Update(); //Necessaire pour connaitre le nombre de canaux dans l'image +//THOMAS +// reader->Update(); //Necessaire pour connaitre le nombre de canaux dans l'image writer->SetFileName( outputFilename ); extractROIFilter->SetInput( reader->GetOutput() ); diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index aba396eb9b3fa018c67d86ce1ca3540d0310e6dd..5d776b6eb2b18700fa33053867608047f9ce2e8e 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -71,22 +71,6 @@ ADD_TEST(ioTvMultiMonoChannelROI_ENVI2PNG ${COMMON_TESTS} # ------- TEST IO COMMON ------------------------------ - -# ------- otb::CAIImageIO ------------------------------ -# CanRead() -# ADD_TEST(ioTuCAIImageIOCanReadBSQ ${IO_TESTS} otbCAIImageIOTestCanRead -# ${INPUTDATA}/poupees.hd ) - -# ADD_TEST(ioTuCAIImageIOCanReadSPOT4 ${IO_TESTS} otbCAIImageIOTestCanRead -# ${IMAGEDATA}/SPOT4_SCENE01 ) - -# ADD_TEST(ioTuCAIImageIOCanReadSPOT5TIF ${IO_TESTS} otbCAIImageIOTestCanRead -# ${INPUTDATA}/poupeesTIF ) - -# ADD_TEST(ioTuCAIImageIOCanReadSPOT5BIL ${IO_TESTS} otbCAIImageIOTestCanRead -# ${INPUTDATA}/poupeesBIL ) - - # ------- otb::GDALImageIO ------------------------------ # READER @@ -481,24 +465,25 @@ ADD_TEST(ioTvMultiChannelROI_IkonosNIR2PNG ${COMMON_TESTS} -channels 1) # --- Quickbird PAN --- -ADD_TEST(ioTvMultiChannelROI_QuickbirdPAN2PNG ${COMMON_TESTS} -# --compare-image ${TOL} ${BASELINE}/ioExtractROI_QuickbirdPAN2PNG_100_100_77_300.png -# ${TEMP}/ioExtractROI_QuickbirdPAN2PNG_100_100_77_300.png +ADD_TEST(ioTvMultiChannelROI_QuickbirdPAN2TIFF ${COMMON_TESTS} + --compare-image ${TOL} ${BASELINE}/ioExtractROI_QuickbirdPAN2TIFF_1000_1000_100_150.tif + ${TEMP}/ioExtractROI_QuickbirdPAN2TIFF_1000_1000_100_150.tif otbMultiChannelExtractROI - ${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF - ${TEMP}/ioExtractROI_QuickbirdXS2PNG_100_100_77_300.png - -startX 100 -startY 100 -sizeX 77 -sizeY 300 - -channels 1 2 3) + -ushort ${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF + -ushort ${TEMP}/ioExtractROI_QuickbirdPAN2TIFF_1000_1000_100_150.tif + -startX 1000 -startY 1000 -sizeX 100 -sizeY 150 + ) # --- Quickbird XS --- -ADD_TEST(ioTvMultiChannelROI_QuickbirdXS2PNG ${COMMON_TESTS} -# --compare-image ${TOL} ${BASELINE}/ioExtractROI_QuickbirdXS2PNG_100_100_77_300.png -# ${TEMP}/ioExtractROI_QuickbirdXS2PNG_100_100_77_300.png +ADD_TEST(ioTvMultiChannelROI_QuickbirdXS2TIFF ${COMMON_TESTS} + --compare-image ${TOL} ${BASELINE}/ioExtractROI_QuickbirdXS2TIFF_1000_1000_100_150.tif + ${TEMP}/ioExtractROI_QuickbirdXS2TIFF_1000_1000_100_150.tif otbMultiChannelExtractROI - ${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF - ${TEMP}/ioExtractROI_QuickbirdXS2PNG_100_100_77_300.png - -startX 100 -startY 100 -sizeX 77 -sizeY 300 - -channels 1 2 3) + -ushort ${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF + -ushort ${TEMP}/ioExtractROI_QuickbirdXS2TIFF_1000_1000_100_150.tif + -startX 1000 -startY 1000 -sizeX 100 -sizeY 150 + ) +# -channels 1 2 3) ADD_TEST(ioTuOtbImageTestSAR_ERS ${IO_TESTS} --compare-ascii ${BASELINE_FILES}/ioOtbImageTestSAR_ERS.txt @@ -534,9 +519,10 @@ ADD_TEST(ioTuOtbVectorImageTestSpot5 ${IO_TESTS} -# --- STREAMING : CAI --- +# --- STREAMING : GDAL --- ADD_TEST(ioTvStreamingImageFilterGDAL_ENVI ${IO_TESTS} - --compare-image ${TOL} ${TEMP}/ioStreamingImageFilterTestCDAL_ENVI.png +# --compare-image ${TOL} ${TEMP}/ioStreamingImageFilterTestCDAL_ENVI.png + --compare-image ${TOL} ${INPUTDATA}/poupees_1canal.c1.hdr ${TEMP}/ioStreamingImageFilterTestCDAL_ENVI.png otbStreamingImageFilterTest ${INPUTDATA}/poupees_1canal.c1.hdr @@ -555,8 +541,6 @@ ADD_TEST(ioTvStreamingImageFilterGDAL_TIFF ${IO_TESTS} # --- STREAMING IMAGE FILE WRITER --- ADD_TEST(ioTvStreamingIFWriterBSQWithoutStreaming ${IO_TESTS} -# --compare-binary ${INPUTDATA}/poupees_1canal.c1 -# ${TEMP}/ioStreamingImageFileWriterBSQWithoutStreaming.c1 --compare-image ${TOL} ${INPUTDATA}/poupees_1canal.c1.hdr ${TEMP}/ioStreamingImageFileWriterBSQWithoutStreaming.hdr otbStreamingImageFileWriterTest @@ -566,8 +550,6 @@ ADD_TEST(ioTvStreamingIFWriterBSQWithoutStreaming ${IO_TESTS} ) # --- STREAMING IMAGE FILE WRITER --- ADD_TEST(ioTvStreamingIFWriterBSQWithStreaming ${IO_TESTS} -# --compare-binary ${INPUTDATA}/poupees_1canal.c1 -# ${TEMP}/ioStreamingImageFileWriterBSQWithStreaming_100.c1 --compare-image ${TOL} ${INPUTDATA}/poupees_1canal.c1.hdr ${TEMP}/ioStreamingImageFileWriterBSQWithStreaming_100.hdr otbStreamingImageFileWriterTest