diff --git a/Testing/Code/Visu/otbAlternateViewerTest.cxx b/Testing/Code/Visu/otbAlternateViewerTest.cxx index 7e2d99aedbe53087f8fa41e7f0651470d0da3721..b10b64eafbd0b1c46ae5edef75b202d2db6fbf1d 100644 --- a/Testing/Code/Visu/otbAlternateViewerTest.cxx +++ b/Testing/Code/Visu/otbAlternateViewerTest.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 "otbVectorImage.h" #include "otbVectorRescaleIntensityImageFilter.h" #include "otbImageFileReader.h" @@ -7,7 +25,7 @@ int otbAlternateViewerTest(int argc, char* argv[]) { - const unsigned int Dimension = 2; + const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage<PixelType,Dimension> ImageType; typedef otb::ImageFileReader<ImageType> ReaderType; @@ -24,23 +42,23 @@ int otbAlternateViewerTest(int argc, char* argv[]) ImageType::PixelType min,max; min.SetSize(reader->GetOutput()->GetNumberOfComponentsPerPixel()); max.SetSize(reader->GetOutput()->GetNumberOfComponentsPerPixel()); -// min[0]=195; -// min[1]=241; -// min[2]=127; -// min[3]=130; -// max[0]=387; -// max[1]=602; -// max[2]=469; -// max[3]=740; - min.Fill(0); - max.Fill(255); + // min[0]=195; + // min[1]=241; + // min[2]=127; + // min[3]=130; + // max[0]=387; + // max[1]=602; + // max[2]=469; + // max[3]=740; + min.Fill(0); + max.Fill(255); - // RescalerType::Pointer rescaler = RescalerType::New(); -// rescaler->SetOutputMinimum(min); -// rescaler->SetOutputMaximum(max); -// rescaler->SetInput(reader->GetOutput()); -// rescaler->SetClampThreshold(atof(argv[2])); -// rescaler->GenerateOutputInformation(); + // RescalerType::Pointer rescaler = RescalerType::New(); + // rescaler->SetOutputMinimum(min); + // rescaler->SetOutputMaximum(max); + // rescaler->SetInput(reader->GetOutput()); + // rescaler->SetClampThreshold(atof(argv[2])); + // rescaler->GenerateOutputInformation(); Fl_Window window(512,512); ViewerType::Pointer viewer = ViewerType::New(); diff --git a/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx b/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx index 6dffc7e6582d4bdb2ce62e637e00e2e858414ece..7d27c61f913c60f9f21341d033a6f854607b385e 100644 --- a/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx +++ b/Testing/Code/Visu/otbDoubleImageViewerWithLink.cxx @@ -22,64 +22,51 @@ int otbDoubleImageViewerWithLink( int argc, char * argv[] ) { - try - { - char * filename1 = argv[1]; - char * filename2 = argv[2]; + char * filename1 = argv[1]; + char * filename2 = argv[2]; - // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::OffsetType OffsetType; - typedef ImageViewerType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + // Parse command line parameters + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::OffsetType OffsetType; + typedef ImageViewerType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - // instantiation - ImageViewerType::Pointer viewer1 = ImageViewerType::New(); - ImageViewerType::Pointer viewer2 = ImageViewerType::New(); + // instantiation + ImageViewerType::Pointer viewer1 = ImageViewerType::New(); + ImageViewerType::Pointer viewer2 = ImageViewerType::New(); - // check for input images - ReaderType::Pointer reader1 = ReaderType::New(); - reader1->SetFileName(filename1); - reader1->GenerateOutputInformation(); - viewer1->SetImage(reader1->GetOutput()); + // check for input images + ReaderType::Pointer reader1 = ReaderType::New(); + reader1->SetFileName(filename1); + reader1->GenerateOutputInformation(); + viewer1->SetImage(reader1->GetOutput()); - ReaderType::Pointer reader2 = ReaderType::New(); - reader2->SetFileName(filename2); - reader2->GenerateOutputInformation(); - viewer2->SetImage(reader2->GetOutput()); + ReaderType::Pointer reader2 = ReaderType::New(); + reader2->SetFileName(filename2); + reader2->GenerateOutputInformation(); + viewer2->SetImage(reader2->GetOutput()); - // CASE 1: Simple link - viewer1->Link(viewer2); - viewer1->Show(); - viewer2->Show(); - Fl::check(); + // CASE 1: Simple link + viewer1->Link(viewer2); + viewer1->Show(); + viewer2->Show(); + Fl::check(); - // CASE 2: Unlink - viewer1->Unlink(viewer2); - viewer1->Show(); - viewer2->Show(); - Fl::check(); + // CASE 2: Unlink + viewer1->Unlink(viewer2); + viewer1->Show(); + viewer2->Show(); + Fl::check(); + + // CASE 3: Link with Offset + OffsetType offset; + offset.Fill(50); + viewer2->Link(viewer1,offset); + viewer1->Show(); + viewer2->Show(); + Fl::check(); - // CASE 3: Link with Offset - OffsetType offset; - offset.Fill(50); - viewer2->Link(viewer1,offset); - viewer1->Show(); - viewer2->Show(); - Fl::check(); - } - 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; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx b/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx index a1115cf41dc21ec52b35969cc99d9414275e0855..828bc7d3a2cf00fd071b3a5a95a8e352648bc755 100644 --- a/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx +++ b/Testing/Code/Visu/otbFixedSizeFullImageWidget.cxx @@ -22,80 +22,65 @@ PURPOSE. See the above copyright notices for more information. int otbFixedSizeFullImageWidget( int argc, char * argv[] ) { - try - { - char * filename = argv[1]; - typedef float PixelType; - typedef otb::FixedSizeFullImageWidget<PixelType> WidgetType; - typedef WidgetType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + char * filename = argv[1]; + typedef float PixelType; + typedef otb::FixedSizeFullImageWidget<PixelType> WidgetType; + typedef WidgetType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - ImageType::SizeType size; - ImageType::IndexType index; - ImageType::RegionType region; + ReaderType::Pointer reader = ReaderType::New(); + ImageType::SizeType size; + ImageType::IndexType index; + ImageType::RegionType region; - index[0]=0; - index[1]=0; - size[0]=1; - size[1]=1; - reader->SetFileName(filename); - reader->Update(); + index[0]=0; + index[1]=0; + size[0]=1; + size[1]=1; + reader->SetFileName(filename); + reader->Update(); - Fl_Window window(size[0],size[1]); + Fl_Window window(size[0],size[1]); - WidgetType::Pointer widget = WidgetType::New(); - window.resizable(widget.GetPointer()); - widget->SetInput(reader->GetOutput()); - if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) - { - widget->SetViewModel(WidgetType::RGB); - } - else - { - widget->SetViewModel(WidgetType::GRAYSCALE); - } - widget->Init(0,0,size[0],size[1],"Test Full Image Widget"); - widget->redraw(); - window.end(); - window.show(); - window.show(); - widget->Show(); - widget->redraw(); - Fl::check(); + WidgetType::Pointer widget = WidgetType::New(); + window.resizable(widget.GetPointer()); + widget->SetInput(reader->GetOutput()); + if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) + { + widget->SetViewModel(WidgetType::RGB); + } + else + { + widget->SetViewModel(WidgetType::GRAYSCALE); + } + widget->Init(0,0,size[0],size[1],"Test Full Image Widget"); + widget->redraw(); + window.end(); + window.show(); + window.show(); + widget->Show(); + widget->redraw(); + Fl::check(); - for(int i = 0;i<=400;i+=40) - { - Fl::check(); - window.resize(0,0,i,i); - Fl::wait(0.2); - Fl::check(); - } + for(int i = 0;i<=400;i+=40) + { + Fl::check(); + window.resize(0,0,i,i); + Fl::wait(0.2); + Fl::check(); + } - for(int i = 400;i>=0;i-=40) - { - Fl::check(); - window.resize(0,0,i,i); - Fl::wait(0.2); - Fl::check(); - } - // suppres child, without delete memory. - // delete memory is ITK respoability, since WidgetType::New() - window.remove(widget.GetPointer()); - } - - 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; - } - + for(int i = 400;i>=0;i-=40) + { + Fl::check(); + window.resize(0,0,i,i); + Fl::wait(0.2); + Fl::check(); + } + // suppres child, without delete memory. + // delete memory is ITK respoability, since WidgetType::New() + window.remove(widget.GetPointer()); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx b/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx index 332cd279657986189cbb3c4f23b16785ec8e3b11..262d09a1cec0fbc898e0edcecbfd5ceb0bceecc9 100644 --- a/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx +++ b/Testing/Code/Visu/otbFixedSizeFullImageWidgetNew.cxx @@ -19,26 +19,11 @@ PURPOSE. See the above copyright notices for more information. int otbFixedSizeFullImageWidgetNew( int argc, char * argv[] ) { - try - { - typedef float PixelType; - typedef otb::FixedSizeFullImageWidget<PixelType> WidgetType; - - WidgetType::Pointer widget = WidgetType::New(); - } - - 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; - } - + typedef float PixelType; + typedef otb::FixedSizeFullImageWidget<PixelType> WidgetType; + + WidgetType::Pointer widget = WidgetType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbFullResolutionImageWidget.cxx b/Testing/Code/Visu/otbFullResolutionImageWidget.cxx index d41e38f98f037208d7d00917b814ca1b43976094..e282d08b8e61c0605a6d3cf32a0fcaec8b2aae43 100644 --- a/Testing/Code/Visu/otbFullResolutionImageWidget.cxx +++ b/Testing/Code/Visu/otbFullResolutionImageWidget.cxx @@ -22,78 +22,64 @@ PURPOSE. See the above copyright notices for more information. int otbFullResolutionImageWidget( int argc, char * argv[] ) { - try - { - char * filename = argv[1]; - typedef float PixelType; - typedef otb::FullResolutionImageWidget<PixelType> WidgetType; - typedef WidgetType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + char * filename = argv[1]; + typedef float PixelType; + typedef otb::FullResolutionImageWidget<PixelType> WidgetType; + typedef WidgetType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); - ImageType::SizeType size; - ImageType::IndexType index; - ImageType::RegionType region; + ReaderType::Pointer reader = ReaderType::New(); + ImageType::SizeType size; + ImageType::IndexType index; + ImageType::RegionType region; - index[0]=0; - index[1]=0; - size[0]=1; - size[1]=1; - reader->SetFileName(filename); - reader->Update(); + index[0]=0; + index[1]=0; + size[0]=1; + size[1]=1; + reader->SetFileName(filename); + reader->Update(); - Fl_Window window(size[0],size[1]); + Fl_Window window(size[0],size[1]); - WidgetType::Pointer widget = WidgetType::New(); - window.resizable(widget.GetPointer()); - widget->SetInput(reader->GetOutput()); - if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) - widget->SetViewModel(WidgetType::RGB); - else - widget->SetViewModel(WidgetType::GRAYSCALE); - widget->SetUpperLeftCorner(index); - widget->Init(0,0,size[0],size[1],"Test Full Resolution Widget"); - widget->redraw(); - window.end(); - window.show(); - window.show(); - widget->Show(); - widget->redraw(); - Fl::check(); + WidgetType::Pointer widget = WidgetType::New(); + window.resizable(widget.GetPointer()); + widget->SetInput(reader->GetOutput()); + if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) + widget->SetViewModel(WidgetType::RGB); + else + widget->SetViewModel(WidgetType::GRAYSCALE); + widget->SetUpperLeftCorner(index); + widget->Init(0,0,size[0],size[1],"Test Full Resolution Widget"); + widget->redraw(); + window.end(); + window.show(); + window.show(); + widget->Show(); + widget->redraw(); + Fl::check(); - int StepX =(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]-size[0])/100; - int StepY =(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]-size[1])/100; - for(int i = 0;i<=100;i+=5) - { - Fl::check(); - window.resize(0,0,size[0]+i*StepX,size[1]+i*StepY); - Fl::wait(0.2); - Fl::check(); - } + int StepX =(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]-size[0])/100; + int StepY =(reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]-size[1])/100; + for(int i = 0;i<=100;i+=5) + { + Fl::check(); + window.resize(0,0,size[0]+i*StepX,size[1]+i*StepY); + Fl::wait(0.2); + Fl::check(); + } - for(int i = 100;i>=0;i-=5) - { - Fl::check(); - window.resize(0,0,size[0]+i*StepX,size[1]+i*StepY); - Fl::wait(0.2); - Fl::check(); - } - // suppres child, without delete memory. - // delete memory is ITK respoability, since WidgetType::New() - window.remove(widget.GetPointer()); - } - - 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; - } + for(int i = 100;i>=0;i-=5) + { + Fl::check(); + window.resize(0,0,size[0]+i*StepX,size[1]+i*StepY); + Fl::wait(0.2); + Fl::check(); + } + // suppres child, without delete memory. + // delete memory is ITK respoability, since WidgetType::New() + window.remove(widget.GetPointer()); + return EXIT_SUCCESS; diff --git a/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx b/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx index 0dd20fe47f08c2b2871bf098a998c48c5f872d93..f496dcbf71cd78ed57f316b40fa508efa5f23bb2 100644 --- a/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx +++ b/Testing/Code/Visu/otbFullResolutionImageWidgetNew.cxx @@ -19,26 +19,11 @@ PURPOSE. See the above copyright notices for more information. int otbFullResolutionImageWidgetNew( int argc, char * argv[] ) { - try - { - typedef float PixelType; - typedef otb::FullResolutionImageWidget<PixelType> WidgetType; - - WidgetType::Pointer widget = WidgetType::New(); - } - - 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; - } - + typedef float PixelType; + typedef otb::FullResolutionImageWidget<PixelType> WidgetType; + + WidgetType::Pointer widget = WidgetType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx index da0feb9bc46f708a8e1a14a2b03c3093d9c59d5d..da1a47f5becd406e8b30edf897caca479dde0c92 100644 --- a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx +++ b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilter.cxx @@ -25,44 +25,30 @@ int otbImageToGrayscaleAnaglyphImageFilter(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef double PixelType; + const unsigned int Dimension = 2; + typedef double PixelType; + + typedef otb::Image<PixelType,Dimension> ImageType; + typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType,ImageType,VectorImageType> FilterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; + + // Instantiating object + FilterType::Pointer filter = FilterType::New(); + ReaderType::Pointer reader1 = ReaderType::New(); + ReaderType::Pointer reader2 = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader1->SetFileName(argv[1]); + reader2->SetFileName(argv[2]); + writer->SetFileName(argv[3]); + + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + writer->SetInput(filter->GetOutput()); + writer->Update(); + - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType,ImageType,VectorImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; - - // Instantiating object - FilterType::Pointer filter = FilterType::New(); - ReaderType::Pointer reader1 = ReaderType::New(); - ReaderType::Pointer reader2 = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - reader1->SetFileName(argv[1]); - reader2->SetFileName(argv[2]); - writer->SetFileName(argv[3]); - - filter->SetInput1(reader1->GetOutput()); - filter->SetInput2(reader2->GetOutput()); - writer->SetInput(filter->GetOutput()); - 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; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx index 00f77151ba3a5ee4115219807c88b5fab2c9b7a4..edd576f0605dcf0b76c87c2b6f1deb8cd676688f 100644 --- a/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx +++ b/Testing/Code/Visu/otbImageToGrayscaleAnaglyphImageFilterNew.cxx @@ -23,30 +23,15 @@ int otbImageToGrayscaleAnaglyphImageFilterNew(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef unsigned char PixelType; - - typedef otb::Image<PixelType,Dimension> ImageType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType,ImageType,VectorImageType> FilterType; - - // Instantiating object - FilterType::Pointer object = FilterType::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 unsigned char PixelType; + + typedef otb::Image<PixelType,Dimension> ImageType; + typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::ImageToGrayscaleAnaglyphImageFilter<ImageType,ImageType,VectorImageType> FilterType; + + // Instantiating object + FilterType::Pointer object = FilterType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageViewer.cxx b/Testing/Code/Visu/otbImageViewer.cxx index 61dc624d9cbafa2d40f852c8953442d9f67e67cb..a02cbc2e4755a8dbd25ec4e08671b0a8bf7f49c3 100644 --- a/Testing/Code/Visu/otbImageViewer.cxx +++ b/Testing/Code/Visu/otbImageViewer.cxx @@ -22,47 +22,35 @@ int otbImageViewer( int argc, char * argv[] ) { - try - { - char * filename = argv[1]; - - // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::ImageType ImageType; - typedef ImageViewerType::ViewModelType ViewModelType; - typedef otb::ImageFileReader<ImageType> ReaderType; + char * filename = argv[1]; + + // Parse command line parameters + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::ImageType ImageType; + typedef ImageViewerType::ViewModelType ViewModelType; + typedef otb::ImageFileReader<ImageType> ReaderType; - ViewModelType mode = static_cast<ViewModelType>(atoi(argv[2])); + ViewModelType mode = static_cast<ViewModelType>(atoi(argv[2])); - // instantiation - ImageViewerType::Pointer viewer = ImageViewerType::New(); + // instantiation + ImageViewerType::Pointer viewer = ImageViewerType::New(); - // check for input images - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(filename); - reader->GenerateOutputInformation(); - viewer->SetImage(reader->GetOutput()); + // check for input images + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(filename); + reader->GenerateOutputInformation(); + viewer->SetImage(reader->GetOutput()); - // build the app - viewer->Build(); - viewer->SetViewModel(mode); - viewer->Show(); + // build the app + viewer->Build(); + viewer->SetViewModel(mode); + viewer->Show(); - Fl::check(); - // Fl::run(); - } - 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; - } + Fl::check(); + // Fl::run(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageViewerNew.cxx b/Testing/Code/Visu/otbImageViewerNew.cxx index 76754e526b6ab2cb6df8364c82bf70354d49df96..664a9973e13f943520a3fc89598ba894db85431a 100644 --- a/Testing/Code/Visu/otbImageViewerNew.cxx +++ b/Testing/Code/Visu/otbImageViewerNew.cxx @@ -22,25 +22,12 @@ int otbImageViewerNew( int argc, char * argv[] ) { - try - { - // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - // instantiation - ImageViewerType::Pointer viewer = ImageViewerType::New(); - } - 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; - } + // Parse command line parameters + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + // instantiation + ImageViewerType::Pointer viewer = ImageViewerType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx b/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx index 0cd47f66d5869cfebb66a6717e3ad1aaeecc7e5e..963e84cadb1595d35bd2ab2ccd0d808ad913dabb 100644 --- a/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx +++ b/Testing/Code/Visu/otbImageViewerWithMultiBandFilter.cxx @@ -26,51 +26,38 @@ int otbImageViewerWithMultiBandFilter( int argc, char * argv[] ) { - try - { - char * filename = argv[1]; + char * filename = argv[1]; - // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::ImageType VectorImageType; - typedef ImageViewerType::SingleImageType ImageType; - typedef itk::SobelEdgeDetectionImageFilter<ImageType,ImageType> FilterType; - typedef otb::PerBandVectorImageFilter<VectorImageType,VectorImageType,FilterType> - PerBandFilterType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - - // instantiation - ImageViewerType::Pointer viewer = ImageViewerType::New(); - PerBandFilterType::Pointer filter = PerBandFilterType::New(); - - // check for input images - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(filename); - - filter->SetInput(reader->GetOutput()); - filter->UpdateOutputInformation(); - - std::cout<<"Main - number of bands: "<<filter->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl; - std::cout<<"Main - largest region: "<<filter->GetOutput()->GetLargestPossibleRegion()<<std::endl; - - viewer->SetImage(filter->GetOutput()); - - // build the app - viewer->Show(); - Fl::check(); - } - 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; - } + // Parse command line parameters + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::ImageType VectorImageType; + typedef ImageViewerType::SingleImageType ImageType; + typedef itk::SobelEdgeDetectionImageFilter<ImageType,ImageType> FilterType; + typedef otb::PerBandVectorImageFilter<VectorImageType,VectorImageType,FilterType> + PerBandFilterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + + // instantiation + ImageViewerType::Pointer viewer = ImageViewerType::New(); + PerBandFilterType::Pointer filter = PerBandFilterType::New(); + + // check for input images + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(filename); + + filter->SetInput(reader->GetOutput()); + filter->UpdateOutputInformation(); + + std::cout<<"Main - number of bands: "<<filter->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl; + std::cout<<"Main - largest region: "<<filter->GetOutput()->GetLargestPossibleRegion()<<std::endl; + + viewer->SetImage(filter->GetOutput()); + + // build the app + viewer->Show(); + Fl::check(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx b/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx index 686bd21dcbea565f62059ee40719bdc3ff18585b..dbbbf9ce98ade53dbc605c552ca7e8991273286d 100644 --- a/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx +++ b/Testing/Code/Visu/otbImageViewerWithOtbImage.cxx @@ -22,40 +22,28 @@ int otbImageViewerWithOtbImage( int argc, char * argv[] ) { - try - { - char * filename = argv[1]; - - // Parse command line parameters - typedef double PixelType; - typedef otb::ImageViewer<PixelType> ImageViewerType; - typedef ImageViewerType::SingleImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + char * filename = argv[1]; + + // Parse command line parameters + typedef double PixelType; + typedef otb::ImageViewer<PixelType> ImageViewerType; + typedef ImageViewerType::SingleImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; - // instantiation - ImageViewerType::Pointer viewer = ImageViewerType::New(); + // instantiation + ImageViewerType::Pointer viewer = ImageViewerType::New(); - // check for input images - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(filename); - reader->GenerateOutputInformation(); - viewer->SetImage(reader->GetOutput()); + // check for input images + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(filename); + reader->GenerateOutputInformation(); + viewer->SetImage(reader->GetOutput()); - // build the app - viewer->Show(); - Fl::check(); - } - 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; - } + // build the app + viewer->Show(); + Fl::check(); + + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbImageWidgetBaseNew.cxx b/Testing/Code/Visu/otbImageWidgetBaseNew.cxx index 2f7e49f3c572abc07a168f5fe788d7dd8d828810..27add946e81ccd9d895185ff0879bd78abaf0bf3 100644 --- a/Testing/Code/Visu/otbImageWidgetBaseNew.cxx +++ b/Testing/Code/Visu/otbImageWidgetBaseNew.cxx @@ -19,26 +19,11 @@ PURPOSE. See the above copyright notices for more information. int otbImageWidgetBaseNew( int argc, char * argv[] ) { - try - { - typedef float PixelType; - typedef otb::ImageWidgetBase<PixelType> WidgetType; + typedef float PixelType; + typedef otb::ImageWidgetBase<PixelType> WidgetType; - WidgetType::Pointer widget = WidgetType::New(); - } - - 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; - } - + WidgetType::Pointer widget = WidgetType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx index cc7860bcfc1cca7d98209c6ad5b7e7524b466c28..741ff2c58d7cee2c90c8817eac50811359f52269 100644 --- a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx +++ b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilter.cxx @@ -24,43 +24,28 @@ int otbVectorImageToColorAnaglyphVectorImageFilter(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef unsigned char PixelType; + const unsigned int Dimension = 2; + typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType,VectorImageType,VectorImageType> FilterType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; + typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType,VectorImageType,VectorImageType> FilterType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> WriterType; - // Instantiating object - FilterType::Pointer filter = FilterType::New(); - ReaderType::Pointer reader1 = ReaderType::New(); - ReaderType::Pointer reader2 = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); + // Instantiating object + FilterType::Pointer filter = FilterType::New(); + ReaderType::Pointer reader1 = ReaderType::New(); + ReaderType::Pointer reader2 = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); - reader1->SetFileName(argv[1]); - reader2->SetFileName(argv[2]); - writer->SetFileName(argv[3]); + reader1->SetFileName(argv[1]); + reader2->SetFileName(argv[2]); + writer->SetFileName(argv[3]); - filter->SetInput1(reader1->GetOutput()); - filter->SetInput2(reader2->GetOutput()); - writer->SetInput(filter->GetOutput()); - writer->Update(); - } + filter->SetInput1(reader1->GetOutput()); + filter->SetInput2(reader2->GetOutput()); + writer->SetInput(filter->GetOutput()); + 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; - } return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx index ea29183991be35db28134dc0274369639132be9c..26bf61e5fa644cfba5f59e721e750712f30312d2 100644 --- a/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx +++ b/Testing/Code/Visu/otbVectorImageToColorAnaglyphVectorImageFilterNew.cxx @@ -22,29 +22,14 @@ int otbVectorImageToColorAnaglyphVectorImageFilterNew(int argc, char * argv[]) { - try - { - const unsigned int Dimension = 2; - typedef unsigned char PixelType; - - typedef otb::VectorImage<PixelType,Dimension> VectorImageType; - typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType,VectorImageType,VectorImageType> FilterType; - - // Instantiating object - FilterType::Pointer object = FilterType::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 unsigned char PixelType; + + typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::VectorImageToColorAnaglyphVectorImageFilter<VectorImageType,VectorImageType,VectorImageType> FilterType; + + // Instantiating object + FilterType::Pointer object = FilterType::New(); + return EXIT_SUCCESS; } diff --git a/Testing/Code/Visu/otbZoomableImageWidget.cxx b/Testing/Code/Visu/otbZoomableImageWidget.cxx index f619cee73025eee2f1fde658d6d6c0c48d58ad25..063f27bb7c2604d645ae81b21b4bcc47fd393926 100644 --- a/Testing/Code/Visu/otbZoomableImageWidget.cxx +++ b/Testing/Code/Visu/otbZoomableImageWidget.cxx @@ -22,82 +22,66 @@ PURPOSE. See the above copyright notices for more information. int otbZoomableImageWidget( int argc, char * argv[] ) { - try - { - char * filename = argv[1]; - typedef float PixelType; - typedef otb::ZoomableImageWidget<PixelType> WidgetType; - typedef WidgetType::ImageType ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + char * filename = argv[1]; + typedef float PixelType; + typedef otb::ZoomableImageWidget<PixelType> WidgetType; + typedef WidgetType::ImageType ImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + + ReaderType::Pointer reader = ReaderType::New(); + ImageType::SizeType size; + ImageType::IndexType index; + ImageType::RegionType region; + reader->SetFileName(filename); + reader->Update(); + size=reader->GetOutput()->GetLargestPossibleRegion().GetSize(); + + Fl_Window window(size[0],size[1]); + + WidgetType::Pointer widget = WidgetType::New(); + window.resizable(widget.GetPointer()); + widget->SetInput(reader->GetOutput()); + if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) + widget->SetViewModel(WidgetType::RGB); + else + widget->SetViewModel(WidgetType::GRAYSCALE); + widget->Init(0,0,size[0],size[1],"Test Full Image Widget"); + widget->redraw(); + window.end(); + window.show(); + window.show(); + widget->Show(); + widget->redraw(); + Fl::check(); + + for(double zoom = 1.0;zoom<10.;zoom++) + { + Fl::check(); - ReaderType::Pointer reader = ReaderType::New(); - ImageType::SizeType size; - ImageType::IndexType index; - ImageType::RegionType region; - reader->SetFileName(filename); - reader->Update(); - size=reader->GetOutput()->GetLargestPossibleRegion().GetSize(); - - Fl_Window window(size[0],size[1]); - - WidgetType::Pointer widget = WidgetType::New(); - window.resizable(widget.GetPointer()); - widget->SetInput(reader->GetOutput()); - if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3) - widget->SetViewModel(WidgetType::RGB); - else - widget->SetViewModel(WidgetType::GRAYSCALE); - widget->Init(0,0,size[0],size[1],"Test Full Image Widget"); + index[0]=size[0]/2-static_cast<int>(static_cast<double>(size[0]/2)/zoom+0.5); + index[1]=size[1]/2-static_cast<int>(static_cast<double>(size[1]/2)/zoom+0.5); + widget->SetZoomUpperLeftCorner(index); + widget->SetZoomFactor(zoom); widget->redraw(); - window.end(); - window.show(); - window.show(); - widget->Show(); + Fl::wait(0.2); + Fl::check(); + } + + for(double zoom=10.;zoom>=1.;zoom--) + { + Fl::check(); + index[0]=size[0]/2-static_cast<int>(static_cast<double>(size[0])/(2*zoom)+0.5); + index[1]=size[1]/2-static_cast<int>(static_cast<double>(size[1])/(2*zoom)+0.5); + widget->SetZoomUpperLeftCorner(index); + widget->SetZoomFactor(zoom); widget->redraw(); + Fl::wait(0.2); Fl::check(); - - for(double zoom = 1.0;zoom<10.;zoom++) - { - Fl::check(); - - index[0]=size[0]/2-static_cast<int>(static_cast<double>(size[0]/2)/zoom+0.5); - index[1]=size[1]/2-static_cast<int>(static_cast<double>(size[1]/2)/zoom+0.5); - widget->SetZoomUpperLeftCorner(index); - widget->SetZoomFactor(zoom); - widget->redraw(); - Fl::wait(0.2); - Fl::check(); - } - - for(double zoom=10.;zoom>=1.;zoom--) - { - Fl::check(); - index[0]=size[0]/2-static_cast<int>(static_cast<double>(size[0])/(2*zoom)+0.5); - index[1]=size[1]/2-static_cast<int>(static_cast<double>(size[1])/(2*zoom)+0.5); - widget->SetZoomUpperLeftCorner(index); - widget->SetZoomFactor(zoom); - widget->redraw(); - Fl::wait(0.2); - Fl::check(); - } - - // suppres child, without delete memory. - // delete memory is ITK respoability, since WidgetType::New() - window.remove(widget.GetPointer()); - } + } - 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; - } - + // suppres child, without delete memory. + // delete memory is ITK respoability, since WidgetType::New() + window.remove(widget.GetPointer()); return EXIT_SUCCESS; }