Commit 8117cdbc authored by Manuel Grizonnet's avatar Manuel Grizonnet

Merge branch 'develop' into bug-1639

parents 8e593b1c cdd1f85f
......@@ -8,18 +8,15 @@ OTB. In this chapter, we will make reference either to \emph{OTB
features} or \emph{ITK features} without distinction. Bear in mind
that OTB uses ITK as its core element, so all the fundamental elements
of OTB come from ITK. OTB extends the functionalities of ITK for the
remote sensing image processing comunity. We benefit from the Open
remote sensing image processing community. We benefit from the Open
Source development approach chosen for ITK, which allows us to provide
an impressive set of functionalities with much lesser effort than it
an impressive set of functionalities with much less effort than
would have been the case in a closed source universe!
\section{System Organization}
\label{sec:SystemOrganization}
The ORFEO Toolbox consists of several subsystems. A brief
description of these subsystems follows. Later sections in this chapter---and
in some cases additional chapters---cover these concepts in more detail. (Note:
in the previous chapter, another module---\code{OTB-Documents} is briefly described.)
The Orfeo Toolbox consists of several subsystems:
\begin{description}
\item[Essential System Concepts.] Like any software system, OTB is
......@@ -120,14 +117,14 @@ found in ITK and therefore also in OTB.
\index{template}
Generic programming is a method of organizing libraries consisting of
generic---or reusable---software components \cite{Musser1996}. The idea is to
generic---or reusable---software components. The idea is to
make software that is capable of ``plugging together'' in an efficient,
adaptable manner. The essential ideas of generic programming are
\emph{containers} to hold data, \emph{iterators} to access the data, and
\emph{generic algorithms} that use containers and iterators to create
efficient, fundamental algorithms such as sorting. Generic programming is
implemented in C++ with the \emph{template} programming mechanism and the
use of the STL Standard Template Library \cite{Austern1999}.
use of the STL Standard Template Library.
C++ templating is a programming technique allowing users to write software in
terms of one or more unknown types \code{T}. To create executable code, the
......@@ -148,8 +145,7 @@ compiler can optimize the code to deliver maximal performance. The
disadvantage of generic programming is that many compilers still do not
support these advanced concepts and cannot compile OTB. And even if they do,
they may produce completely undecipherable error messages due to even the
simplest syntax errors. If you are not familiar with templated code and
generic programming, we recommend the two books cited above.
simplest syntax errors.
\subsection{Include Files and Class Definitions}
\label{sec:IncludeFiles}
......@@ -205,7 +201,7 @@ specialized image processing hardware (i.e., to realize a performance
gain). By using the object factory mechanism, it is possible at run-time to
replace the creation of a particular OTB filter with such a custom class. (Of
course, the class must provide the exact same API as the one it is
replacing.) To do this, the user compiles her class (using the same compiler,
replacing.) To do this, the user compiles their class (using the same compiler,
build options, etc.) and inserts the object code into a shared library or
DLL. The library is then placed in a directory referred to by the
\code{OTB\_AUTOLOAD\_PATH} environment variable. On instantiation, the object
......@@ -356,7 +352,7 @@ can trap \emph{any} OTB exception by catching ExceptionObject.
\index{InvokeEvent()}
Event handling in OTB is implemented using the Subject/Observer design
pattern \cite{Gamma1995} (sometimes referred to as the Command/Observer
pattern (sometimes referred to as the Command/Observer
design pattern). In this approach, objects indicate that they are watching
for a particular event---invoked by a particular instance--by registering
with the instance that they are watching. For example, filters in OTB
......@@ -432,7 +428,7 @@ Invoking methods on the same instance in different threads is to be avoided.
\index{VNL}
\index{numerics}
OTB; as ITK, uses the VNL numerics library to provide resources for numerical
OTB, like ITK, uses the VNL numerics library to provide resources for numerical
programming combining the ease of use of packages like Mathematica and Matlab
with the speed of C and the elegance of C++. It provides a C++ interface to
the high-quality Fortran routines made available in the public domain by
......
......@@ -18,6 +18,8 @@
* limitations under the License.
*/
#include <string>
#include "otbCommandLineArgumentParser.h"
#include <assert.h>
......
......@@ -21,6 +21,9 @@
#ifndef otbExtendedFilenameHelper_h
#define otbExtendedFilenameHelper_h
#include <map>
#include <vector>
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "OTBCommonExport.h"
......
......@@ -22,6 +22,8 @@
#ifndef otbFilterWatcherBase_h
#define otbFilterWatcherBase_h
#include <string>
#include "otbStopwatch.h"
#include "itkCommand.h"
#include "itkProcessObject.h"
......
......@@ -21,6 +21,8 @@
#ifndef otbLogger_h
#define otbLogger_h
#include <string>
#include "itkLoggerBase.h"
#include "itkLogger.h"
#include "OTBCommonExport.h"
......
......@@ -22,6 +22,8 @@
#ifndef otbStandardOneLineFilterWatcher_h
#define otbStandardOneLineFilterWatcher_h
#include <iosfwd>
#include "otbFilterWatcherBase.h"
namespace otb
......
......@@ -22,8 +22,12 @@
#ifndef otbStandardWriterWatcher_h
#define otbStandardWriterWatcher_h
#include <iosfwd>
#include "otbWriterWatcherBase.h"
#include "OTBCommonExport.h"
namespace otb
{
......
......@@ -21,6 +21,9 @@
#ifndef otbUtils_h
#define otbUtils_h
#include <sstream>
#include <string>
#include "itkMacro.h"
#include "OTBCommonExport.h"
......
......@@ -22,10 +22,11 @@
#ifndef otbWriterWatcherBase_h
#define otbWriterWatcherBase_h
#include "otbStopwatch.h"
#include <string>
#include "itkCommand.h"
#include "itkProcessObject.h"
#include "otbStopwatch.h"
#include "OTBCommonExport.h"
......
......@@ -21,6 +21,7 @@
#include "otbConfigurationManager.h"
#include "otbMacro.h"
#include "otbLogger.h"
#include "itksys/SystemTools.hxx"
......
......@@ -19,6 +19,15 @@
*/
#include "otbExtendedFilenameHelper.h"
#include <cassert>
#include <ostream>
#include <stdexcept>
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include "otb_boost_string_header.h"
#include "otbStringUtils.h"
......
......@@ -19,7 +19,11 @@
* limitations under the License.
*/
#include <iostream>
#include <sstream>
#include "otbStandardOneLineFilterWatcher.h"
#include "otbStopwatch.h"
namespace otb
{
......
......@@ -19,7 +19,10 @@
* limitations under the License.
*/
#include <iostream>
#include "otbStandardWriterWatcher.h"
#include "otbStopwatch.h"
namespace otb
{
......
......@@ -21,7 +21,6 @@
#include "otbSystem.h"
#include <string> // strdup
#include <ctype.h> //toupper, tolower
#include <cstdlib>
#if (defined(WIN32) || defined(WIN32CE)) && !defined(__CYGWIN__) && !defined(__MINGW32__)
......
......@@ -20,7 +20,6 @@
#include "otbUtils.h"
#include <sstream>
namespace otb
{
......
......@@ -28,6 +28,8 @@
#include "vnl/vnl_vector.h"
#include <string>
#include <typeinfo>
#include <vector>
#include "OTBImageBaseExport.h"
......
......@@ -19,6 +19,10 @@
* limitations under the License.
*/
#include <complex>
#include <sstream>
#include <string>
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
......@@ -29,7 +33,6 @@
#include "itkPoint.h"
#include "itkCovariantVector.h"
#include "itkDiffusionTensor3D.h"
#include "itkImageRegionSplitter.h"
namespace otb
{
......
......@@ -28,6 +28,7 @@
#include "itk_kwiml.h"
#endif
#include <set>
#include <iosfwd>
#include "OTBStreamingExport.h"
......
......@@ -19,6 +19,9 @@
*/
#include <complex>
#include <ostream>
#include "otbPipelineMemoryPrintCalculator.h"
#include "otbMacro.h"
......
......@@ -21,9 +21,11 @@
#ifndef otbVectorDataKeywordlist_h
#define otbVectorDataKeywordlist_h
#include <iosfwd>
#include <vector>
#include "itkLightObject.h"
#include "itkObjectFactory.h"
#include <vector>
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -18,6 +18,7 @@
* limitations under the License.
*/
#include <ostream>
#include "otbVectorDataIOBase.h"
......
......@@ -168,7 +168,16 @@ protected:
unsigned int GetMaxKeySize() const;
private:
/** \return false if paramKey is a missing mandatory parameter */
bool CheckMissingMandatoryParameter(const std::string & paramKey) const;
/** Prints a warning to std::cerr if paramKey is an unused parameter */
void CheckUnusedParameter(const std::string & paramKey) const;
/** \return false if paramKey is an OutputFilename parameter
pointing to a path that does not exist */
bool CheckOutputPathsValidity(const std::string & paramKey) const;
CommandLineLauncher(const CommandLineLauncher &) = delete;
void operator =(const CommandLineLauncher&) = delete;
......
......@@ -511,32 +511,89 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters()
}
}
// SECOND PASS : check mandatory parameters
for (unsigned int i = 0; i < appKeyList.size(); i++)
// SECOND PASS : checks
for (const auto & paramKey : appKeyList)
{
const std::string paramKey(appKeyList[i]);
ParameterType type = m_Application->GetParameterType(paramKey);
// Check for missing mandatory parameters
if(!CheckMissingMandatoryParameter(paramKey))
return MISSINGMANDATORYPARAMETER;
// Check and warn unused parameters
CheckUnusedParameter(paramKey);
// Check output paths are valid
if(!CheckOutputPathsValidity(paramKey))
return WRONGPARAMETERVALUE;
}
return OKPARAM;
}
bool CommandLineLauncher::CheckOutputPathsValidity(const std::string & paramKey) const
{
ParameterType type = m_Application->GetParameterType(paramKey);
if (m_Application->HasValue(paramKey) &&
type == ParameterType_OutputFilename)
{
std::string filename = m_Application->GetParameterString(paramKey);
itksys::String path = itksys::SystemTools::GetFilenamePath(filename);
if (path!="" && !itksys::SystemTools::FileIsDirectory(path.c_str()))
{
std::cerr <<"ERROR: Directory doesn't exist : "<< path.c_str() << std::endl;
return false;
}
}
return true;
}
bool CommandLineLauncher::CheckMissingMandatoryParameter(const std::string & paramKey) const
{
if (m_Application->IsParameterMissing(paramKey))
{
std::cerr << "ERROR: Missing mandatory parameter -" << paramKey << "." << std::endl;
return MISSINGMANDATORYPARAMETER;
return false;
}
return true;
}
// Check output paths validity
if (m_Application->HasValue(paramKey) &&
type == ParameterType_OutputFilename)
void CommandLineLauncher::CheckUnusedParameter(const std::string & paramKey) const
{
// Check for ignored parameters
if(m_Application->HasUserValue(paramKey))
{
std::string filename = m_Application->GetParameterString(paramKey);
itksys::String path = itksys::SystemTools::GetFilenamePath(filename);
if (path!="" && !itksys::SystemTools::FileIsDirectory(path.c_str()))
// Find the position of the next dot
unsigned int start = 0;
auto end = paramKey.find_first_of('.',start);
// Until we reach en of key
while(end != std::string::npos)
{
std::cerr <<"ERROR: Directory doesn't exist : "<< path.c_str() << std::endl;
return WRONGPARAMETERVALUE;
// Extract key until the current dot
const std::string & key = paramKey.substr(0,end);
// Find the corresponding parameter type
ParameterType type = m_Application->GetParameterType(key);
// In any case update the position of current and next dot
start = end+1;
end = paramKey.find_first_of('.',start);
// If the current parameter (paramKey) has a choice in it
if(type == ParameterType_Choice)
{
const std::string & value = m_Application->GetParameterString(key);
// Check that this choice is active
if(paramKey.find(value) == std::string::npos)
{
std::cerr<<"WARNING: Parameter -"<<paramKey<<" will be ignored because -"<<key<<" is "<<value<<"."<<std::endl;
break;
}
}
}
}
}
return OKPARAM;
}
void CommandLineLauncher::LinkWatchers(itk::Object * itkNotUsed(caller), const itk::EventObject & event)
......
......@@ -82,12 +82,15 @@ void QtWidgetBoolParameter::DoCreateWidget()
m_Button->setText("Off");
}
//Set the tool tip associated to the parameter
m_Button->setToolTip(QString::fromStdString( paramDown->GetDescription() ));
connect( m_Button, SIGNAL(toggled(bool)), this, SLOT(SetValue(bool)) );
connect( m_Button, SIGNAL(toggled(bool)), GetModel(), SLOT(NotifyUpdate()) );
hLayout->addWidget(m_Button);
hLayout->addStretch();
this->setLayout(hLayout);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment