From 0974bb3e1e24619fa2d99cba5809ba2a25d45693 Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Tue, 9 Sep 2008 11:09:43 +0000 Subject: [PATCH] STYLE : try/catch blocs supression in IO testing. --- Testing/Code/IO/otbBSQImageIOTestCanRead.cxx | 34 +- Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx | 34 +- Testing/Code/IO/otbCAIImageIOTestCanRead.cxx | 35 +- Testing/Code/IO/otbCAIImageIOTestCanWrite.cxx | 34 +- Testing/Code/IO/otbDEMHandlerNew.cxx | 36 +- Testing/Code/IO/otbDEMHandlerTest.cxx | 81 ++- Testing/Code/IO/otbDEMToImageGeneratorNew.cxx | 36 +- .../Code/IO/otbDEMToImageGeneratorTest.cxx | 26 +- .../otbDXFToSpatialObjectGroupFilterNew.cxx | 36 +- Testing/Code/IO/otbDoubleImageIOTest.cxx | 63 +-- Testing/Code/IO/otbFloatImageIOTest.cxx | 63 +-- Testing/Code/IO/otbGDALImageIOTestCanRead.cxx | 35 +- .../Code/IO/otbGDALImageIOTestCanWrite.cxx | 34 +- Testing/Code/IO/otbIOTests1.cxx | 6 +- Testing/Code/IO/otbIOTests10.cxx | 6 +- Testing/Code/IO/otbIOTests11.cxx | 6 +- Testing/Code/IO/otbIOTests12.cxx | 6 +- Testing/Code/IO/otbIOTests13.cxx | 6 +- Testing/Code/IO/otbIOTests14.cxx | 6 +- Testing/Code/IO/otbIOTests15.cxx | 6 +- Testing/Code/IO/otbIOTests2.cxx | 6 +- Testing/Code/IO/otbIOTests3.cxx | 6 +- Testing/Code/IO/otbIOTests4.cxx | 6 +- Testing/Code/IO/otbIOTests5.cxx | 6 +- Testing/Code/IO/otbIOTests6.cxx | 6 +- Testing/Code/IO/otbIOTests7.cxx | 6 +- Testing/Code/IO/otbIOTests8.cxx | 6 +- Testing/Code/IO/otbIOTests9.cxx | 8 +- Testing/Code/IO/otbImageFileReaderERS.cxx | 71 +-- Testing/Code/IO/otbImageFileReaderMSTAR.cxx | 36 +- Testing/Code/IO/otbImageFileReaderONERA.cxx | 77 ++- .../IO/otbImageFileReaderONERAComplex.cxx | 95 ++-- Testing/Code/IO/otbImageFileReaderRGBTest.cxx | 53 +- Testing/Code/IO/otbImageFileReaderTest.cxx | 53 +- .../IO/otbImageFileWriterONERAComplex.cxx | 74 ++- Testing/Code/IO/otbImageFileWriterRGBTest.cxx | 53 +- ...tbImageFileWriterStreamingONERAComplex.cxx | 81 ++- Testing/Code/IO/otbImageFileWriterTest.cxx | 53 +- .../Code/IO/otbImageGeometryHandlerNew.cxx | 27 +- Testing/Code/IO/otbImageIOFactoryTest.cxx | 22 +- .../IO/otbImageMetadataFileWriterTest.cxx | 53 +- ...tbImageMetadataStreamingFileWriterTest.cxx | 53 +- Testing/Code/IO/otbImageTest.cxx | 164 +++---- Testing/Code/IO/otbIntImageIOTest.cxx | 53 +- .../Code/IO/otbJPEG2000ImageIOTestCanRead.cxx | 24 +- .../IO/otbJPEG2000ImageIOTestCanWrite.cxx | 27 +- Testing/Code/IO/otbLUMImageIOTestCanRead.cxx | 29 +- Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx | 29 +- .../Code/IO/otbMSTARImageIOTestCanRead.cxx | 28 +- .../IO/otbMultiToMonoChannelExtractROISAR.cxx | 84 ++-- Testing/Code/IO/otbOGRDriverTest.cxx | 463 +++++++++--------- .../Code/IO/otbONERAImageIOTestCanRead.cxx | 28 +- .../IO/otbOSSIMImageMetaDataReaderTest.cxx | 133 +++-- Testing/Code/IO/otbOssimElevManagerTest.cxx | 18 + .../IO/otbPipelineMetadataHandlingTest.cxx | 64 +-- ...pelineMetadataHandlingWithUFFilterTest.cxx | 63 +-- Testing/Code/IO/otbSHPVectorDataIONew.cxx | 3 +- Testing/Code/IO/otbShortImageIOTest.cxx | 57 +-- Testing/Code/IO/otbShortRGBImageIOTest.cxx | 57 +-- Testing/Code/IO/otbSpatialObjectDXFReader.cxx | 180 ++++--- .../Code/IO/otbSpatialObjectDXFReaderNew.cxx | 29 +- .../IO/otbStreamingImageFileWriterTest.cxx | 94 ++-- ...leWriterTestCalculateNumberOfDivisions.cxx | 146 +++--- ...StreamingImageFileWriterWithFilterTest.cxx | 106 ++-- .../Code/IO/otbStreamingImageFilterTest.cxx | 66 +-- .../otbStreamingShortImageFileWriterTest.cxx | 104 ++-- Testing/Code/IO/otbVectorDataFileReader.cxx | 2 +- .../Code/IO/otbVectorDataFileReaderNew.cxx | 8 +- Testing/Code/IO/otbVectorDataSourceNew.cxx | 7 +- .../IO/otbVectorImageFileReaderWriterTest.cxx | 66 +-- Testing/Code/IO/otbVectorImageTest.cxx | 168 +++---- 71 files changed, 1539 insertions(+), 2201 deletions(-) diff --git a/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx b/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx index a5ef18f872..d5cebe0115 100644 --- a/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,27 +26,13 @@ int otbBSQImageIOTestCanRead(int argc, char* argv[]) { - try - { - otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); - bool lCanRead = lBSQImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::BSQImageIO : impossible d'ouvrir l'image BSQ "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); + bool lCanRead = lBSQImageIO->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::BSQImageIO : impossible d'ouvrir l'image BSQ "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx b/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx index 8791182009..fb45b9dcb9 100644 --- a/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,27 +26,13 @@ int otbBSQImageIOTestCanWrite(int argc, char* argv[]) { - try - { - otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); - bool lCanRead = lBSQImageIO->CanWriteFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::L'image "<<argv[1]<<" n'est pas une image BSQ."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); + bool lCanRead = lBSQImageIO->CanWriteFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::L'image "<<argv[1]<<" n'est pas une image BSQ."<<std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbCAIImageIOTestCanRead.cxx b/Testing/Code/IO/otbCAIImageIOTestCanRead.cxx index d7c333a154..d11e489721 100755 --- a/Testing/Code/IO/otbCAIImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbCAIImageIOTestCanRead.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,27 +26,14 @@ int otbCAIImageIOTestCanRead(int argc, char* argv[]) { - try - { - otb::CAIImageIO::Pointer lCAIImageIO = otb::CAIImageIO::New(); - bool lCanRead = lCAIImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::CAIImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::CAIImageIO::Pointer lCAIImageIO = otb::CAIImageIO::New(); + bool lCanRead = lCAIImageIO->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::CAIImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbCAIImageIOTestCanWrite.cxx b/Testing/Code/IO/otbCAIImageIOTestCanWrite.cxx index 14d5855428..7ce99dc224 100755 --- a/Testing/Code/IO/otbCAIImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbCAIImageIOTestCanWrite.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,27 +26,13 @@ int otbCAIImageIOTestCanWrite(int argc, char* argv[]) { - try - { - otb::CAIImageIO::Pointer lCAIImageIO = otb::CAIImageIO::New(); - bool lCanRead = lCAIImageIO->CanWriteFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::CAIImageIO : impossible de creer l'image "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::CAIImageIO::Pointer lCAIImageIO = otb::CAIImageIO::New(); + bool lCanRead = lCAIImageIO->CanWriteFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::CAIImageIO : impossible de creer l'image "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMHandlerNew.cxx b/Testing/Code/IO/otbDEMHandlerNew.cxx index db4023639e..28de2e4c2d 100644 --- a/Testing/Code/IO/otbDEMHandlerNew.cxx +++ b/Testing/Code/IO/otbDEMHandlerNew.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkExceptionObject.h" @@ -22,27 +22,13 @@ int otbDEMHandlerNew(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef otb::Image<unsigned char,Dimension> ImageType; - typedef otb::DEMHandler DEMHandlerType; - - // Instantiating object - DEMHandlerType::Pointer object = DEMHandlerType::New(); - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } + const unsigned int Dimension = 2; + typedef otb::Image<unsigned char,Dimension> ImageType; + typedef otb::DEMHandler DEMHandlerType; + + // Instantiating object + DEMHandlerType::Pointer object = DEMHandlerType::New(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMHandlerTest.cxx b/Testing/Code/IO/otbDEMHandlerTest.cxx index c5482dca83..c18bfbb3e4 100644 --- a/Testing/Code/IO/otbDEMHandlerTest.cxx +++ b/Testing/Code/IO/otbDEMHandlerTest.cxx @@ -9,10 +9,10 @@ Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkExceptionObject.h" @@ -25,50 +25,35 @@ int otbDEMHandlerTest(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - char * srtm_directory(argv[1]); - const char * outputfilename(argv[2]); - double height(0.); - - typedef otb::Image<float,Dimension> ImageType; - typedef otb::DEMHandler DEMHandlerType; - - // Instantiating object - DEMHandlerType::Pointer demHandler = DEMHandlerType::New(); - demHandler->OpenDEMDirectory(srtm_directory); - - typedef otb::UtmInverseProjection utmProjection; - typedef utmProjection::InputPointType InputPoint; - InputPoint geoPoint; - geoPoint[0] = atof(argv[3]);//3.6999; - geoPoint[1] = atof(argv[4]);//44.08; - - height=demHandler->GetHeightAboveMSL(geoPoint); - - std::ofstream file; - file.open(outputfilename); - file << "--- HEIGHT ABOVE MSL TEST ---" << std::endl; - file << " geoPoint: "<<geoPoint[1]<<" ; "<<geoPoint[0]<< std::endl; - file << " -> Height: "<<height<< std::endl; - file.close(); - - std::cout << "Height: "<<height<<std::endl; - - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } + const unsigned int Dimension = 2; + char * srtm_directory(argv[1]); + const char * outputfilename(argv[2]); + double height(0.); + + typedef otb::Image<float,Dimension> ImageType; + typedef otb::DEMHandler DEMHandlerType; + + // Instantiating object + DEMHandlerType::Pointer demHandler = DEMHandlerType::New(); + demHandler->OpenDEMDirectory(srtm_directory); + + typedef otb::UtmInverseProjection utmProjection; + typedef utmProjection::InputPointType InputPoint; + InputPoint geoPoint; + geoPoint[0] = atof(argv[3]);//3.6999; + geoPoint[1] = atof(argv[4]);//44.08; + + height=demHandler->GetHeightAboveMSL(geoPoint); + + std::ofstream file; + file.open(outputfilename); + file << "--- HEIGHT ABOVE MSL TEST ---" << std::endl; + file << " geoPoint: "<<geoPoint[1]<<" ; "<<geoPoint[0]<< std::endl; + file << " -> Height: "<<height<< std::endl; + file.close(); + + std::cout << "Height: "<<height<<std::endl; + - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx b/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx index 025b8e5bbd..af206c5208 100644 --- a/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx +++ b/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkExceptionObject.h" @@ -22,27 +22,13 @@ int otbDEMToImageGeneratorNew(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef otb::Image<unsigned char,Dimension> ImageType; - typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; - - // Instantiating object - DEMToImageGeneratorType::Pointer object = DEMToImageGeneratorType::New(); - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } + const unsigned int Dimension = 2; + typedef otb::Image<unsigned char,Dimension> ImageType; + typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; + + // Instantiating object + DEMToImageGeneratorType::Pointer object = DEMToImageGeneratorType::New(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx b/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx index 825e36a6f2..710a4e44b9 100644 --- a/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx +++ b/Testing/Code/IO/otbDEMToImageGeneratorTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkExceptionObject.h" @@ -65,22 +65,8 @@ int otbDEMToImageGeneratorTest(int argc, char * argv[]) writer->SetFileName( outputName ); writer->SetInput( object->GetOutput() ); - try - { - writer->Update(); - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } + writer->Update(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx b/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx index dd4f4c684d..868b1f5a9a 100644 --- a/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx +++ b/Testing/Code/IO/otbDXFToSpatialObjectGroupFilterNew.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkExceptionObject.h" @@ -22,27 +22,13 @@ int otbDXFToSpatialObjectGroupFilterNew(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef itk::GroupSpatialObject<Dimension> GroupType; - typedef otb::DXFToSpatialObjectGroupFilter<GroupType> DXFToSpatialObjectGroupFilterType; - - // Instantiating object - DXFToSpatialObjectGroupFilterType::Pointer object = DXFToSpatialObjectGroupFilterType::New(); - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } + const unsigned int Dimension = 2; + typedef itk::GroupSpatialObject<Dimension> GroupType; + typedef otb::DXFToSpatialObjectGroupFilter<GroupType> DXFToSpatialObjectGroupFilterType; + + // Instantiating object + DXFToSpatialObjectGroupFilterType::Pointer object = DXFToSpatialObjectGroupFilterType::New(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbDoubleImageIOTest.cxx b/Testing/Code/IO/otbDoubleImageIOTest.cxx index bd5a5f3c23..c8a0ee9f13 100644 --- a/Testing/Code/IO/otbDoubleImageIOTest.cxx +++ b/Testing/Code/IO/otbDoubleImageIOTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,42 +29,29 @@ int otbDoubleImageIOTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + writer->SetInput( reader->GetOutput() ); + writer->Update(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbFloatImageIOTest.cxx b/Testing/Code/IO/otbFloatImageIOTest.cxx index d99a5a90c8..85f91d3c45 100644 --- a/Testing/Code/IO/otbFloatImageIOTest.cxx +++ b/Testing/Code/IO/otbFloatImageIOTest.cxx @@ -9,10 +9,10 @@ Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,42 +29,29 @@ int otbFloatImageIOTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef float InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + typedef float InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx b/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx index eaddedcebe..c374c1e4e9 100755 --- a/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,27 +26,14 @@ int otbGDALImageIOTestCanRead(int argc, char* argv[]) { - try - { - otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); - bool lCanRead = lGDALImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::GDALImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); + bool lCanRead = lGDALImageIO->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::GDALImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx b/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx index b7ed87b34c..7900f7e058 100644 --- a/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,27 +26,13 @@ int otbGDALImageIOTestCanWrite(int argc, char* argv[]) { - try - { - otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); - bool lCanWrite = lGDALImageIO->CanWriteFile(argv[1]); - if ( lCanWrite == false) - { - std::cerr << "Erreur otb::GDALImageIO : impossible d'ecrire l'image "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); + bool lCanWrite = lGDALImageIO->CanWriteFile(argv[1]); + if ( lCanWrite == false) + { + std::cerr << "Erreur otb::GDALImageIO : impossible d'ecrire l'image "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbIOTests1.cxx b/Testing/Code/IO/otbIOTests1.cxx index 4d7f46ac9b..0213061b2d 100755 --- a/Testing/Code/IO/otbIOTests1.cxx +++ b/Testing/Code/IO/otbIOTests1.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests10.cxx b/Testing/Code/IO/otbIOTests10.cxx index 66c0cccbf0..557a1706cc 100644 --- a/Testing/Code/IO/otbIOTests10.cxx +++ b/Testing/Code/IO/otbIOTests10.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests11.cxx b/Testing/Code/IO/otbIOTests11.cxx index e84129e481..f3915d2e0b 100644 --- a/Testing/Code/IO/otbIOTests11.cxx +++ b/Testing/Code/IO/otbIOTests11.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests12.cxx b/Testing/Code/IO/otbIOTests12.cxx index a616e0e9a3..bca02b57cf 100644 --- a/Testing/Code/IO/otbIOTests12.cxx +++ b/Testing/Code/IO/otbIOTests12.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests13.cxx b/Testing/Code/IO/otbIOTests13.cxx index 0967954cd6..d29e4a4be1 100644 --- a/Testing/Code/IO/otbIOTests13.cxx +++ b/Testing/Code/IO/otbIOTests13.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests14.cxx b/Testing/Code/IO/otbIOTests14.cxx index c6a947fbdd..f94e9ed240 100644 --- a/Testing/Code/IO/otbIOTests14.cxx +++ b/Testing/Code/IO/otbIOTests14.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests15.cxx b/Testing/Code/IO/otbIOTests15.cxx index b40278c98d..a9424c1830 100755 --- a/Testing/Code/IO/otbIOTests15.cxx +++ b/Testing/Code/IO/otbIOTests15.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests2.cxx b/Testing/Code/IO/otbIOTests2.cxx index 380a7da6aa..b86a515df3 100755 --- a/Testing/Code/IO/otbIOTests2.cxx +++ b/Testing/Code/IO/otbIOTests2.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests3.cxx b/Testing/Code/IO/otbIOTests3.cxx index 15c43b057a..27086876a3 100755 --- a/Testing/Code/IO/otbIOTests3.cxx +++ b/Testing/Code/IO/otbIOTests3.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests4.cxx b/Testing/Code/IO/otbIOTests4.cxx index 23a8f14819..70ff9d0f68 100755 --- a/Testing/Code/IO/otbIOTests4.cxx +++ b/Testing/Code/IO/otbIOTests4.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests5.cxx b/Testing/Code/IO/otbIOTests5.cxx index a7afedcaed..944be6f619 100644 --- a/Testing/Code/IO/otbIOTests5.cxx +++ b/Testing/Code/IO/otbIOTests5.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests6.cxx b/Testing/Code/IO/otbIOTests6.cxx index 0e8687b066..650b5da5a5 100644 --- a/Testing/Code/IO/otbIOTests6.cxx +++ b/Testing/Code/IO/otbIOTests6.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests7.cxx b/Testing/Code/IO/otbIOTests7.cxx index db28b5847e..d9d4a40086 100644 --- a/Testing/Code/IO/otbIOTests7.cxx +++ b/Testing/Code/IO/otbIOTests7.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests8.cxx b/Testing/Code/IO/otbIOTests8.cxx index ad591fc3f7..3a9f9e9d07 100644 --- a/Testing/Code/IO/otbIOTests8.cxx +++ b/Testing/Code/IO/otbIOTests8.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ diff --git a/Testing/Code/IO/otbIOTests9.cxx b/Testing/Code/IO/otbIOTests9.cxx index 76f3307e8c..1dcb06c2c0 100644 --- a/Testing/Code/IO/otbIOTests9.cxx +++ b/Testing/Code/IO/otbIOTests9.cxx @@ -10,10 +10,10 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + =========================================================================*/ // this file defines the otbCommonTest for the test driver diff --git a/Testing/Code/IO/otbImageFileReaderERS.cxx b/Testing/Code/IO/otbImageFileReaderERS.cxx index d8c2aa70b2..e2a80510b4 100644 --- a/Testing/Code/IO/otbImageFileReaderERS.cxx +++ b/Testing/Code/IO/otbImageFileReaderERS.cxx @@ -31,63 +31,44 @@ int otbImageFileReaderERS(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef unsigned short OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef unsigned short OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer complexReader = ReaderType::New(); + ReaderType::Pointer complexReader = ReaderType::New(); - complexReader->SetFileName( inputFilename ); + complexReader->SetFileName( inputFilename ); - typedef otb::MultiChannelExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::MultiChannelExtractROI< InputPixelType, + OutputPixelType > ExtractROIFilterType; - ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); + ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( complexReader->GetOutput() ); + extractROIFilter->SetStartX( 10 ); + extractROIFilter->SetStartY( 10 ); + extractROIFilter->SetSizeX( 100 ); + extractROIFilter->SetSizeY( 100 ); + extractROIFilter->SetSizeY( 100 ); + extractROIFilter->SetInput( complexReader->GetOutput() ); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( extractROIFilter->GetOutput() ); - writer->Update(); + writer->SetFileName( outputFilename ); + writer->SetInput( extractROIFilter->GetOutput() ); + writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << 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::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileReaderMSTAR.cxx b/Testing/Code/IO/otbImageFileReaderMSTAR.cxx index 78041136e1..ac770f493a 100755 --- a/Testing/Code/IO/otbImageFileReaderMSTAR.cxx +++ b/Testing/Code/IO/otbImageFileReaderMSTAR.cxx @@ -1,3 +1,21 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbVectorImage.h" @@ -12,9 +30,6 @@ int otbImageFileReaderMSTAR(int argc, char* argv[]) { - try - { - typedef float InputPixelType; typedef unsigned char OutputPixelType; const unsigned int InputDimension = 2; @@ -105,19 +120,6 @@ int otbImageFileReaderMSTAR(int argc, char* argv[]) writer->SetFileName( argv[2] ); writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileReaderONERA.cxx b/Testing/Code/IO/otbImageFileReaderONERA.cxx index a777934d59..50d7d0a25f 100644 --- a/Testing/Code/IO/otbImageFileReaderONERA.cxx +++ b/Testing/Code/IO/otbImageFileReaderONERA.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -30,60 +30,41 @@ int otbImageFileReaderONERATest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef float InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; + typedef float InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer Reader = ReaderType::New(); + ReaderType::Pointer Reader = ReaderType::New(); - typedef otb::MultiChannelExtractROI< OutputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::MultiChannelExtractROI< OutputPixelType, + OutputPixelType > ExtractROIFilterType; - ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); + ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( Reader->GetOutput() ); + extractROIFilter->SetStartX( 10 ); + extractROIFilter->SetStartY( 10 ); + extractROIFilter->SetSizeX( 100 ); + extractROIFilter->SetSizeY( 100 ); + extractROIFilter->SetInput( Reader->GetOutput() ); - WriterType::Pointer writer = WriterType::New(); + WriterType::Pointer writer = WriterType::New(); - Reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - writer->SetInput( extractROIFilter->GetOutput() ); - writer->Update(); - - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << 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::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - + Reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + writer->SetInput( extractROIFilter->GetOutput() ); + writer->Update(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx b/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx index 1da2323f4b..5fe1aa077b 100644 --- a/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx +++ b/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -31,69 +31,56 @@ int otbImageFileReaderONERAComplex(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputRealFilename = argv[2]; - const char * outputImagFilename = argv[3]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputRealFilename = argv[2]; + const char * outputImagFilename = argv[3]; - typedef std::complex<float> InputPixelType; - typedef float OutputPixelType; - const unsigned int Dimension = 2; + typedef std::complex<float> InputPixelType; + typedef float OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer Reader = ReaderType::New(); + ReaderType::Pointer Reader = ReaderType::New(); - Reader->SetFileName( inputFilename ); + Reader->SetFileName( inputFilename ); - typedef otb::ExtractROI< InputPixelType, - InputPixelType > ExtractROIFilterType; + typedef otb::ExtractROI< InputPixelType, + InputPixelType > ExtractROIFilterType; - ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); + ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( Reader->GetOutput() ); + extractROIFilter->SetStartX( 10 ); + extractROIFilter->SetStartY( 10 ); + extractROIFilter->SetSizeX( 100 ); + extractROIFilter->SetSizeY( 100 ); + extractROIFilter->SetInput( Reader->GetOutput() ); - typedef itk::ComplexToRealImageFilter< - InputImageType, OutputImageType > RealFilterType; - typedef itk::ComplexToImaginaryImageFilter< - InputImageType, OutputImageType > ImagFilterType; + typedef itk::ComplexToRealImageFilter< + InputImageType, OutputImageType > RealFilterType; + typedef itk::ComplexToImaginaryImageFilter< + InputImageType, OutputImageType > ImagFilterType; - RealFilterType::Pointer realFilter = RealFilterType::New(); - realFilter->SetInput( extractROIFilter->GetOutput() ); - ImagFilterType::Pointer imagFilter = ImagFilterType::New(); - imagFilter->SetInput( extractROIFilter->GetOutput() ); + RealFilterType::Pointer realFilter = RealFilterType::New(); + realFilter->SetInput( extractROIFilter->GetOutput() ); + ImagFilterType::Pointer imagFilter = ImagFilterType::New(); + imagFilter->SetInput( extractROIFilter->GetOutput() ); - WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputRealFilename ); - writer->SetInput( realFilter->GetOutput() ); - writer->Update(); - writer = WriterType::New(); - writer->SetFileName( outputImagFilename ); - writer->SetInput( imagFilter->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Catch ITK Exception in OTB " << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "catch OTB Exception !" << std::endl; - return EXIT_FAILURE; - } + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName( outputRealFilename ); + writer->SetInput( realFilter->GetOutput() ); + writer->Update(); + writer = WriterType::New(); + writer->SetFileName( outputImagFilename ); + writer->SetInput( imagFilter->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileReaderRGBTest.cxx b/Testing/Code/IO/otbImageFileReaderRGBTest.cxx index 460a4606ec..9f911c2490 100755 --- a/Testing/Code/IO/otbImageFileReaderRGBTest.cxx +++ b/Testing/Code/IO/otbImageFileReaderRGBTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -31,42 +31,29 @@ int otbImageFileReaderRGBTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef itk::RGBPixel<unsigned char> InputPixelType; - typedef itk::RGBPixel<unsigned char> OutputPixelType; - const unsigned int Dimension = 2; + typedef itk::RGBPixel<unsigned char> InputPixelType; + typedef itk::RGBPixel<unsigned char> OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileReaderTest.cxx b/Testing/Code/IO/otbImageFileReaderTest.cxx index b55ba4a6f7..c34db0c945 100755 --- a/Testing/Code/IO/otbImageFileReaderTest.cxx +++ b/Testing/Code/IO/otbImageFileReaderTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,42 +29,29 @@ int otbImageFileReaderTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx b/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx index eababa57c8..a7684bb43f 100644 --- a/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx +++ b/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,58 +29,40 @@ int otbImageFileWriterONERAComplex(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef std::complex<float> PixelType; - const unsigned int Dimension = 2; + typedef std::complex<float> PixelType; + const unsigned int Dimension = 2; - typedef otb::Image< PixelType, Dimension > ImageType; + typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::ImageFileWriter< ImageType > WriterType; + typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::ImageFileWriter< ImageType > WriterType; - ReaderType::Pointer complexReader = ReaderType::New(); + ReaderType::Pointer complexReader = ReaderType::New(); - complexReader->SetFileName( inputFilename ); + complexReader->SetFileName( inputFilename ); - typedef otb::ExtractROI< PixelType, - PixelType > ExtractROIFilterType; + typedef otb::ExtractROI< PixelType, + PixelType > ExtractROIFilterType; - ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); + ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 20 ); - extractROIFilter->SetStartY( 20 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); - extractROIFilter->SetInput( complexReader->GetOutput() ); - extractROIFilter->Update(); + extractROIFilter->SetStartX( 20 ); + extractROIFilter->SetStartY( 20 ); + extractROIFilter->SetSizeX( 100 ); + extractROIFilter->SetSizeY( 100 ); + extractROIFilter->SetInput( complexReader->GetOutput() ); + extractROIFilter->Update(); - WriterType::Pointer complexWriter = WriterType::New(); - complexWriter->SetFileName( outputFilename ); - complexWriter->SetInput( extractROIFilter->GetOutput() ); - complexWriter->Update(); - - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << 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::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + WriterType::Pointer complexWriter = WriterType::New(); + complexWriter->SetFileName( outputFilename ); + complexWriter->SetInput( extractROIFilter->GetOutput() ); + complexWriter->Update(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileWriterRGBTest.cxx b/Testing/Code/IO/otbImageFileWriterRGBTest.cxx index e34d78b01f..d2acf743b9 100755 --- a/Testing/Code/IO/otbImageFileWriterRGBTest.cxx +++ b/Testing/Code/IO/otbImageFileWriterRGBTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -30,42 +30,29 @@ int otbImageFileWriterRGBTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef itk::RGBPixel<unsigned char> InputPixelType; - typedef itk::RGBPixel<unsigned char> OutputPixelType; - const unsigned int Dimension = 2; + typedef itk::RGBPixel<unsigned char> InputPixelType; + typedef itk::RGBPixel<unsigned char> OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image< InputPixelType, Dimension > InputImageType; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx b/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx index 9fd2e3bdff..d713a176f4 100644 --- a/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx +++ b/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -30,53 +30,34 @@ int otbImageFileWriterStreamingONERAComplex(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef std::complex<float> PixelType; - const unsigned int Dimension = 2; - - typedef otb::Image<PixelType, Dimension > ImageType; - - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::StreamingImageFileWriter< ImageType > WriterType; -/* typedef itk::StreamingImageFilter< ImageType, - ImageType > StreamingType;*/ - - ReaderType::Pointer complexReader = ReaderType::New(); - complexReader->SetFileName( inputFilename ); - -/* StreamingType::Pointer streaming = StreamingType::New(); - streaming->SetNumberOfStreamDivisions(100); - streaming->SetInput(complexReader->GetOutput()); -*/ - WriterType::Pointer complexWriter = WriterType::New(); - complexWriter->SetNumberOfStreamDivisions(100); - complexWriter->SetFileName( outputFilename ); - complexWriter->SetInput( complexReader->GetOutput() ); - complexWriter->Update(); - - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << 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::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + typedef std::complex<float> PixelType; + const unsigned int Dimension = 2; + + typedef otb::Image<PixelType, Dimension > ImageType; + + typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::StreamingImageFileWriter< ImageType > WriterType; + /* typedef itk::StreamingImageFilter< ImageType, + ImageType > StreamingType;*/ + + ReaderType::Pointer complexReader = ReaderType::New(); + complexReader->SetFileName( inputFilename ); + + /* StreamingType::Pointer streaming = StreamingType::New(); + streaming->SetNumberOfStreamDivisions(100); + streaming->SetInput(complexReader->GetOutput()); + */ + WriterType::Pointer complexWriter = WriterType::New(); + complexWriter->SetNumberOfStreamDivisions(100); + complexWriter->SetFileName( outputFilename ); + complexWriter->SetInput( complexReader->GetOutput() ); + complexWriter->Update(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageFileWriterTest.cxx b/Testing/Code/IO/otbImageFileWriterTest.cxx index 040a2be647..965b9ac55a 100755 --- a/Testing/Code/IO/otbImageFileWriterTest.cxx +++ b/Testing/Code/IO/otbImageFileWriterTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,42 +29,29 @@ int otbImageFileWriterTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image< InputPixelType, Dimension > InputImageType; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageGeometryHandlerNew.cxx b/Testing/Code/IO/otbImageGeometryHandlerNew.cxx index 04575b13da..0717f6824a 100644 --- a/Testing/Code/IO/otbImageGeometryHandlerNew.cxx +++ b/Testing/Code/IO/otbImageGeometryHandlerNew.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkExceptionObject.h" @@ -21,23 +21,8 @@ int otbImageGeometryHandlerNew(int argc, char * argv[]) { - try - { - // Instantiating object - otb::ImageGeometryHandler::Pointer object = otb::ImageGeometryHandler::New(); - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } + // Instantiating object + otb::ImageGeometryHandler::Pointer object = otb::ImageGeometryHandler::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageIOFactoryTest.cxx b/Testing/Code/IO/otbImageIOFactoryTest.cxx index d02181de99..b4118a4dc1 100755 --- a/Testing/Code/IO/otbImageIOFactoryTest.cxx +++ b/Testing/Code/IO/otbImageIOFactoryTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,21 +26,7 @@ int otbImageIOFactoryTest(int argc, char* argv []) { - try - { - otb::ImageIOFactory * lImageIOFactory; - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::ImageIOFactory * lImageIOFactory; return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx b/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx index 9c5b4baedc..bd1b9860a1 100755 --- a/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx +++ b/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,42 +29,29 @@ int otbImageMetadataFileWriterTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx b/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx index df47110a7c..025dc8d6b2 100644 --- a/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx +++ b/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,42 +29,29 @@ int otbImageMetadataStreamingFileWriterTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::StreamingImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbImageTest.cxx b/Testing/Code/IO/otbImageTest.cxx index 0e7c37a873..2967d4a24c 100755 --- a/Testing/Code/IO/otbImageTest.cxx +++ b/Testing/Code/IO/otbImageTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -33,115 +33,101 @@ int otbImageTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputAsciiFilename = argv[2]; - // unsigned int GCPnum((unsigned int)::atoi(argv[2])); + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputAsciiFilename = argv[2]; + // unsigned int GCPnum((unsigned int)::atoi(argv[2])); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - std::ofstream file; + std::ofstream file; - file.open(outputAsciiFilename); + file.open(outputAsciiFilename); - typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< InputPixelType, Dimension > InputImageType; - InputImageType::Pointer image = InputImageType::New(); + InputImageType::Pointer image = InputImageType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileReader< InputImageType > ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); - reader->GenerateOutputInformation(); + reader->SetFileName( inputFilename ); + reader->GenerateOutputInformation(); - image = reader->GetOutput(); + image = reader->GetOutput(); - file << "------ IMAGE --------" << std::endl; - std::cout << "------ IMAGE --------" << std::endl; -// Image n'est pas ecrit dans le fichier car des pointeurs sont affich�s, donc la valeur d�pend de l'instanciation -// -> pour pouvoir faire de tests de non regression sur la sortie ecrite dans le fichier ASCII - std::cout << image << std::endl; - std::cout << "---------------------" << std::endl; + file << "------ IMAGE --------" << std::endl; + std::cout << "------ IMAGE --------" << std::endl; + // Image n'est pas ecrit dans le fichier car des pointeurs sont affich�s, donc la valeur d�pend de l'instanciation + // -> pour pouvoir faire de tests de non regression sur la sortie ecrite dans le fichier ASCII + std::cout << image << std::endl; + std::cout << "---------------------" << std::endl; - file << "Spacing " << image->GetSpacing() << std::endl; - file << "Origin " << image->GetOrigin() << std::endl; + file << "Spacing " << image->GetSpacing() << std::endl; + file << "Origin " << image->GetOrigin() << std::endl; - file << "Projection REF " << image->GetProjectionRef() << std::endl; + file << "Projection REF " << image->GetProjectionRef() << std::endl; - file << "GCP Projection " << image->GetGCPProjection() << std::endl; + file << "GCP Projection " << image->GetGCPProjection() << std::endl; - unsigned int GCPCount = image->GetGCPCount(); - file << "GCP Count " << image->GetGCPCount() << std::endl; + unsigned int GCPCount = image->GetGCPCount(); + file << "GCP Count " << image->GetGCPCount() << std::endl; - for(unsigned int GCPnum = 0 ; GCPnum < GCPCount ; GCPnum++ ) - { - file << "GCP[" << GCPnum << "] Id " << image->GetGCPId(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Info " << image->GetGCPInfo(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Row " << image->GetGCPRow(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Col " << image->GetGCPCol(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] X " << image->GetGCPX(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Y " << image->GetGCPY(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Z " << image->GetGCPZ(GCPnum) << std::endl; - file << "----------------" << std::endl; - } + for(unsigned int GCPnum = 0 ; GCPnum < GCPCount ; GCPnum++ ) + { + file << "GCP[" << GCPnum << "] Id " << image->GetGCPId(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Info " << image->GetGCPInfo(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Row " << image->GetGCPRow(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Col " << image->GetGCPCol(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] X " << image->GetGCPX(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Y " << image->GetGCPY(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Z " << image->GetGCPZ(GCPnum) << std::endl; + file << "----------------" << std::endl; + } - InputImageType::VectorType tab = image->GetGeoTransform(); - - file << "Geo Transform " << std::endl; - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " " <<i<<" -> "<<tab[i]<< std::endl; - } - tab.clear(); + InputImageType::VectorType tab = image->GetGeoTransform(); + + file << "Geo Transform " << std::endl; + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " " <<i<<" -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetUpperLeftCorner(); - file << "Corners " << std::endl; - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " UL[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetUpperLeftCorner(); + file << "Corners " << std::endl; + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " UL[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetUpperRightCorner(); - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " UR[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetUpperRightCorner(); + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " UR[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetLowerLeftCorner(); - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " LL[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetLowerLeftCorner(); + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " LL[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetLowerRightCorner(); - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " LR[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetLowerRightCorner(); + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " LR[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - file.close(); + file.close(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbIntImageIOTest.cxx b/Testing/Code/IO/otbIntImageIOTest.cxx index 28ee8e8862..15be985939 100644 --- a/Testing/Code/IO/otbIntImageIOTest.cxx +++ b/Testing/Code/IO/otbIntImageIOTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -29,42 +29,29 @@ int otbIntImageIOTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef int InputPixelType; - typedef int OutputPixelType; - const unsigned int Dimension = 2; + typedef int InputPixelType; + typedef int OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx b/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx index e1d1d234af..c8b2bdfa41 100755 --- a/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx @@ -10,10 +10,10 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + =========================================================================*/ #if defined(_MSC_VER) @@ -26,12 +26,12 @@ int otbJPEG2000ImageIOTestCanRead(int argc, char* argv[]) { - otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); - bool lCanRead = lJPEG2000ImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to open the image file JPEG2000 "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); + bool lCanRead = lJPEG2000ImageIO->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to open the image file JPEG2000 "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx b/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx index c369991dab..fee3dc6666 100755 --- a/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx @@ -8,11 +8,11 @@ Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -26,12 +26,13 @@ int otbJPEG2000ImageIOTestCanWrite(int argc, char* argv[]) { - otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); - bool lCanWrite = lJPEG2000ImageIO->CanWriteFile(argv[1]); - if ( lCanWrite == false) - { - std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to create the image file JPEG2000 "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); + bool lCanWrite = lJPEG2000ImageIO->CanWriteFile(argv[1]); + if ( lCanWrite == false) + { + std::cerr << "Erreur otb::JPEG2000ImageIO : impossible to create the image file JPEG2000 "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx b/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx index 61577478ce..88766cf6e2 100644 --- a/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx @@ -26,27 +26,14 @@ int otbLUMImageIOTestCanRead(int argc, char* argv[]) { - try - { - otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); - bool lCanRead = lLUMImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::LUMImageIO : impossible d'ouvrir l'image LUM "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); + bool lCanRead = lLUMImageIO->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::LUMImageIO : impossible d'ouvrir l'image LUM "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx b/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx index 2a775e1f89..8ef0f00aaf 100644 --- a/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx +++ b/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx @@ -26,27 +26,14 @@ int otbLUMImageIOTestCanWrite(int argc, char* argv[]) { - try - { - otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); - bool lCanRead = lLUMImageIO->CanWriteFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::L'image "<<argv[1]<<" n'est pas une image LUM."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); + bool lCanRead = lLUMImageIO->CanWriteFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::L'image "<<argv[1]<<" n'est pas une image LUM."<<std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx b/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx index 80f5b40ed7..b0f679ecdb 100644 --- a/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx @@ -26,27 +26,13 @@ int otbMSTARImageIOTestCanRead(int argc, char* argv[]) { - try - { - otb::MSTARImageIO::Pointer lMSTARImageIO = otb::MSTARImageIO::New(); - bool lCanRead = lMSTARImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::MSTARImageIO : impossible d'ouvrir l'image MSTAR "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::MSTARImageIO::Pointer lMSTARImageIO = otb::MSTARImageIO::New(); + bool lCanRead = lMSTARImageIO->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::MSTARImageIO : impossible d'ouvrir l'image MSTAR "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbMultiToMonoChannelExtractROISAR.cxx b/Testing/Code/IO/otbMultiToMonoChannelExtractROISAR.cxx index 4f839b135f..9e9e7736d6 100644 --- a/Testing/Code/IO/otbMultiToMonoChannelExtractROISAR.cxx +++ b/Testing/Code/IO/otbMultiToMonoChannelExtractROISAR.cxx @@ -9,10 +9,10 @@ Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -25,59 +25,43 @@ int otbMultiToMonoChannelExtractROISAR ( int argc, char * argv[] ) { - try - { - - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef std::complex<float> InputPixelType; - typedef std::complex<float> OutputPixelType; + typedef std::complex<float> InputPixelType; + typedef std::complex<float> OutputPixelType; - typedef otb::ExtractROI< InputPixelType, - OutputPixelType > ExtractROIFilterType; + typedef otb::ExtractROI< InputPixelType, + OutputPixelType > ExtractROIFilterType; - ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); + ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); - extractROIFilter->SetStartX( 10 ); - extractROIFilter->SetStartY( 10 ); - extractROIFilter->SetSizeX( 100 ); - extractROIFilter->SetSizeY( 100 ); + extractROIFilter->SetStartX( 10 ); + extractROIFilter->SetStartY( 10 ); + extractROIFilter->SetSizeX( 100 ); + extractROIFilter->SetSizeY( 100 ); - // Resume de la ligne de commande - std::cout << " ROI selectionnee : startX "<<extractROIFilter->GetStartX()<<std::endl; - std::cout << " startY "<<extractROIFilter->GetStartY()<<std::endl; - std::cout << " sizeX "<<extractROIFilter->GetSizeX()<<std::endl; - std::cout << " sizeY "<<extractROIFilter->GetSizeY()<<std::endl; - - typedef otb::ImageFileReader< ExtractROIFilterType::InputImageType > ReaderType; - typedef otb::ImageFileWriter< ExtractROIFilterType::OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + // Resume de la ligne de commande + std::cout << " ROI selectionnee : startX "<<extractROIFilter->GetStartX()<<std::endl; + std::cout << " startY "<<extractROIFilter->GetStartY()<<std::endl; + std::cout << " sizeX "<<extractROIFilter->GetSizeX()<<std::endl; + std::cout << " sizeY "<<extractROIFilter->GetSizeY()<<std::endl; + + typedef otb::ImageFileReader< ExtractROIFilterType::InputImageType > ReaderType; + typedef otb::ImageFileWriter< ExtractROIFilterType::OutputImageType > WriterType; + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - extractROIFilter->SetInput( reader->GetOutput() ); - writer->SetInput( extractROIFilter->GetOutput() ); - writer->Update(); - std::cout << " Nb canaux dans l'image d'entree : "<< reader->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl; - std::cout << " Nb canaux dans l'image de sortie : "<<extractROIFilter->GetOutput()->GetNumberOfComponentsPerPixel() <<std::endl; - - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject levee !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cout << "Exception levee inconnue !" << std::endl; - return EXIT_FAILURE; - } + extractROIFilter->SetInput( reader->GetOutput() ); + writer->SetInput( extractROIFilter->GetOutput() ); + writer->Update(); + std::cout << " Nb canaux dans l'image d'entree : "<< reader->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl; + std::cout << " Nb canaux dans l'image de sortie : "<<extractROIFilter->GetOutput()->GetNumberOfComponentsPerPixel() <<std::endl; + return EXIT_SUCCESS; diff --git a/Testing/Code/IO/otbOGRDriverTest.cxx b/Testing/Code/IO/otbOGRDriverTest.cxx index 32e42aec7e..fdcfa36f4e 100644 --- a/Testing/Code/IO/otbOGRDriverTest.cxx +++ b/Testing/Code/IO/otbOGRDriverTest.cxx @@ -33,357 +33,344 @@ int otbOGRDriverTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; -//=========================================================================== + //=========================================================================== - OGRRegisterAll(); + OGRRegisterAll(); - OGRDataSource *poDS; + OGRDataSource *poDS; - otbGenericMsgTestingMacro(<< "READ FIRST TIME"); + otbGenericMsgTestingMacro(<< "READ FIRST TIME"); - poDS = OGRSFDriverRegistrar::Open( inputFilename, FALSE ); - if( poDS == NULL ) + poDS = OGRSFDriverRegistrar::Open( inputFilename, FALSE ); + if( poDS == NULL ) { - otbGenericMsgTestingMacro(<< "Open failed.\n"); - return EXIT_FAILURE; + otbGenericMsgTestingMacro(<< "Open failed.\n"); + return EXIT_FAILURE; } - unsigned int nbOfLayers = poDS->GetLayerCount(); + unsigned int nbOfLayers = poDS->GetLayerCount(); - otbGenericMsgTestingMacro(<< "File Name " << poDS->GetName()); + otbGenericMsgTestingMacro(<< "File Name " << poDS->GetName()); - otbGenericMsgTestingMacro(<< "Number Of Layers : " << poDS->GetLayerCount()); + otbGenericMsgTestingMacro(<< "Number Of Layers : " << poDS->GetLayerCount()); - for (unsigned int i=0; i<nbOfLayers; i++) - { - otbGenericMsgTestingMacro(<< "Layer number " << i+1); - OGRLayer *poLayer = poDS->GetLayer(i); + for (unsigned int i=0; i<nbOfLayers; i++) + { + otbGenericMsgTestingMacro(<< "Layer number " << i+1); + OGRLayer *poLayer = poDS->GetLayer(i); - poLayer->ResetReading(); + poLayer->ResetReading(); - OGRFeature *poFeature; + OGRFeature *poFeature; - int nb=0; - while( (poFeature = poLayer->GetNextFeature()) != NULL ) - { - otbGenericMsgTestingMacro(<< "Feature number " << ++nb); + int nb=0; + while( (poFeature = poLayer->GetNextFeature()) != NULL ) + { + otbGenericMsgTestingMacro(<< "Feature number " << ++nb); - OGRFeatureDefn *poFDefn = poLayer->GetLayerDefn(); - otbGenericMsgTestingMacro(<< "Name : " << poFDefn->GetName()); - otbGenericMsgTestingMacro(<< "NbOfFields : " << poFDefn->GetFieldCount()); + OGRFeatureDefn *poFDefn = poLayer->GetLayerDefn(); + otbGenericMsgTestingMacro(<< "Name : " << poFDefn->GetName()); + otbGenericMsgTestingMacro(<< "NbOfFields : " << poFDefn->GetFieldCount()); - int iField; + int iField; - for( iField = 0; iField < poFDefn->GetFieldCount(); iField++ ) - { - OGRFieldDefn *poFieldDefn = poFDefn->GetFieldDefn( iField ); + for( iField = 0; iField < poFDefn->GetFieldCount(); iField++ ) + { + OGRFieldDefn *poFieldDefn = poFDefn->GetFieldDefn( iField ); - if( poFieldDefn->GetType() == OFTInteger ) - { - otbGenericMsgTestingMacro(<< " OFTInteger " << poFeature->GetFieldAsInteger(iField )); - } - else if( poFieldDefn->GetType() == OFTReal ) - { - otbGenericMsgTestingMacro(<< " OFTReal " << poFeature->GetFieldAsDouble(iField)); - } - else if( poFieldDefn->GetType() == OFTString ) - { - otbGenericMsgTestingMacro(<< " OFTString " << poFeature->GetFieldAsString(iField)); - } - else - { - otbGenericMsgDebugMacro(<< " OTHER " << poFeature->GetFieldAsString(iField)); - } + if( poFieldDefn->GetType() == OFTInteger ) + { + otbGenericMsgTestingMacro(<< " OFTInteger " << poFeature->GetFieldAsInteger(iField )); + } + else if( poFieldDefn->GetType() == OFTReal ) + { + otbGenericMsgTestingMacro(<< " OFTReal " << poFeature->GetFieldAsDouble(iField)); + } + else if( poFieldDefn->GetType() == OFTString ) + { + otbGenericMsgTestingMacro(<< " OFTString " << poFeature->GetFieldAsString(iField)); + } + else + { + otbGenericMsgDebugMacro(<< " OTHER " << poFeature->GetFieldAsString(iField)); + } - } + } - OGRGeometry *poGeometry; + OGRGeometry *poGeometry; - poGeometry = poFeature->GetGeometryRef(); + poGeometry = poFeature->GetGeometryRef(); - OGRwkbGeometryType geom = poGeometry->getGeometryType(); + OGRwkbGeometryType geom = poGeometry->getGeometryType(); - otbGenericMsgTestingMacro(<< "Geometry : " << poGeometry->getGeometryName()); + otbGenericMsgTestingMacro(<< "Geometry : " << poGeometry->getGeometryName()); - switch(geom) - { - case wkbPolygon : - { - otbGenericMsgTestingMacro(<< "Polygon"); - OGRPolygon* polygon = dynamic_cast<OGRPolygon*>(poGeometry); + switch(geom) + { + case wkbPolygon : + { + otbGenericMsgTestingMacro(<< "Polygon"); + OGRPolygon* polygon = dynamic_cast<OGRPolygon*>(poGeometry); - otbGenericMsgTestingMacro(<< "Holes number : " << polygon->getNumInteriorRings()); - OGRLinearRing* ring = polygon->getExteriorRing(); + otbGenericMsgTestingMacro(<< "Holes number : " << polygon->getNumInteriorRings()); + OGRLinearRing* ring = polygon->getExteriorRing(); - unsigned int nbPoints = ring->getNumPoints(); - otbGenericMsgTestingMacro(<< "Points number : " << nbPoints); + unsigned int nbPoints = ring->getNumPoints(); + otbGenericMsgTestingMacro(<< "Points number : " << nbPoints); - OGRRawPoint* pointsList = new OGRRawPoint[ring->getNumPoints()]; - ring->getPoints(pointsList); + OGRRawPoint* pointsList = new OGRRawPoint[ring->getNumPoints()]; + ring->getPoints(pointsList); - for (unsigned int i=0; i<nbPoints; i++) - { - otbGenericMsgTestingMacro(<< "(" << pointsList[i].x << "," << pointsList[i].y << ") "); - } + for (unsigned int i=0; i<nbPoints; i++) + { + otbGenericMsgTestingMacro(<< "(" << pointsList[i].x << "," << pointsList[i].y << ") "); + } - otbGenericMsgTestingMacro(<< std::endl); + otbGenericMsgTestingMacro(<< std::endl); - delete[] pointsList; + delete[] pointsList; - break; - } - default : otbGenericMsgTestingMacro(<< "Other geometry"); - } + break; + } + default : otbGenericMsgTestingMacro(<< "Other geometry"); + } - otbGenericMsgTestingMacro(<< "=========================="); - //OGRFeature::DestroyFeature( poFeature ); - } + otbGenericMsgTestingMacro(<< "=========================="); + //OGRFeature::DestroyFeature( poFeature ); + } - } + } -//=========================================================================== + //=========================================================================== - // Write - otbGenericMsgTestingMacro(<< "WRITE"); + // Write + otbGenericMsgTestingMacro(<< "WRITE"); - const char *pszDriverName = "ESRI Shapefile"; - OGRSFDriver *poDriver; + const char *pszDriverName = "ESRI Shapefile"; + OGRSFDriver *poDriver; - poDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName( - pszDriverName ); - if( poDriver == NULL ) + poDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName( + pszDriverName ); + if( poDriver == NULL ) { - printf( "%s driver not available.\n", pszDriverName ); - exit( 1 ); + printf( "%s driver not available.\n", pszDriverName ); + exit( 1 ); } - OGRDataSource *poDSW; + OGRDataSource *poDSW; - poDSW = poDriver->CreateDataSource( outputFilename, NULL ); - if( poDSW == NULL ) + poDSW = poDriver->CreateDataSource( outputFilename, NULL ); + if( poDSW == NULL ) { - printf( "Creation of output file failed.\n" ); - exit( 1 ); + printf( "Creation of output file failed.\n" ); + exit( 1 ); } - std::string name(poDSW->GetName()); + std::string name(poDSW->GetName()); - for (unsigned int i=0; i<nbOfLayers; i++) - { - otbGenericMsgTestingMacro(<< "Layer number " << i+1); - OGRLayer *poLayer2 = poDS->GetLayer(i); - poLayer2->ResetReading(); + for (unsigned int i=0; i<nbOfLayers; i++) + { + otbGenericMsgTestingMacro(<< "Layer number " << i+1); + OGRLayer *poLayer2 = poDS->GetLayer(i); + poLayer2->ResetReading(); - // Filename without extension - otb::FileName outputFile(outputFilename); - otb::FileName outputFileWithNoExtension = outputFile.ObtainFileNameWithNoExtension(); + // Filename without extension + otb::FileName outputFile(outputFilename); + otb::FileName outputFileWithNoExtension = outputFile.ObtainFileNameWithNoExtension(); - OGRLayer* poWLayer = poDSW->CreateLayer(outputFileWithNoExtension.c_str()); + OGRLayer* poWLayer = poDSW->CreateLayer(outputFileWithNoExtension.c_str()); - if( poLayer2 == NULL ) - { - printf( "Layer creation failed.\n" ); - exit( 1 ); - } + if( poLayer2 == NULL ) + { + printf( "Layer creation failed.\n" ); + exit( 1 ); + } - OGRFeature* poFeature2; - while( (poFeature2 = poLayer2->GetNextFeature()) != NULL ) - { - otbGenericMsgTestingMacro(<< "Feature! "); - OGRFeature* poWFeature; + OGRFeature* poFeature2; + while( (poFeature2 = poLayer2->GetNextFeature()) != NULL ) + { + otbGenericMsgTestingMacro(<< "Feature! "); + OGRFeature* poWFeature; - unsigned int nbFields = poFeature2->GetFieldCount(); - for (unsigned int i=0; i<nbFields; i++) - { - OGRFieldDefn* oField = poFeature2->GetFieldDefnRef(i); + unsigned int nbFields = poFeature2->GetFieldCount(); + for (unsigned int i=0; i<nbFields; i++) + { + OGRFieldDefn* oField = poFeature2->GetFieldDefnRef(i); - std::cout << "Field : " << poFeature2->GetRawFieldRef(i)->String << std::endl; - if( poWLayer->CreateField( oField ) != OGRERR_NONE ) - { - printf( "Creating Name field failed.\n" ); - exit( 1 ); - } + std::cout << "Field : " << poFeature2->GetRawFieldRef(i)->String << std::endl; + if( poWLayer->CreateField( oField ) != OGRERR_NONE ) + { + printf( "Creating Name field failed.\n" ); + exit( 1 ); + } - poWFeature = OGRFeature::CreateFeature( poLayer2->GetLayerDefn() ); + poWFeature = OGRFeature::CreateFeature( poLayer2->GetLayerDefn() ); - poWFeature->SetField(i,poFeature2->GetRawFieldRef(i)); - std::cout << "FieldW : " << poWFeature->GetRawFieldRef(i)->String << std::endl; + poWFeature->SetField(i,poFeature2->GetRawFieldRef(i)); + std::cout << "FieldW : " << poWFeature->GetRawFieldRef(i)->String << std::endl; - } + } - poWFeature->SetGeometry(poFeature2->GetGeometryRef()); + poWFeature->SetGeometry(poFeature2->GetGeometryRef()); - if( poWLayer->CreateFeature( poWFeature ) != OGRERR_NONE ) - { - printf( "Failed to create feature in shapefile.\n" ); - exit( 1 ); - } + if( poWLayer->CreateFeature( poWFeature ) != OGRERR_NONE ) + { + printf( "Failed to create feature in shapefile.\n" ); + exit( 1 ); + } - OGRFeature::DestroyFeature(poWFeature); + OGRFeature::DestroyFeature(poWFeature); - } - } + } + } - OGRDataSource::DestroyDataSource( poDSW ); + OGRDataSource::DestroyDataSource( poDSW ); -// Libération mémoire structure lecture - for (unsigned int i=0; i<nbOfLayers; i++) - { - OGRLayer *poLayer = poDS->GetLayer(i); + // Libération mémoire structure lecture + for (unsigned int i=0; i<nbOfLayers; i++) + { + OGRLayer *poLayer = poDS->GetLayer(i); - OGRFeature* poFeature; - while( (poFeature = poLayer->GetNextFeature()) != NULL ) - { - OGRFeature::DestroyFeature(poFeature); - } - } + OGRFeature* poFeature; + while( (poFeature = poLayer->GetNextFeature()) != NULL ) + { + OGRFeature::DestroyFeature(poFeature); + } + } - OGRDataSource::DestroyDataSource( poDS ); + OGRDataSource::DestroyDataSource( poDS ); -//=========================================================================== + //=========================================================================== - OGRDataSource *poDS2; + OGRDataSource *poDS2; - otbGenericMsgTestingMacro(<< "READ SECOND TIME"); - // Reread - poDS2 = OGRSFDriverRegistrar::Open( outputFilename, FALSE ); - if( poDS2 == NULL ) + otbGenericMsgTestingMacro(<< "READ SECOND TIME"); + // Reread + poDS2 = OGRSFDriverRegistrar::Open( outputFilename, FALSE ); + if( poDS2 == NULL ) { - otbGenericMsgTestingMacro(<< "Open failed.\n"); - return EXIT_FAILURE; + otbGenericMsgTestingMacro(<< "Open failed.\n"); + return EXIT_FAILURE; } - nbOfLayers = poDS2->GetLayerCount(); + nbOfLayers = poDS2->GetLayerCount(); - otbGenericMsgTestingMacro(<< "Number Of Layers : " << poDS2->GetLayerCount()); + otbGenericMsgTestingMacro(<< "Number Of Layers : " << poDS2->GetLayerCount()); - for (unsigned int i=0; i<nbOfLayers; i++) - { - otbGenericMsgTestingMacro(<< "Layer number " << i+1); - OGRLayer *poLayer3 = poDS2->GetLayer(i); + for (unsigned int i=0; i<nbOfLayers; i++) + { + otbGenericMsgTestingMacro(<< "Layer number " << i+1); + OGRLayer *poLayer3 = poDS2->GetLayer(i); - poLayer3->ResetReading(); + poLayer3->ResetReading(); - OGRFeature *poFeature3; + OGRFeature *poFeature3; - int nb=0; - while( (poFeature3 = poLayer3->GetNextFeature()) != NULL ) - { - otbGenericMsgTestingMacro(<< "Feature number " << ++nb); + int nb=0; + while( (poFeature3 = poLayer3->GetNextFeature()) != NULL ) + { + otbGenericMsgTestingMacro(<< "Feature number " << ++nb); - OGRFeatureDefn *poFDefn = poLayer3->GetLayerDefn(); - otbGenericMsgTestingMacro(<< "Name : " << poFDefn->GetName()); - otbGenericMsgTestingMacro(<< "NbOfFields : " << poFDefn->GetFieldCount()); + OGRFeatureDefn *poFDefn = poLayer3->GetLayerDefn(); + otbGenericMsgTestingMacro(<< "Name : " << poFDefn->GetName()); + otbGenericMsgTestingMacro(<< "NbOfFields : " << poFDefn->GetFieldCount()); -// std::cout << "Field : " << poFeature3->GetRawFieldRef(i)->String << std::endl; + // std::cout << "Field : " << poFeature3->GetRawFieldRef(i)->String << std::endl; - for(int iField = 0; iField < poFDefn->GetFieldCount(); iField++ ) - { - OGRFieldDefn *poFieldDefn = poFDefn->GetFieldDefn( iField ); + for(int iField = 0; iField < poFDefn->GetFieldCount(); iField++ ) + { + OGRFieldDefn *poFieldDefn = poFDefn->GetFieldDefn( iField ); - if( poFieldDefn->GetType() == OFTInteger ) - { - otbGenericMsgTestingMacro(<< " OFTInteger " << poFeature3->GetFieldAsInteger(iField )); - } - else if( poFieldDefn->GetType() == OFTReal ) - { - otbGenericMsgTestingMacro(<< " OFTReal " << poFeature3->GetFieldAsDouble(iField)); - } - else if( poFieldDefn->GetType() == OFTString ) - { - otbGenericMsgTestingMacro(<< " OFTString " << poFeature3->GetFieldAsString(iField)); - } - else - { - otbGenericMsgDebugMacro(<< " OTHER " << poFeature3->GetFieldAsString(iField)); - } + if( poFieldDefn->GetType() == OFTInteger ) + { + otbGenericMsgTestingMacro(<< " OFTInteger " << poFeature3->GetFieldAsInteger(iField )); + } + else if( poFieldDefn->GetType() == OFTReal ) + { + otbGenericMsgTestingMacro(<< " OFTReal " << poFeature3->GetFieldAsDouble(iField)); + } + else if( poFieldDefn->GetType() == OFTString ) + { + otbGenericMsgTestingMacro(<< " OFTString " << poFeature3->GetFieldAsString(iField)); + } + else + { + otbGenericMsgDebugMacro(<< " OTHER " << poFeature3->GetFieldAsString(iField)); + } - } + } - OGRGeometry *poGeometry; + OGRGeometry *poGeometry; - poGeometry = poFeature3->GetGeometryRef(); + poGeometry = poFeature3->GetGeometryRef(); - OGRwkbGeometryType geom = poGeometry->getGeometryType(); + OGRwkbGeometryType geom = poGeometry->getGeometryType(); - otbGenericMsgTestingMacro(<< "Geometry : " << poGeometry->getGeometryName()); + otbGenericMsgTestingMacro(<< "Geometry : " << poGeometry->getGeometryName()); - switch(geom) - { - case wkbPolygon : - { - otbGenericMsgTestingMacro(<< "Polygon"); - OGRPolygon* polygon = dynamic_cast<OGRPolygon*>(poGeometry); + switch(geom) + { + case wkbPolygon : + { + otbGenericMsgTestingMacro(<< "Polygon"); + OGRPolygon* polygon = dynamic_cast<OGRPolygon*>(poGeometry); - otbGenericMsgTestingMacro(<< "Holes number : " << polygon->getNumInteriorRings()); - OGRLinearRing* ring = polygon->getExteriorRing(); + otbGenericMsgTestingMacro(<< "Holes number : " << polygon->getNumInteriorRings()); + OGRLinearRing* ring = polygon->getExteriorRing(); - unsigned int nbPoints = ring->getNumPoints(); - otbGenericMsgTestingMacro(<< "Points number : " << nbPoints); + unsigned int nbPoints = ring->getNumPoints(); + otbGenericMsgTestingMacro(<< "Points number : " << nbPoints); - OGRRawPoint* pointsList = new OGRRawPoint[ring->getNumPoints()]; - ring->getPoints(pointsList); + OGRRawPoint* pointsList = new OGRRawPoint[ring->getNumPoints()]; + ring->getPoints(pointsList); - for (unsigned int i=0; i<nbPoints; i++) - { - otbGenericMsgTestingMacro(<< "(" << pointsList[i].x << "," << pointsList[i].y << ") "); - } + for (unsigned int i=0; i<nbPoints; i++) + { + otbGenericMsgTestingMacro(<< "(" << pointsList[i].x << "," << pointsList[i].y << ") "); + } - otbGenericMsgTestingMacro(<< std::endl); + otbGenericMsgTestingMacro(<< std::endl); - delete[] pointsList; + delete[] pointsList; - break; - } - default : otbGenericMsgTestingMacro(<< "Other geometry"); - } + break; + } + default : otbGenericMsgTestingMacro(<< "Other geometry"); + } - otbGenericMsgTestingMacro(<< "=========================="); - OGRFeature::DestroyFeature( poFeature3 ); - } + otbGenericMsgTestingMacro(<< "=========================="); + OGRFeature::DestroyFeature( poFeature3 ); + } - } + } - OGRDataSource::DestroyDataSource( poDS2 ); + OGRDataSource::DestroyDataSource( poDS2 ); -//=========================================================================== + //=========================================================================== - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx b/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx index 27b156f044..ffb5090524 100644 --- a/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx +++ b/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx @@ -26,27 +26,13 @@ int otbONERAImageIOTestCanRead(int argc, char* argv[]) { - try - { - otb::ONERAImageIO::Pointer lONERAImageIO = otb::ONERAImageIO::New(); - bool lCanRead = lONERAImageIO->CanReadFile(argv[1]); - if ( lCanRead == false) - { - std::cerr << "Erreur otb::ONERAImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; - return EXIT_FAILURE; - } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + otb::ONERAImageIO::Pointer lONERAImageIO = otb::ONERAImageIO::New(); + bool lCanRead = lONERAImageIO->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::ONERAImageIO : impossible d'ouvrir l'image "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOSSIMImageMetaDataReaderTest.cxx b/Testing/Code/IO/otbOSSIMImageMetaDataReaderTest.cxx index ed099657f8..d90d4507d8 100755 --- a/Testing/Code/IO/otbOSSIMImageMetaDataReaderTest.cxx +++ b/Testing/Code/IO/otbOSSIMImageMetaDataReaderTest.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -33,85 +33,70 @@ int otbOSSIMImageMetaDataReaderTest (int argc, char* argv[]) { - try - { - - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputAsciiFilenameOtbImage = argv[2]; - const char * outputAsciiFilenameOtbVectorImage = argv[3]; - - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ImageReaderType; - - ImageReaderType::Pointer image_reader = ImageReaderType::New(); - image_reader->SetFileName( inputFilename ); - - typedef itk::BinaryMedianImageFilter<InputImageType,InputImageType> MedianFilterType; - MedianFilterType::Pointer image_medianFilter = MedianFilterType::New(); + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputAsciiFilenameOtbImage = argv[2]; + const char * outputAsciiFilenameOtbVectorImage = argv[3]; + + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::ImageFileReader< InputImageType > ImageReaderType; + + ImageReaderType::Pointer image_reader = ImageReaderType::New(); + image_reader->SetFileName( inputFilename ); + + typedef itk::BinaryMedianImageFilter<InputImageType,InputImageType> MedianFilterType; + MedianFilterType::Pointer image_medianFilter = MedianFilterType::New(); - image_medianFilter->SetInput(image_reader->GetOutput()); - image_medianFilter->GetOutput()->UpdateOutputInformation(); + image_medianFilter->SetInput(image_reader->GetOutput()); + image_medianFilter->GetOutput()->UpdateOutputInformation(); - otb::ImageKeywordlist otb_tmp_image; -/* itk::ExposeMetaData< otb::ImageKeywordlist >(image_medianFilter->GetOutput()->GetMetaDataDictionary(), - otb::MetaDataKey::m_OSSIMKeywordlistKey, - otb_tmp_image);*/ + otb::ImageKeywordlist otb_tmp_image; + /* itk::ExposeMetaData< otb::ImageKeywordlist >(image_medianFilter->GetOutput()->GetMetaDataDictionary(), + otb::MetaDataKey::m_OSSIMKeywordlistKey, + otb_tmp_image);*/ - otb_tmp_image = image_reader->GetOutput()->GetImageKeywordlist(); + otb_tmp_image = image_reader->GetOutput()->GetImageKeywordlist(); - ossimKeywordlist ossim_kwl_image; - otb_tmp_image.convertToOSSIMKeywordlist(ossim_kwl_image); + ossimKeywordlist ossim_kwl_image; + otb_tmp_image.convertToOSSIMKeywordlist(ossim_kwl_image); - std::cout << " -> otbImage Ossim key word list copy : "<<ossim_kwl_image<<std::endl; + std::cout << " -> otbImage Ossim key word list copy : "<<ossim_kwl_image<<std::endl; - std::ofstream file; - file.open(outputAsciiFilenameOtbImage); - file << "--- OSSIM KEYWORDLIST ---" << std::endl; - file << ossim_kwl_image; - file.close(); - - typedef otb::VectorImage< InputPixelType, Dimension > InputVectorImageType; - typedef otb::ImageFileReader< InputVectorImageType > VectorImageReaderType; - - VectorImageReaderType::Pointer vector_image_reader = VectorImageReaderType::New(); - vector_image_reader->SetFileName( inputFilename ); - vector_image_reader->GenerateOutputInformation (); - -/* itk::ExposeMetaData< otb::ImageKeywordlist >(vector_image_reader->GetOutput()->GetMetaDataDictionary(), - otb::MetaDataKey::m_OSSIMKeywordlistKey, - otb_tmp_vector_image);*/ - otb::ImageKeywordlist otb_tmp_vector_image; - otb_tmp_vector_image = vector_image_reader->GetOutput()->GetImageKeywordlist(); - - ossimKeywordlist ossim_kwl_vector_image; - otb_tmp_vector_image.convertToOSSIMKeywordlist(ossim_kwl_vector_image); + std::ofstream file; + file.open(outputAsciiFilenameOtbImage); + file << "--- OSSIM KEYWORDLIST ---" << std::endl; + file << ossim_kwl_image; + file.close(); + + typedef otb::VectorImage< InputPixelType, Dimension > InputVectorImageType; + typedef otb::ImageFileReader< InputVectorImageType > VectorImageReaderType; + + VectorImageReaderType::Pointer vector_image_reader = VectorImageReaderType::New(); + vector_image_reader->SetFileName( inputFilename ); + vector_image_reader->GenerateOutputInformation (); + + /* itk::ExposeMetaData< otb::ImageKeywordlist >(vector_image_reader->GetOutput()->GetMetaDataDictionary(), + otb::MetaDataKey::m_OSSIMKeywordlistKey, + otb_tmp_vector_image);*/ + otb::ImageKeywordlist otb_tmp_vector_image; + otb_tmp_vector_image = vector_image_reader->GetOutput()->GetImageKeywordlist(); + + ossimKeywordlist ossim_kwl_vector_image; + otb_tmp_vector_image.convertToOSSIMKeywordlist(ossim_kwl_vector_image); - std::cout << " -> otbVectorImage Ossim key word list copy : "<<ossim_kwl_vector_image<<std::endl; + std::cout << " -> otbVectorImage Ossim key word list copy : "<<ossim_kwl_vector_image<<std::endl; -// std::ofstream file; - file.open(outputAsciiFilenameOtbVectorImage); - file << "--- OSSIM KEYWORDLIST ---" << std::endl; - file << ossim_kwl_vector_image; - file.close(); - - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - + // std::ofstream file; + file.open(outputAsciiFilenameOtbVectorImage); + file << "--- OSSIM KEYWORDLIST ---" << std::endl; + file << ossim_kwl_vector_image; + file.close(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbOssimElevManagerTest.cxx b/Testing/Code/IO/otbOssimElevManagerTest.cxx index 7d63329b08..39710ca6b9 100644 --- a/Testing/Code/IO/otbOssimElevManagerTest.cxx +++ b/Testing/Code/IO/otbOssimElevManagerTest.cxx @@ -1,3 +1,21 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + #include "otbImage.h" #include "otbImageFileWriter.h" #include "elevation/ossimElevManager.h" diff --git a/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx b/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx index 169b025f6a..6d55f338d3 100644 --- a/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx +++ b/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx @@ -29,45 +29,31 @@ int otbPipelineMetadataHandlingTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::DiscreteGaussianImageFilter<InputImageType,OutputImageType> FilterType; - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - FilterType::Pointer filter = FilterType::New(); - - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - - filter->SetInput(reader->GetOutput()); - writer->SetInput( filter->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef itk::DiscreteGaussianImageFilter<InputImageType,OutputImageType> FilterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + FilterType::Pointer filter = FilterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + filter->SetInput(reader->GetOutput()); + writer->SetInput( filter->GetOutput() ); + writer->Update(); return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx b/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx index 6a4b90c356..b072dd63ce 100644 --- a/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx +++ b/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx @@ -29,45 +29,32 @@ int otbPipelineMetadataHandlingWithUFFilterTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::RescaleIntensityImageFilter<InputImageType,OutputImageType> FilterType; - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - FilterType::Pointer filter = FilterType::New(); + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef itk::RescaleIntensityImageFilter<InputImageType,OutputImageType> FilterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + FilterType::Pointer filter = FilterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + filter->SetInput(reader->GetOutput()); + writer->SetInput( filter->GetOutput() ); + writer->Update(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - - filter->SetInput(reader->GetOutput()); - writer->SetInput( filter->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbSHPVectorDataIONew.cxx b/Testing/Code/IO/otbSHPVectorDataIONew.cxx index 3c5c735d23..c9fa2efe3b 100644 --- a/Testing/Code/IO/otbSHPVectorDataIONew.cxx +++ b/Testing/Code/IO/otbSHPVectorDataIONew.cxx @@ -24,5 +24,6 @@ int otbSHPVectorDataIONew(int argc, char * argv[]) typedef otb::VectorData<> VectorDataType; typedef otb::SHPVectorDataIO<VectorDataType> SHPVectorDataIOType; SHPVectorDataIOType::Pointer object = SHPVectorDataIOType::New(); - return 0; + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbShortImageIOTest.cxx b/Testing/Code/IO/otbShortImageIOTest.cxx index bf243ca6f2..7a8a8178b4 100644 --- a/Testing/Code/IO/otbShortImageIOTest.cxx +++ b/Testing/Code/IO/otbShortImageIOTest.cxx @@ -29,42 +29,29 @@ int otbShortImageIOTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef short InputPixelType; - typedef short OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + typedef short InputPixelType; + typedef short OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + writer->SetInput( reader->GetOutput() ); + writer->Update(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbShortRGBImageIOTest.cxx b/Testing/Code/IO/otbShortRGBImageIOTest.cxx index 100c3cdc20..275e424d81 100755 --- a/Testing/Code/IO/otbShortRGBImageIOTest.cxx +++ b/Testing/Code/IO/otbShortRGBImageIOTest.cxx @@ -31,42 +31,29 @@ int otbShortRGBImageIOTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef itk::RGBPixel<short> InputPixelType; - typedef itk::RGBPixel<short> OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::Image< OutputPixelType, Dimension > OutputImageType; - - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + typedef itk::RGBPixel<short> InputPixelType; + typedef itk::RGBPixel<short> OutputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType, Dimension > InputImageType; + typedef otb::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + writer->SetInput( reader->GetOutput() ); + writer->Update(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); - - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbSpatialObjectDXFReader.cxx b/Testing/Code/IO/otbSpatialObjectDXFReader.cxx index d32098f611..84c02c620b 100644 --- a/Testing/Code/IO/otbSpatialObjectDXFReader.cxx +++ b/Testing/Code/IO/otbSpatialObjectDXFReader.cxx @@ -10,9 +10,9 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkExceptionObject.h" @@ -24,116 +24,102 @@ int otbSpatialObjectDXFReader(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - char * inputFilename = argv[1]; - char * outputFilename = argv[2]; - const unsigned int outputSize = atoi(argv[4]); - - typedef double PixelType; - typedef unsigned char OutputPixelType; - typedef itk::GroupSpatialObject<Dimension> GroupType; - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::Image<OutputPixelType,Dimension> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::SpatialObjectDXFReader<GroupType> SpatialObjectDXFReaderType; - typedef otb::SpatialObjectToImageDrawingFilter<GroupType,ImageType> SpatialObjectToImageDrawingFilterType; - typedef itk::RescaleIntensityImageFilter< ImageType, OutputImageType > CastFilterType; - typedef itk::SpatialObject<Dimension> SpatialObjectType; - // Instantiating object - SpatialObjectDXFReaderType::Pointer reader = SpatialObjectDXFReaderType::New(); - SpatialObjectToImageDrawingFilterType::Pointer imageGenerator = SpatialObjectToImageDrawingFilterType::New(); - WriterType::Pointer writer = WriterType::New(); - CastFilterType::Pointer castFilter = CastFilterType::New(); - - reader->SetFileName(inputFilename); - reader->SetLayerName(argv[3]); + const unsigned int Dimension = 2; + char * inputFilename = argv[1]; + char * outputFilename = argv[2]; + const unsigned int outputSize = atoi(argv[4]); + + typedef double PixelType; + typedef unsigned char OutputPixelType; + typedef itk::GroupSpatialObject<Dimension> GroupType; + typedef otb::Image<PixelType,Dimension> ImageType; + typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::SpatialObjectDXFReader<GroupType> SpatialObjectDXFReaderType; + typedef otb::SpatialObjectToImageDrawingFilter<GroupType,ImageType> SpatialObjectToImageDrawingFilterType; + typedef itk::RescaleIntensityImageFilter< ImageType, OutputImageType > CastFilterType; + typedef itk::SpatialObject<Dimension> SpatialObjectType; + // Instantiating object + SpatialObjectDXFReaderType::Pointer reader = SpatialObjectDXFReaderType::New(); + SpatialObjectToImageDrawingFilterType::Pointer imageGenerator = SpatialObjectToImageDrawingFilterType::New(); + WriterType::Pointer writer = WriterType::New(); + CastFilterType::Pointer castFilter = CastFilterType::New(); + + reader->SetFileName(inputFilename); + reader->SetLayerName(argv[3]); - reader->Update(); - GroupType::Pointer group = reader->GetOutput(); - - if(group->GetNumberOfChildren() != 0) - { - /** Writing image **/ - SpatialObjectType::ChildrenListType* children=group->GetChildren(0); - SpatialObjectType::ChildrenListType::iterator it = children->begin(); - SpatialObjectType::ChildrenListType::iterator end = children->end(); - double maximum[Dimension],minimum[Dimension]; - (*it)->ComputeBoundingBox(); - minimum[0]=(*it)->GetBoundingBox()->GetMinimum()[0]; - minimum[1]=(*it)->GetBoundingBox()->GetMinimum()[1]; - - while(it != end) - { - (*it)->ComputeBoundingBox(); + reader->Update(); + GroupType::Pointer group = reader->GetOutput(); - if ((*it)->GetBoundingBox()->GetMinimum()[0] < minimum[0]) + if(group->GetNumberOfChildren() != 0) + { + /** Writing image **/ + SpatialObjectType::ChildrenListType* children=group->GetChildren(0); + SpatialObjectType::ChildrenListType::iterator it = children->begin(); + SpatialObjectType::ChildrenListType::iterator end = children->end(); + double maximum[Dimension],minimum[Dimension]; + (*it)->ComputeBoundingBox(); + minimum[0]=(*it)->GetBoundingBox()->GetMinimum()[0]; + minimum[1]=(*it)->GetBoundingBox()->GetMinimum()[1]; + + while(it != end) { - minimum[0]=(*it)->GetBoundingBox()->GetMinimum()[0]; - } - if ((*it)->GetBoundingBox()->GetMinimum()[1] < minimum[1]) - { - minimum[1]=(*it)->GetBoundingBox()->GetMinimum()[1]; - } - it++; + (*it)->ComputeBoundingBox(); + + if ((*it)->GetBoundingBox()->GetMinimum()[0] < minimum[0]) + { + minimum[0]=(*it)->GetBoundingBox()->GetMinimum()[0]; + } + if ((*it)->GetBoundingBox()->GetMinimum()[1] < minimum[1]) + { + minimum[1]=(*it)->GetBoundingBox()->GetMinimum()[1]; + } + it++; } - ImageType::SizeType size; - size[0]=outputSize; - size[1]=outputSize; - imageGenerator->SetSize(size); - ImageType::PointType origin; - origin[0]=(int) minimum[0]; - origin[1]=(int) minimum[1]; - imageGenerator->SetOrigin(origin); - - group->ComputeBoundingBox(); - - maximum[0]=group->GetBoundingBox()->GetMaximum()[0]; - maximum[1]=group->GetBoundingBox()->GetMaximum()[1]; - - ImageType::SpacingType spacing; - spacing[0]=(maximum[0]-origin[0])/size[0]; - spacing[1]=(maximum[1]-origin[1])/size[1]; - imageGenerator->SetSpacing(spacing); + ImageType::SizeType size; + size[0]=outputSize; + size[1]=outputSize; + imageGenerator->SetSize(size); + ImageType::PointType origin; + origin[0]=(int) minimum[0]; + origin[1]=(int) minimum[1]; + imageGenerator->SetOrigin(origin); + + group->ComputeBoundingBox(); + + maximum[0]=group->GetBoundingBox()->GetMaximum()[0]; + maximum[1]=group->GetBoundingBox()->GetMaximum()[1]; + + ImageType::SpacingType spacing; + spacing[0]=(maximum[0]-origin[0])/size[0]; + spacing[1]=(maximum[1]-origin[1])/size[1]; + imageGenerator->SetSpacing(spacing); - imageGenerator->SetInput(group); + imageGenerator->SetInput(group); - imageGenerator->Update(); + imageGenerator->Update(); - castFilter->SetOutputMinimum( 0 ); - castFilter->SetOutputMaximum( 255 ); - castFilter->SetInput( imageGenerator->GetOutput() ); - writer->SetInput(castFilter->GetOutput()); + castFilter->SetOutputMinimum( 0 ); + castFilter->SetOutputMaximum( 255 ); + castFilter->SetInput( imageGenerator->GetOutput() ); + writer->SetInput(castFilter->GetOutput()); - writer->SetFileName(outputFilename); - writer->Update(); - } - else - { - std::cout<<"No objects detected."<<std::endl; - return EXIT_FAILURE; + writer->SetFileName(outputFilename); + writer->Update(); + } + else + { + std::cout<<"No objects detected."<<std::endl; + return EXIT_FAILURE; - } } - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx b/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx index 81ce9ca794..14ad159be6 100644 --- a/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx +++ b/Testing/Code/IO/otbSpatialObjectDXFReaderNew.cxx @@ -22,27 +22,12 @@ int otbSpatialObjectDXFReaderNew(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef itk::GroupSpatialObject<Dimension> GroupType; - typedef otb::SpatialObjectDXFReader<GroupType> SpatialObjectDXFReaderType; - - // Instantiating object - SpatialObjectDXFReaderType::Pointer object = SpatialObjectDXFReaderType::New(); - } - - catch( itk::ExceptionObject & err ) - { - std::cout << "Exception itk::ExceptionObject thrown !" << std::endl; - std::cout << err << std::endl; - return EXIT_FAILURE; - } - - catch( ... ) - { - std::cout << "Unknown exception thrown !" << std::endl; - return EXIT_FAILURE; - } + const unsigned int Dimension = 2; + typedef itk::GroupSpatialObject<Dimension> GroupType; + typedef otb::SpatialObjectDXFReader<GroupType> SpatialObjectDXFReaderType; + + // Instantiating object + SpatialObjectDXFReaderType::Pointer object = SpatialObjectDXFReaderType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx b/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx index 679e019a6d..ec3fe2537c 100755 --- a/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx +++ b/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx @@ -31,66 +31,52 @@ int otbStreamingImageFileWriterTest (int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - int iStreaming(::atoi(argv[3])); - bool streaming = (bool)(iStreaming); - int NumberOfStreamDivisions(10); - if( streaming == true ) - { - NumberOfStreamDivisions = ::atoi(argv[4]); - } + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + int iStreaming(::atoi(argv[3])); + bool streaming = (bool)(iStreaming); + int NumberOfStreamDivisions(10); + if( streaming == true ) + { + NumberOfStreamDivisions = ::atoi(argv[4]); + } - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image< InputPixelType, Dimension > InputImageType; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); - - if( streaming == true ) - { - std::cout << "Streaming writing test"<<std::endl; - StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - else - { - std::cout << "Writing test"<<std::endl; - WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - - - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName( inputFilename ); + + if( streaming == true ) + { + std::cout << "Streaming writing test"<<std::endl; + StreamingWriterType::Pointer writer = StreamingWriterType::New(); + writer->SetFileName( outputFilename ); + writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); + writer->SetInput( reader->GetOutput() ); + writer->Update(); + } + else + { + std::cout << "Writing test"<<std::endl; + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName( outputFilename ); + writer->SetInput( reader->GetOutput() ); + writer->Update(); + } + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx b/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx index a260f1bb78..b8367091ea 100755 --- a/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx +++ b/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx @@ -1,18 +1,18 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -31,81 +31,61 @@ int otbStreamingImageFileWriterTestCalculateNumberOfDivisions (int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - std::string MethodCalculateNumberOfStreamDivision(argv[3]); - - typedef unsigned int PixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< PixelType, Dimension > ImageType; - typedef otb::ImageFileReader< ImageType > ReaderType; - typedef otb::StreamingImageFileWriter< ImageType> StreamingWriterType; - - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); - - std::cout << "Streaming writing test"<<std::endl; - StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - - if( MethodCalculateNumberOfStreamDivision == "AUTOMATIC_NUMBER_OF_STREAM_DIVISIONS" ) - { - writer->SetAutomaticNumberOfStreamDivisions(); - } - else if( MethodCalculateNumberOfStreamDivision == "NUMBER_OF_STREAM_DIVISIONS" ) - { - writer->SetNumberOfStreamDivisions(::atoi(argv[4])); - } - else if( MethodCalculateNumberOfStreamDivision == "BUFFER_MEMORY_SIZE" ) - { - writer->SetBufferMemorySize(::atoi(argv[4])); - } - else if( MethodCalculateNumberOfStreamDivision == "BUFFER_NUMBER_OF_LINES" ) - { - writer->SetBufferNumberOfLinesDivisions(::atoi(argv[4])); - } - else if( MethodCalculateNumberOfStreamDivision == "TILING_STREAM_DIVISIONS" ) - { - writer->SetTilingStreamDivisions(); - } - else if( MethodCalculateNumberOfStreamDivision == "TILING_NUMBER_OF_STREAM_DIVISIONS" ) - { - std::cout << "Number : " << ::atoi(argv[4]) << std::endl; - writer->SetTilingStreamDivisions(::atoi(argv[4])); - } - else if( MethodCalculateNumberOfStreamDivision == "DEFAULT" ) - { - - } - else - { - itkGenericExceptionMacro(<<"Parameter value not authorized !!!"); - } - writer->Update(); + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + std::string MethodCalculateNumberOfStreamDivision(argv[3]); + typedef unsigned int PixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< PixelType, Dimension > ImageType; + typedef otb::ImageFileReader< ImageType > ReaderType; + typedef otb::StreamingImageFileWriter< ImageType> StreamingWriterType; + + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName( inputFilename ); + + std::cout << "Streaming writing test"<<std::endl; + StreamingWriterType::Pointer writer = StreamingWriterType::New(); + writer->SetFileName( outputFilename ); + writer->SetInput( reader->GetOutput() ); + + if( MethodCalculateNumberOfStreamDivision == "AUTOMATIC_NUMBER_OF_STREAM_DIVISIONS" ) + { + writer->SetAutomaticNumberOfStreamDivisions(); + } + else if( MethodCalculateNumberOfStreamDivision == "NUMBER_OF_STREAM_DIVISIONS" ) + { + writer->SetNumberOfStreamDivisions(::atoi(argv[4])); + } + else if( MethodCalculateNumberOfStreamDivision == "BUFFER_MEMORY_SIZE" ) + { + writer->SetBufferMemorySize(::atoi(argv[4])); + } + else if( MethodCalculateNumberOfStreamDivision == "BUFFER_NUMBER_OF_LINES" ) + { + writer->SetBufferNumberOfLinesDivisions(::atoi(argv[4])); + } + else if( MethodCalculateNumberOfStreamDivision == "TILING_STREAM_DIVISIONS" ) + { + writer->SetTilingStreamDivisions(); + } + else if( MethodCalculateNumberOfStreamDivision == "TILING_NUMBER_OF_STREAM_DIVISIONS" ) + { + std::cout << "Number : " << ::atoi(argv[4]) << std::endl; + writer->SetTilingStreamDivisions(::atoi(argv[4])); + } + else if( MethodCalculateNumberOfStreamDivision == "DEFAULT" ) + { - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << 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::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - + } + else + { + itkGenericExceptionMacro(<<"Parameter value not authorized !!!"); + } + writer->Update(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx b/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx index 16ad27ef76..54d32a310a 100755 --- a/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx +++ b/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx @@ -33,73 +33,59 @@ int otbStreamingImageFileWriterWithFilterTest (int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - unsigned int radius = atoi(argv[3]); - int iStreaming(::atoi(argv[4])); - bool streaming = (bool)(iStreaming); - int NumberOfStreamDivisions(10); - if( streaming == true ) - { - NumberOfStreamDivisions = ::atoi(argv[5]); - } + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + unsigned int radius = atoi(argv[3]); + int iStreaming(::atoi(argv[4])); + bool streaming = (bool)(iStreaming); + int NumberOfStreamDivisions(10); + if( streaming == true ) + { + NumberOfStreamDivisions = ::atoi(argv[5]); + } - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image< InputPixelType, Dimension > InputImageType; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::MeanImageFilter<InputImageType,OutputImageType> FilterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef itk::MeanImageFilter<InputImageType,OutputImageType> FilterType; - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); - FilterType::Pointer filter = FilterType::New(); - filter->SetInput(reader->GetOutput()); - InputImageType::SizeType rad; - rad.Fill(radius); - filter->SetRadius(rad); - - if( streaming == true ) - { - std::cout << "Streaming writing test"<<std::endl; - StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); - writer->SetInput( filter->GetOutput() ); - writer->Update(); - } - else - { - std::cout << "Writing test"<<std::endl; - WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName( inputFilename ); + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + InputImageType::SizeType rad; + rad.Fill(radius); + filter->SetRadius(rad); + + if( streaming == true ) + { + std::cout << "Streaming writing test"<<std::endl; + StreamingWriterType::Pointer writer = StreamingWriterType::New(); + writer->SetFileName( outputFilename ); + writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); + writer->SetInput( filter->GetOutput() ); + writer->Update(); + } + else + { + std::cout << "Writing test"<<std::endl; + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName( outputFilename ); + writer->SetInput( reader->GetOutput() ); + writer->Update(); + } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingImageFilterTest.cxx b/Testing/Code/IO/otbStreamingImageFilterTest.cxx index a2f8dea997..196a886fac 100755 --- a/Testing/Code/IO/otbStreamingImageFilterTest.cxx +++ b/Testing/Code/IO/otbStreamingImageFilterTest.cxx @@ -10,11 +10,11 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. -=========================================================================*/ + =========================================================================*/ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) @@ -31,52 +31,38 @@ int otbStreamingImageFilterTest (int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; - typedef itk::Image< InputPixelType, Dimension > InputImageType; - typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + typedef itk::Image< InputPixelType, Dimension > InputImageType; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - typedef itk::StreamingImageFilter<InputImageType,OutputImageType> StreamingImageFilterType; + typedef itk::StreamingImageFilter<InputImageType,OutputImageType> StreamingImageFilterType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - StreamingImageFilterType::Pointer streamer = StreamingImageFilterType::New(); + StreamingImageFilterType::Pointer streamer = StreamingImageFilterType::New(); - streamer->SetInput( reader->GetOutput() ); - streamer->SetNumberOfStreamDivisions( 10 ); - streamer->Update(); + streamer->SetInput( reader->GetOutput() ); + streamer->SetNumberOfStreamDivisions( 10 ); + streamer->Update(); - writer->SetInput( streamer->GetOutput() ); - writer->Update(); - - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( streamer->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx b/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx index 70c32c3407..dde63e95c5 100755 --- a/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx +++ b/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx @@ -10,11 +10,11 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. -=========================================================================*/ + =========================================================================*/ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) @@ -31,71 +31,53 @@ int otbStreamingShortImageFileWriterTest (int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - int iStreaming(::atoi(argv[3])); - bool streaming = (bool)(iStreaming); - int NumberOfStreamDivisions(10); - if( streaming == true ) - { - NumberOfStreamDivisions = ::atoi(argv[4]); - } + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + int iStreaming(::atoi(argv[3])); + bool streaming = (bool)(iStreaming); + int NumberOfStreamDivisions(10); + if( streaming == true ) + { + NumberOfStreamDivisions = ::atoi(argv[4]); + } - typedef unsigned short InputPixelType; - typedef unsigned short OutputPixelType; - const unsigned int Dimension = 2; + typedef unsigned short InputPixelType; + typedef unsigned short OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::StreamingImageFileWriter< OutputImageType> StreamingWriterType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); - - if( streaming == true ) - { - std::cout << "Streaming writing test"<<std::endl; - StreamingWriterType::Pointer writer = StreamingWriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - else - { - std::cout << "Writing test"<<std::endl; - WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName( inputFilename ); + + if( streaming == true ) + { + std::cout << "Streaming writing test"<<std::endl; + StreamingWriterType::Pointer writer = StreamingWriterType::New(); + writer->SetFileName( outputFilename ); + writer->SetNumberOfStreamDivisions( NumberOfStreamDivisions ); + writer->SetInput( reader->GetOutput() ); + writer->Update(); + } + else + { + std::cout << "Writing test"<<std::endl; + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName( outputFilename ); + writer->SetInput( reader->GetOutput() ); + writer->Update(); + } - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << 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::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorDataFileReader.cxx b/Testing/Code/IO/otbVectorDataFileReader.cxx index 5a72fa3fa7..6894809fc8 100644 --- a/Testing/Code/IO/otbVectorDataFileReader.cxx +++ b/Testing/Code/IO/otbVectorDataFileReader.cxx @@ -31,5 +31,5 @@ int otbVectorDataFileReader(int argc, char * argv[]) VectorDataType::Pointer data = reader->GetOutput(); std::cout<<data<<std::endl; - return 0; + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorDataFileReaderNew.cxx b/Testing/Code/IO/otbVectorDataFileReaderNew.cxx index ce10ed12f2..2ee75ee5ca 100644 --- a/Testing/Code/IO/otbVectorDataFileReaderNew.cxx +++ b/Testing/Code/IO/otbVectorDataFileReaderNew.cxx @@ -22,7 +22,9 @@ int otbVectorDataFileReaderNew(int argc, char * argv[]) { typedef otb::VectorData<> VectorDataType; - typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; - VectorDataFileReaderType::Pointer object = VectorDataFileReaderType::New(); - return 0; + typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; + VectorDataFileReaderType::Pointer object = VectorDataFileReaderType::New(); + + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorDataSourceNew.cxx b/Testing/Code/IO/otbVectorDataSourceNew.cxx index f26a38b517..6269921e72 100644 --- a/Testing/Code/IO/otbVectorDataSourceNew.cxx +++ b/Testing/Code/IO/otbVectorDataSourceNew.cxx @@ -22,7 +22,8 @@ int otbVectorDataSourceNew(int argc, char * argv[]) { typedef otb::VectorData<> VectorDataType; - typedef otb::VectorDataSource<VectorDataType> VectorDataSourceType; - VectorDataSourceType::Pointer object = VectorDataSourceType::New(); - return 0; + typedef otb::VectorDataSource<VectorDataType> VectorDataSourceType; + VectorDataSourceType::Pointer object = VectorDataSourceType::New(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx b/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx index 74cfe313b1..2e6649199f 100755 --- a/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx +++ b/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx @@ -1,18 +1,18 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -30,42 +30,30 @@ int otbVectorImageFileReaderWriterTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; - typedef otb::ImageFileReader< InputImageType > ReaderType; - typedef otb::ImageFileWriter< OutputImageType > WriterType; + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage< OutputPixelType, Dimension > OutputImageType; - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader->SetFileName( inputFilename ); - writer->SetFileName( outputFilename ); + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); - writer->SetInput( reader->GetOutput() ); - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } + writer->SetInput( reader->GetOutput() ); + writer->Update(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/IO/otbVectorImageTest.cxx b/Testing/Code/IO/otbVectorImageTest.cxx index b1d9927368..b60615f294 100755 --- a/Testing/Code/IO/otbVectorImageTest.cxx +++ b/Testing/Code/IO/otbVectorImageTest.cxx @@ -10,11 +10,11 @@ See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. -=========================================================================*/ + =========================================================================*/ #if defined(_MSC_VER) #pragma warning ( disable : 4786 ) @@ -33,116 +33,102 @@ int otbVectorImageTest(int argc, char* argv[]) { - try - { - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputAsciiFilename = argv[2]; - // unsigned int GCPnum((unsigned int)::atoi(argv[2])); + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * outputAsciiFilename = argv[2]; + // unsigned int GCPnum((unsigned int)::atoi(argv[2])); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + typedef unsigned char InputPixelType; + const unsigned int Dimension = 2; - std::ofstream file; + std::ofstream file; - file.open(outputAsciiFilename); + file.open(outputAsciiFilename); - typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; - InputImageType::Pointer image = InputImageType::New(); + InputImageType::Pointer image = InputImageType::New(); - typedef otb::ImageFileReader< InputImageType > ReaderType; + typedef otb::ImageFileReader< InputImageType > ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( inputFilename ); - reader->Update(); + reader->SetFileName( inputFilename ); + reader->Update(); - image = reader->GetOutput(); + image = reader->GetOutput(); - file << "------ IMAGE --------" << std::endl; - std::cout << "------ IMAGE --------" << std::endl; -// Image n'est pas ecrit dans le fichier car des pointeurs sont affichés, donc la valeur dépend de l'instanciation -// -> pour pouvoir faire de tests de non regression sur la sortie ecrite dans le fichier ASCII - std::cout << image << std::endl; - std::cout << "---------------------" << std::endl; + file << "------ IMAGE --------" << std::endl; + std::cout << "------ IMAGE --------" << std::endl; + // Image n'est pas ecrit dans le fichier car des pointeurs sont affichés, donc la valeur dépend de l'instanciation + // -> pour pouvoir faire de tests de non regression sur la sortie ecrite dans le fichier ASCII + std::cout << image << std::endl; + std::cout << "---------------------" << std::endl; - file << "Spacing " << image->GetSpacing() << std::endl; - file << "Origin " << image->GetOrigin() << std::endl; + file << "Spacing " << image->GetSpacing() << std::endl; + file << "Origin " << image->GetOrigin() << std::endl; - file << "Projection REF " << image->GetProjectionRef() << std::endl; + file << "Projection REF " << image->GetProjectionRef() << std::endl; - file << "GCP Projection " << image->GetGCPProjection() << std::endl; + file << "GCP Projection " << image->GetGCPProjection() << std::endl; - unsigned int GCPCount = image->GetGCPCount(); - file << "GCP Count " << image->GetGCPCount() << std::endl; + unsigned int GCPCount = image->GetGCPCount(); + file << "GCP Count " << image->GetGCPCount() << std::endl; - for(unsigned int GCPnum = 0 ; GCPnum < GCPCount ; GCPnum++ ) - { - file << "GCP[" << GCPnum << "] Id " << image->GetGCPId(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Info " << image->GetGCPInfo(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Row " << image->GetGCPRow(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Col " << image->GetGCPCol(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] X " << image->GetGCPX(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Y " << image->GetGCPY(GCPnum) << std::endl; - file << "GCP[" << GCPnum << "] Z " << image->GetGCPZ(GCPnum) << std::endl; - file << "----------------" << std::endl; - } + for(unsigned int GCPnum = 0 ; GCPnum < GCPCount ; GCPnum++ ) + { + file << "GCP[" << GCPnum << "] Id " << image->GetGCPId(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Info " << image->GetGCPInfo(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Row " << image->GetGCPRow(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Col " << image->GetGCPCol(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] X " << image->GetGCPX(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Y " << image->GetGCPY(GCPnum) << std::endl; + file << "GCP[" << GCPnum << "] Z " << image->GetGCPZ(GCPnum) << std::endl; + file << "----------------" << std::endl; + } - InputImageType::VectorType tab = image->GetGeoTransform(); - - file << "Geo Transform " << std::endl; - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " " <<i<<" -> "<<tab[i]<< std::endl; - } - tab.clear(); + InputImageType::VectorType tab = image->GetGeoTransform(); + + file << "Geo Transform " << std::endl; + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " " <<i<<" -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetUpperLeftCorner(); - file << "Corners " << std::endl; - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " UL[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetUpperLeftCorner(); + file << "Corners " << std::endl; + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " UL[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetUpperRightCorner(); - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " UR[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetUpperRightCorner(); + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " UR[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetLowerLeftCorner(); - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " LL[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetLowerLeftCorner(); + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " LL[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - tab = image->GetLowerRightCorner(); - for(unsigned int i = 0 ; i < tab.size() ; i++ ) - { - file << " LR[" <<i<<"] -> "<<tab[i]<< std::endl; - } - tab.clear(); + tab = image->GetLowerRightCorner(); + for(unsigned int i = 0 ; i < tab.size() ; i++ ) + { + file << " LR[" <<i<<"] -> "<<tab[i]<< std::endl; + } + tab.clear(); - file.close(); + file.close(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "Exception OTB attrappee dans exception ITK !" << std::endl; - std::cerr << err << std::endl; - return EXIT_FAILURE; - } - catch( ... ) - { - std::cerr << "Exception OTB non attrappee !" << std::endl; - return EXIT_FAILURE; - } - + return EXIT_SUCCESS; } -- GitLab