diff --git a/Testing/Code/Visu/CMakeLists.txt b/Testing/Code/Visu/CMakeLists.txt new file mode 100755 index 0000000000000000000000000000000000000000..315d32c67e01ca3faedb37da810a009528eadff9 --- /dev/null +++ b/Testing/Code/Visu/CMakeLists.txt @@ -0,0 +1,53 @@ + +IF( NOT OTB_DISABLE_CXX_TESTING ) + +# SUBDIRS( ImageViewer ImageColorViewer ) + +SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Images) +SET(INPUTDATA ${OTB_DATA_ROOT}/Input) +SET(TEMP ${OTBTesting_BINARY_DIR}/Temporary) + + +#Tolerance sur diff pixel image +SET(TOL 0.0) + +#SET(VISU_TESTS ${CXX_TEST_PATH}/otbVisuTests) + + +# ------- otb::ExtractROI ------------------------------ + + + +# ------- Fichiers sources CXX ----------------------------------- +#SET(BasicVisu_SRCS +#) + + +INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}") + +# ${TIFF_LIBRARY} + +#ADD_EXECUTABLE(otbVisuTests otbVisuTests.cxx ${BasicVisu_SRCS}) +#TARGET_LINK_LIBRARIES(otbVisuTests OTBIO OTBCommon ${CAI_LIBRARY} ${GDAL_LIBRARY} ITKIO ITKCommon) + + + + +#ADD_EXECUTABLE(otbFLTKImageViewer otbFLTKImageViewer.cxx) +#TARGET_LINK_LIBRARIES(otbFLTKImageViewer ITKFltkImageViewer OTBIO OTBCommon ITKIO ITKCommon) + +ADD_EXECUTABLE(otbImageViewer otbImageViewer.cxx) +TARGET_LINK_LIBRARIES(otbImageViewer ITKFltkImageViewer OTBVisu OTBIO OTBCommon ITKIO ITKCommon) + +ADD_EXECUTABLE(otbColorImageViewer otbColorImageViewer.cxx) +TARGET_LINK_LIBRARIES(otbColorImageViewer ITKFltkImageViewer OTBVisu OTBIO OTBCommon ITKIO ITKCommon) + + + +ENDIF( NOT OTB_DISABLE_CXX_TESTING ) + + +# ----------------------------------------------------------------------- +# Exemple test simple avec un "main" +# + diff --git a/Testing/Code/Visu/otbColorImageViewer.cxx b/Testing/Code/Visu/otbColorImageViewer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ad6914324bbd6da2b7a993dd0834120a9ff14a35 --- /dev/null +++ b/Testing/Code/Visu/otbColorImageViewer.cxx @@ -0,0 +1,60 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - T.Feuvrier + Language : C++ + Date : 11 janvier 2005 + Version : + Role : + $Id$ + +=========================================================================*/ +#include <stdlib.h> +#include "itkExceptionObject.h" + +#include "otbImageFileReader.h" +#include "itkImage.h" +#include "itkRGBPixel.h" + +#include "otbColorImageViewer.h" + +int main( int argc, char ** argv ) +{ + try + { + const char * inputFilename = argv[1]; + + typedef otb::ColorImageViewer<unsigned char,double> ViewerType; + typedef itk::Image< itk::RGBPixel<unsigned char>, 3 > ImageType; + typedef otb::ImageFileReader< ImageType > VolumeReaderType; + VolumeReaderType::Pointer lReader = VolumeReaderType::New(); + ViewerType lViewer; + + + lReader->SetFileName(inputFilename); + lReader->Update(); + lViewer.SetLabel( "Input Image" ); + lViewer.SetImage( lReader->GetOutput() ); + lViewer.Update(); + lViewer.Show(); + 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; + } + + + return EXIT_SUCCESS; +} + + diff --git a/Testing/Code/Visu/otbImageViewer.cxx b/Testing/Code/Visu/otbImageViewer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..55548c6d6604d25ad813e3f709ecc507a6b5f48d --- /dev/null +++ b/Testing/Code/Visu/otbImageViewer.cxx @@ -0,0 +1,60 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - T.Feuvrier + Language : C++ + Date : 11 janvier 2005 + Version : + Role : + $Id$ + +=========================================================================*/ +#include <stdlib.h> +#include "itkExceptionObject.h" + +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkImage.h" + +#include "otbImageViewer.h" + +int main( int argc, char ** argv ) +{ + try + { + const char * inputFilename = argv[1]; + + typedef otb::ImageViewer<unsigned char,double> ViewerType; + typedef itk::Image< unsigned char, 3 > ImageType; + typedef itk::ImageFileReader< ImageType > VolumeReaderType; + VolumeReaderType::Pointer lReader = VolumeReaderType::New(); + ViewerType lViewer; + + + lReader->SetFileName(inputFilename); + lReader->Update(); + lViewer.SetLabel( "Input Image" ); + lViewer.SetImage( lReader->GetOutput() ); + lViewer.Update(); + lViewer.Show(); + + 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; + } + + + return EXIT_SUCCESS; +} + + diff --git a/Testing/Code/Visu/otbVisuTests.cxx b/Testing/Code/Visu/otbVisuTests.cxx new file mode 100755 index 0000000000000000000000000000000000000000..33a8134ef2dec03445868fd61c20754fcec92ab6 --- /dev/null +++ b/Testing/Code/Visu/otbVisuTests.cxx @@ -0,0 +1,12 @@ +// this file defines the otbCommonTest for the test driver +// and all it expects is that you have a function called RegisterTests +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif +#include <iostream> +#include "otbTestMain.h" + +void RegisterTests() +{ +REGISTER_TEST(otbFLTKImageViewer); +}