diff --git a/Documentation/Cookbook/rst/conf.py.in b/Documentation/Cookbook/rst/conf.py.in index 30ce0dc728056846e6a2bdf192840a2beb1b0df6..1e4442b07f398766735fa3898e75692c5b9d52d4 100644 --- a/Documentation/Cookbook/rst/conf.py.in +++ b/Documentation/Cookbook/rst/conf.py.in @@ -211,7 +211,7 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index_TOC', 'CookBook-@OTB_VERSION_MAJOR@.@OTB_VERSION_MINOR@.tex', u'OTB CookBook Documentation', + ('index_TOC', 'CookBook-@OTB_VERSION_MAJOR@.@OTB_VERSION_MINOR@.@OTB_VERSION_PATCH@.tex', u'OTB CookBook Documentation', u'OTB Team', 'manual'), ] diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx index af68ad38efab6be1f3465a7b5d2c9626fbc481d7..c721aa0a9b032bc563aff963c7c37f5dc8eedd4e 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx @@ -591,7 +591,7 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> { for (unsigned int c = 0; c < threadSecondOrder.Cols(); ++c) { - threadSecondOrder(r, c) += vectorValue[r] * vectorValue[c]; + threadSecondOrder(r, c) += static_cast<PrecisionType>(vectorValue[r]) * static_cast<PrecisionType>(vectorValue[c]); } } threadSecondOrderComponent += vectorValue.GetSquaredNorm(); diff --git a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h index 3ae223763f6392aa498f81f9fcaf5776f3211a9f..5b7d6b66cf3a055353803aae37cf06821d58c8be 100644 --- a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h +++ b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h @@ -150,7 +150,7 @@ public slots: /** */ - void ImportImages( const QStringList & filenames ); + void ImportImages( const QStringList & filenames, bool enableOverviews ); /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ diff --git a/Modules/Visualization/Monteverdi/src/main.cxx b/Modules/Visualization/Monteverdi/src/main.cxx index e44dbb8459d0b239c8bc5c5283d5c41a6412d7ef..1765c73bec64c6ba02f19ef8ba06187c1289cf66 100644 --- a/Modules/Visualization/Monteverdi/src/main.cxx +++ b/Modules/Visualization/Monteverdi/src/main.cxx @@ -1,5 +1,6 @@ /* * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * Copyright (C) 2017 CS Systemes d'Information (CS SI) * * This file is part of Orfeo Toolbox * @@ -31,6 +32,8 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. +#include <QCoreApplication> +#include <QFile> #include <QPixmap> #include <QSplashScreen> @@ -48,6 +51,7 @@ // // Monteverdi includes (sorted by alphabetic order) +#include "mvdAlgorithm.h" #include "mvdApplication.h" #include "mvdMainWindow.h" @@ -65,34 +69,39 @@ struct Flags { Flags() : loadOTBApplications( false ), - forceNoGLSL( false ) + forceNoGLSL( false ), + forceNoOverviews( false ) { } bool loadOTBApplications: 1; bool forceNoGLSL: 1; + bool forceNoOverviews: 1; }; /*****************************************************************************/ /* FUNCTIONS DECLARATION */ /*****************************************************************************/ +void +DisplayUsage( const char * ); +void +AppendFromTextFile( QStringList &, const QString & ); /*****************************************************************************/ /* MAIN */ /*****************************************************************************/ int -main( int argc, char* argv[] ) +main( int argc, char * argv[] ) { QApplication qtApp( argc, argv ); - Flags flags; // // 0. Splash-screen. #if USE_SPLASH_SCREEN - QPixmap pixmap(QLatin1String( ":/images/application_splash" )); - QSplashScreen splash(pixmap); + QPixmap pixmap( QLatin1String( ":/images/application_splash" ) ); + QSplashScreen splash( pixmap ); splash.show(); qtApp.processEvents();//This is used to accept a click on the screen so that user can cancel the screen #endif @@ -100,24 +109,16 @@ main( int argc, char* argv[] ) // // 0bis. Parse pre-initialization command-line arguments. QStringList args( qtApp.arguments() ); + Flags flags; { + QStringList filenames; + for( QStringList::iterator it( args.begin() ); it!=args.end(); ) if( it->compare( "-h" )==0 || it->compare( "--help" )==0 ) { - std::cout - << mvd::ToLocalStdString( - QCoreApplication::translate( - PROJECT_NAME, - "Usage: %1 [-h|--help] [-a|--applications] [<filename>...]\n" - " -n, --no-glsl force OpenGL 1.x compatible rendering." - " -a, --applications load OTB-applications from OTB_APPLICATIONS_PATH." - " -h, --help display this help message.\n" - ) - .arg( QFileInfo( argv[ 0 ] ).baseName() ) - ) - << std::endl; + DisplayUsage( argv[ 0 ] ); return ERROR_CODE_USAGE; } @@ -130,15 +131,44 @@ main( int argc, char* argv[] ) it = args.erase( it ); } - else if(it->compare( "-n" )==0 || + else if(it->compare( "-g" )==0 || it->compare( "--no-glsl" )==0 ) { flags.forceNoGLSL = true; it = args.erase( it ); } + + else if(it->compare( "-o" )==0 || + it->compare( "--no-overviews" )==0 ) + { + flags.forceNoOverviews = true; + + it = args.erase( it ); + } + + else if(it->compare( "-t" )==0 || + it->compare( "--txt-file" )==0 ) + { + it = args.erase( it ); + + if( it==args.end() || + it->startsWith( '-' ) ) + { + DisplayUsage( argv[ 0 ] ); + + return ERROR_CODE_USAGE; + } + + AppendFromTextFile( filenames, *it ); + + it = args.erase( it ); + } + else ++ it; + + args << filenames; } // @@ -205,14 +235,14 @@ main( int argc, char* argv[] ) #if USE_OTB_APPS mainWindow.SetupOTBApplications(); #else // USE_OTB_APPS - qWarning() << "OTB-applications support is not included in this build."; + qWarning() << "OTB-applications support is not included in this build."; #endif // USE_OTB_APPS // // 6. Load command-line filenames. args.pop_front(); - mainWindow.ImportImages( args ); + mainWindow.ImportImages( args, !flags.forceNoOverviews ); // // 6. Let's go: run the application and return exit code. @@ -232,3 +262,63 @@ main( int argc, char* argv[] ) /*****************************************************************************/ /* FUNCTIONS IMPLEMENTATION */ /*****************************************************************************/ +void +DisplayUsage( const char * argv0 ) +{ + std::cout + << mvd::ToLocalStdString( + QCoreApplication::translate( + PROJECT_NAME, + "Usage: %1 " + "[-h|--help] " + "[-a|--applications] " + "[-g|--no-glsl] " + "[-o|--no-overviews] " + "[-t|--txt-file <filename>] " + "[<filename>...]\n" + " -a, --applications load OTB-applications from OTB_APPLICATIONS_PATH.\n" +#if 0 + " -f, --file load Monteverdi project file.\n" +#endif + " -h, --help display this help message.\n" + " -g, --no-glsl force OpenGL 1.x compatible rendering.\n" + " -o, --no-overviews ignore build GDAL overviews step.\n" +#if 0 + " -O, --force-overviews force build GDAL overviews step.\n" +#endif + " -t, --txt-file read layer filenames from text file.\n" +#if 0 + " -c, --csv-file read layer filenames & settings from CSV file.\n" + " -x, --xml-file read layer filenames & settings from XML file.\n" +#endif + ) + .arg( QFileInfo( argv0 ).baseName() ) + ) + << std::endl; +} + +/*****************************************************************************/ +void +AppendFromTextFile( QStringList & strings, + const QString & filename ) +{ + QFile file( filename ); + + if( !file.open( QFile::ReadOnly | QFile::Text ) ) + throw mvd::SystemError( + mvd::ToStdString( + QCoreApplication::translate( "mvd::", "Failed to open '%1'" ) + .arg( filename ) + ) + ); + + QTextStream is( &file ); + + while( !is.atEnd() ) + { + QString line( is.readLine() ); + + if( !line.isNull() ) + strings << line; + } +} diff --git a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx index 9420452e321f19bb13b9ba6521c5b79ae9415280..f02f3537d0a550a288d5cd17b108c8df503d59d2 100644 --- a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx +++ b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx @@ -1,5 +1,6 @@ /* * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * Copyright (C) 2017 CS Systemes d'Information (CS SI) * * This file is part of Orfeo Toolbox * @@ -1362,7 +1363,7 @@ MainWindow /*****************************************************************************/ void MainWindow -::ImportImages( const QStringList & filenames ) +::ImportImages( const QStringList & filenames, bool enableOverviews ) { if( filenames.isEmpty() ) return; @@ -1376,7 +1377,8 @@ MainWindow ) ); - if( !( value.isValid() ? value.toBool() : OVERVIEWS_ENABLED_DEFAULT ) || + if( enableOverviews && + ( value.isValid() ? value.toBool() : OVERVIEWS_ENABLED_DEFAULT ) && !BuildGDALOverviews( filenames ) ) return; } @@ -1809,7 +1811,8 @@ MainWindow // Select filename. QString caption(tr("Open file...")); ImportImages( - otb::GetOpenFileNames( this, caption ) + otb::GetOpenFileNames( this, caption ), + true ); }