OTB  9.0.0
Orfeo Toolbox
otbWrapperApplication.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbWrapperApplication_h
22 #define otbWrapperApplication_h
23 
24 #include <string>
25 #include <set>
26 #include "otbWrapperTypes.h"
27 #include "otbWrapperTags.h"
30 
31 #include "otbLogger.h"
32 #include "otbStopwatch.h"
33 #include "otbWrapperMacros.h"
38 #include "itkMersenneTwisterRandomVariateGenerator.h"
39 #include "OTBApplicationEngineExport.h"
40 
41 namespace otb
42 {
43 
51 class OTBApplicationEngine_EXPORT ApplicationException : public itk::ExceptionObject
52 {
53 public:
55  itkTypeMacro(ApplicationException, ExceptionObject);
56 
58  ApplicationException(const char* file, unsigned int line, const char* message = "Application error.", const char* loc = "Unknown");
59 
61  ApplicationException(const std::string& file, unsigned int line, const char* message = "Application error.", const char* loc = "Unknown");
62 
63  ApplicationException(const std::string& file, unsigned int line, const std::string& message = "Application error.", const std::string& loc = "Unknown");
64 };
65 
66 namespace Wrapper
67 {
68 
76 class OTBApplicationEngine_EXPORT Application : public itk::Object
77 {
78 public:
80  typedef Application Self;
81  typedef itk::Object Superclass;
82  typedef itk::SmartPointer<Self> Pointer;
83  typedef itk::SmartPointer<const Self> ConstPointer;
84 
86  itkTypeMacro(Application, itk::Object);
87 
88  virtual void SetName(const std::string&);
89  virtual const char* GetName() const;
90 
91  void SetDescription(const std::string&);
92  virtual const char* GetDescription() const;
93 
95  void Init();
96 
98  bool IsInitialized() const;
99 
100  void LoadParametersFromXML(const std::string& filename);
101  void SaveParametersToXML(const std::string& filename);
102 
104  void UpdateParameters();
105 
117  int Execute();
118 
123  void WriteOutput();
124 
131  int ExecuteAndWriteOutput();
132 
134  bool ConnectImage(std::string in, Application* app, std::string out);
135 
137  void PropagateConnectMode(bool isMem);
138 
140  void Stop();
141 
142  /* Get the internal application parameters
143  *
144  * WARNING: this method may disappear from the API */
145  ParameterGroup* GetParameterList();
146 
147  /* Get the internal application parameter specified
148  * if the follow flag is on, the function returns the target of proxy parameters
149  * WARNING: this method may disappear from the API */
150  Parameter* GetParameterByKey(std::string const& parameter, bool follow = true);
151 
152  /* Get the internal application parameter specified
153  *
154  * WARNING: this method may disappear from the API */
155  const Parameter* GetParameterByKey(std::string const& parameter, bool follow = true) const;
156 
157  /* Returns the description of a parameter */
158  std::string GetParameterName(std::string const& paramKey);
159 
160  /* Returns the description of a parameter */
161  std::string GetParameterDescription(std::string const& paramKey);
162 
163  /* Set the description of a parameter */
164  void SetParameterDescription(std::string const& paramKey, std::string dec);
165 
166  /* Enable the use of an optional parameter. Returns the previous state */
167  void EnableParameter(std::string const& paramKey);
168 
169  /* Disable the use of an optional parameter. Returns the previous state */
170  void DisableParameter(std::string const& paramKey);
171 
172  /* Return the enable state of an optional parameter */
173  bool IsParameterEnabled(std::string const& paramKey, bool recurseParents = false) const;
174 
175  /* Return true if the specified parameter is mandatory */
176  bool IsMandatory(std::string const& paramKey) const;
177 
178  /* Return true if the specified parameter was set automatically in
179  * the application
180  */
181  bool HasAutomaticValue(std::string const& paramKey) const;
182 
183  /* Returns true if the parameter has an associated value provided externally
184  * (not automatically computed by the application) */
185  bool HasUserValue(std::string const& paramKey) const;
186 
187  /* If a user value was provided, clear it and update the other parameters */
188  void ClearValue(std::string const& paramKey);
189 
190  /* Returns true if the parameter has an associated value.
191  * This value can be an automatically computed value or default value,
192  * or a value set externally by user */
193  bool HasValue(std::string const& paramKey) const;
194 
200  void SetParameterUserValue(std::string const& paramKey, bool value);
201 
202  /* Return the user level of access to a parameter */
203  UserLevel GetParameterUserLevel(std::string const& paramKey) const;
204 
206  Role GetParameterRole(std::string const& paramKey) const;
207 
208  /* Get the parameter type from its name */
209  ParameterType GetParameterType(std::string const& paramKey) const;
210 
211  /* Returns the description of a parameter */
212  std::vector<std::string> GetChoiceKeys(std::string const& paramKey);
213 
214  /* Returns the description of a parameter */
215  std::vector<std::string> GetChoiceNames(std::string const& paramKey);
216 
217  /* Set an integer value
218  *
219  * Can be called for types :
220  * \li ParameterType_Int
221  * \li ParameterType_Bool
222  * \li ParameterType_Float
223  * \li ParameterType_Double
224  * \li ParameterType_Radius
225  * \li ParameterType_Choice
226  */
227  void SetParameterInt(std::string const& parameter, int value, bool hasUserValueFlag = true);
228 
229  /* Set a floating value
230  *
231  * Can be called for types :
232  * \li ParameterType_Float
233  * \li ParameterType_Double
234  */
235  void SetParameterFloat(std::string const& parameter, float value, bool hasUserValueFlag = true);
236 
237  /* Set a double precision floating value
238  *
239  * Can be called for types :
240  * \li ParameterType_Float
241  * \li ParameterType_Double
242  */
243  void SetParameterDouble(std::string const& parameter, double value, bool hasUserValueFlag = true);
244 
245  /* Set a string value
246  *
247  * Can be called for types :
248  * \li ParameterType_InputImageListParameter
249  * \li ParameterType_InputVectorDataListParameter
250  * \li ParameterType_InputFilenameListParameter
251  * \li ParameterType_StringList
252  * \li ParameterType_ListView
253  * \li ParameterType_Band
254  * \li ParameterType_Field
255  */
256  void SetParameterString(std::string const& parameter, std::string value, bool hasUserValueFlag = true);
257 
258  /* Set a string value
259  *
260  * Can be called for types :
261  * \li ParameterType_String
262  * \li ParameterType_StringList
263  * \li ParameterType_ListView
264  * \li ParameterType_Band
265  * \li ParameterType_Field
266  * \li ParameterType_InputFilename
267  * \li ParameterType_OutputFilename
268  * \li ParameterType_Directory
269  * \li ParameterType_Choice
270  * \li ParameterType_Float
271  * \li ParameterType_Double
272  * \li ParameterType_Int
273  * \li ParameterType_Radius
274  * \li ParameterType_InputImageParameter
275  * \li ParameterType_InputVectorDataParameter
276  * \li ParameterType_OutputImageParameter
277  * \li ParameterType_OutputVectorDataParameter
278  */
279  void SetParameterStringList(std::string const& parameter, std::vector<std::string> values, bool hasUserValueFlag = true);
280 
284  bool IsApplicationReady();
285 
295  bool IsParameterMissing(const std::string& key) const;
296 
297  /* Set a default integer value, must be used in the
298  * DoInit when setting a value by default
299  * for the parameter
300  *
301  * Can be called for types :
302  * \li ParameterType_Int
303  * \li ParameterType_Float
304  * \li ParameterType_Double
305  * \li ParameterType_Radius
306  * \li ParameterType_Choice
307  */
308  void SetDefaultParameterInt(std::string const& parameter, int value);
309 
310  /* Get the default integer value of a parameter
311  *
312  * Can be called for types :
313  * \li ParameterType_Int
314  * \li ParameterType_Float
315  * \li ParameterType_Double
316  * \li ParameterType_Radius
317  * \li ParameterType_Choice
318  */
319  int GetDefaultParameterInt(std::string const& parameter);
320 
321  /* Set a default floating value, must be used in the
322  * DoInit when setting a value by default
323  * for the parameter
324  *
325  * Can be called for types :
326  * \li ParameterType_Float
327  * \li ParameterType_Double
328  */
329  void SetDefaultParameterFloat(std::string const& parameter, float value);
330 
331  /* Get the default floating value of a parameter
332  *
333  * Can be called for types :
334  * \li ParameterType_Float
335  * \li ParameterType_Double
336  */
337  float GetDefaultParameterFloat(std::string const& parameter);
338 
339  /* Set a default double precision floating value, must be used in the
340  * DoInit when setting a value by default
341  * for the parameter
342  *
343  * Can be called for types :
344  * \li ParameterType_Float
345  * \li ParameterType_Double
346  */
347  void SetDefaultParameterDouble(std::string const& parameter, double value);
348 
349  /* Get the default double precision floating value of a parameter
350  *
351  * Can be called for types :
352  * \li ParameterType_Float
353  * \li ParameterType_Double
354  */
355  double GetDefaultParameterDouble(std::string const& parameter);
356 
362  void SetDefaultOutputPixelType(std::string const& parameter, ImagePixelType type);
363 
369  void SetDefaultOutputComplexPixelType(std::string const& parameter, ComplexImagePixelType type);
370 
371  /* Set a minimum int value, must used in the
372  * DoInit when setting a value by default
373  * for the parameter
374  *
375  * Can be called for types :
376  * \li ParameterType_Int
377  */
378  void SetMinimumParameterIntValue(std::string const& parameter, int value);
379 
380  /* Set a maximum int value, must used in the
381  * DoInit when setting a value by default
382  * for the parameter
383  *
384  * Can be called for types :
385  * \li ParameterType_Int
386  */
387  void SetMaximumParameterIntValue(std::string const& parameter, int value);
388 
389  /* Set a minimum float value, must used in the
390  * DoInit when setting a value by default
391  * for the parameter
392  *
393  * Can be called for types :
394  * \li ParameterType_Float
395  */
396  void SetMinimumParameterFloatValue(std::string const& parameter, float value);
397 
398  /* Set a maximum float value, must used in the
399  * DoInit when setting a value by default
400  * for the parameter
401  *
402  * Can be called for types :
403  * \li ParameterType_Float
404  */
405  void SetMaximumParameterFloatValue(std::string const& parameter, float value);
406 
407  /* Set a minimum double precision float value, must used in the
408  * DoInit when setting a value by default
409  * for the parameter
410  *
411  * Can be called for types :
412  * \li ParameterType_Float
413  * \li ParameterType_Double
414  */
415  void SetMinimumParameterDoubleValue(std::string const& parameter, double value);
416 
417  /* Set a maximum double precision value, must used in the
418  * DoInit when setting a value by default
419  * for the parameter
420  *
421  * Can be called for types :
422  * \li ParameterType_Float
423  * \li ParameterType_Double
424  */
425  void SetMaximumParameterDoubleValue(std::string const& parameter, double value);
426 
427 
437  void SetListViewSingleSelectionMode(std::string const& parameter, bool status);
438 
447  bool GetListViewSingleSelectionMode(const std::string& parameter);
448 
449  /* Set an output image value
450  *
451  * Can be called for types :
452  * \li ParameterType_OutputImage
453  */
454  void SetParameterOutputImage(std::string const& parameter, FloatVectorImageType* value);
455 
456  /* Set the pixel type in which the image will be saved
457  *
458  * Can be called for types :
459  * \li ParameterType_OutputImage
460  */
461  void SetParameterOutputImagePixelType(std::string const& parameter, ImagePixelType pixelType);
462 
463  /* Set an output vector data value
464  *
465  * Can be called for types :
466  * \li ParameterType_OutputVectorData
467  */
468  void SetParameterOutputVectorData(std::string const& parameter, VectorDataType* value);
469 
470  /* Get an integer parameter value
471  *
472  * Can be called for types :
473  * \li ParameterType_Int
474  * \li ParameterType_Bool
475  * \li ParameterType_Float
476  * \li ParameterType_Double
477  * \li ParameterType_Radius
478  * \li ParameterType_Choice
479  */
480  int GetParameterInt(std::string const& parameter) const;
481 
482  /* Get a floating parameter value
483  *
484  * Can be called for types :
485  * \li ParameterType_Float
486  * \li ParameterType_Double
487  */
488  float GetParameterFloat(std::string const& parameter) const;
489 
490  /* Get a double precision floating parameter value
491  *
492  * Can be called for types :
493  * \li ParameterType_Float
494  * \li ParameterType_Double
495  */
496  double GetParameterDouble(std::string const& parameter) const;
497 
498  /* Get a string parameter value
499  *
500  * Can be called for types :
501  * \li ParameterType_String
502  * \li ParameterType_InputFilename
503  * \li ParameterType_OutputFilename
504  * \li ParameterType_Directory
505  * \li ParameterType_InputImage
506  * \li ParameterType_InputVectorData
507  * \li ParameterType_OutputImage
508  * \li ParameterType_OutputVectorData
509  */
510  std::string GetParameterString(std::string const& parameter) const;
511 
512  /* Get a string list parameter value
513  *
514  * Can be called for types :
515  * \li ParameterType_StringList
516  * \li ParameterType_InputImageList
517  * \li ParameterType_InputFilenameList
518  */
519  // TODO: Should be rewritten:
520  //
521  // std::size_t
522  // GetParameterStringList( const std::vector< String > & v,
523  // const std::string & parameter ) const;
524  //
525  // to avoid useless memory allocations.
526  std::vector<std::string> GetParameterStringList(const std::string& parameter);
527 
528 
538  void SetParameterInputImage(std::string const& parameter, ImageBaseType* inputImage);
539 
549  ImageBaseType* GetParameterOutputImage(std::string const& parameter);
550 
560  void AddImageToParameterInputImageList(std::string const& parameter, ImageBaseType* img);
561 
572  void SetNthParameterInputImageList(std::string const& parameter, const unsigned int& id, ImageBaseType* img);
573 
579  void SetVectorData(std::string const& key, std::string const& vectorData );
580 
586  void SetTypeFilter(std::string const& key, FieldParameter::TypeFilterType const& typeFilter );
587 
593  const FieldParameter::TypeFilterType& GetTypeFilter(std::string const& key ) const;
594 
600  void SetRasterData(std::string const& key, std::string const& rasterData );
601 
613  void AddParameterStringList(std::string const& parameter, const std::string& str);
614 
627  void SetNthParameterStringList(std::string const& parameter, const unsigned int& id, const std::string& str);
628 
629 
637  void ClearParameterInputImageList(std::string const& parameter);
638 
646  unsigned int GetNumberOfElementsInParameterInputImageList(std::string const& parameter);
647 
648 
649  /* Get an image value
650  *
651  * Can be called for types :
652  * \li ParameterType_InputImage
653  */
654  FloatVectorImageType* GetParameterImage(std::string const& parameter);
655 
656  UInt8ImageType* GetParameterUInt8Image(std::string const&);
657  UInt16ImageType* GetParameterUInt16Image(std::string const&);
658  Int16ImageType* GetParameterInt16Image(std::string const&);
659  UInt32ImageType* GetParameterUInt32Image(std::string const&);
660  Int32ImageType* GetParameterInt32Image(std::string const&);
661  FloatImageType* GetParameterFloatImage(std::string const&);
662  DoubleImageType* GetParameterDoubleImage(std::string const&);
663  UInt8VectorImageType* GetParameterUInt8VectorImage(std::string const&);
664  UInt16VectorImageType* GetParameterUInt16VectorImage(std::string const&);
665  Int16VectorImageType* GetParameterInt16VectorImage(std::string const&);
666  UInt32VectorImageType* GetParameterUInt32VectorImage(std::string const&);
667  Int32VectorImageType* GetParameterInt32VectorImage(std::string const&);
668  FloatVectorImageType* GetParameterFloatVectorImage(std::string const&);
669  DoubleVectorImageType* GetParameterDoubleVectorImage(std::string const&);
670  UInt8RGBImageType* GetParameterUInt8RGBImage(std::string const&);
671  UInt8RGBAImageType* GetParameterUInt8RGBAImage(std::string const&);
672 
673  // Complex image
674  ComplexInt16ImageType* GetParameterComplexInt16Image(std::string const&);
675  ComplexInt32ImageType* GetParameterComplexInt32Image(std::string const&);
676  ComplexFloatImageType* GetParameterComplexFloatImage(std::string const&);
677  ComplexDoubleImageType* GetParameterComplexDoubleImage(std::string const&);
678 
679  ComplexInt16VectorImageType* GetParameterComplexInt16VectorImage(std::string const&);
680  ComplexInt32VectorImageType* GetParameterComplexInt32VectorImage(std::string const&);
681  ComplexFloatVectorImageType* GetParameterComplexFloatVectorImage(std::string const&);
682  ComplexDoubleVectorImageType* GetParameterComplexDoubleVectorImage(std::string const&);
683 
684 
685  /* Get an image list value
686  *
687  * Can be called for types :
688  * \li ParameterType_InputImageList
689  */
690  FloatVectorImageListType* GetParameterImageList(std::string const& parameter);
691 
692  /* GetParameterVectorData
693  *
694  * Can be called for types :
695 
696  * \li ParameterType_InputVectorData
697  */
698  VectorDataType* GetParameterVectorData(std::string const& parameter);
699 
700  /* GetParameteVetorDataList
701  *
702  * Can be called for types :
703 
704  * \li ParameterType_InputVectorDatalist
705  */
706  VectorDataListType* GetParameterVectorDataList(std::string const& parameter);
707 
708  /* Get the parameter as a std::string
709  *
710  * Can be called for types :
711  * \li ParameterType_Float
712  * \li ParameterType_Double
713  * \li ParameterType_Int
714  * \li ParameterType_Choice
715  * \li ParameterType_Radius
716  * \li ParameterType_String
717  * \li ParameterType_InputFilename
718  * \li ParameterType_OutputFilename
719  * \li ParameterType_Directory
720  * \li ParameterType_InputImage
721  * \li ParameterType_InputVectorData
722  * \li ParameterType_OutputImage
723  * \li ParameterType_OutputVectorData
724  */
725  std::string GetParameterAsString(std::string const& paramKey);
726 
727  /* Get the list of all parameters
728  */
729  std::vector<std::string> GetParametersKeys(bool recursive = true);
730 
731  /* Get the pixel type in which the image will be saved
732  *
733  * Can be called for types :
734  * \li ParameterType_OutputImage
735  */
736  ImagePixelType GetParameterOutputImagePixelType(std::string const& parameter);
737 
739  {
740  m_ParameterList = paramGroup;
741  }
742 
743  otb::Logger* GetLogger() const;
744 
746  void SetLogger(otb::Logger* logger);
747 
748  itk::ProcessObject* GetProgressSource() const;
749 
750  std::string GetProgressDescription() const;
751 
752  virtual void SetDocLongDescription(const std::string&);
753  virtual const char* GetDocLongDescription() const;
754 
755  virtual void SetDocAuthors(const std::string&);
756  virtual const char* GetDocAuthors() const;
757 
758  virtual void SetDocLimitations(const std::string&);
759  virtual const char* GetDocLimitations() const;
760 
761  virtual void SetDocSeeAlso(const std::string&);
762  virtual const char* GetDocSeeAlso() const;
763 
764  virtual void SetDocTags(std::vector<std::string>);
765  virtual std::vector<std::string> GetDocTags() const;
766 
767  void AddDocTag(const std::string&);
768 
770  bool IsDeprecated();
771 
772  DocExampleStructure::Pointer GetDocExample();
773  unsigned int GetNumberOfExamples();
774  std::string GetExampleComment(unsigned int id);
775  unsigned int GetExampleNumberOfParameters(unsigned int id);
776  std::string GetExampleParameterKey(unsigned int exId, unsigned int paramId);
777  std::string GetExampleParameterValue(unsigned int exId, unsigned int paramId);
778  void SetDocExampleParameterValue(const std::string key, const std::string value, unsigned int exId = 0);
779  void SetExampleComment(const std::string& comm, unsigned int i);
780  unsigned int AddExample(const std::string& comm = "");
781  std::string GetCLExample();
782  std::string GetHtmlExample();
783 
787  std::vector<std::pair<std::string, std::string>> GetOutputParametersSumUp();
788 
789  double GetLastExecutionTiming() const;
790 
791  virtual void SetDocLink(const std::string& link);
792  virtual const std::string& GetDocLink() const;
793 
794  void SetOfficialDocLink();
795 
798  ImageBaseType::PointType GetImageOrigin(const std::string& key, unsigned int idx = 0);
799 
802  ImageBaseType::SpacingType GetImageSpacing(const std::string& key, unsigned int idx = 0);
803 
806  ImageBaseType::SizeType GetImageSize(const std::string& key, unsigned int idx = 0);
807 
810  unsigned int GetImageNbBands(const std::string& key, unsigned int idx = 0);
811 
814  std::string GetImageProjection(const std::string& key, unsigned int idx = 0);
815 
821  unsigned long PropagateRequestedRegion(const std::string& key, ImageBaseType::RegionType region, unsigned int idx = 0);
822 
826  ImageBaseType::RegionType GetImageRequestedRegion(const std::string& key, unsigned int idx = 0);
827 
830  ImageMetadata &GetImageMetadata(const std::string& key, unsigned int idx = 0);
831  void SetImageMetadata(const ImageMetadata & imd, const std::string& key, unsigned int idx = 0);
833 
835  itk::MetaDataDictionary GetMetadataDictionary(const std::string& key, unsigned int idx = 0);
836 
841  ImagePixelType GetImageBasePixelType(const std::string& key, unsigned int idx = 0);
842 
851  ImageBaseType* GetParameterImageBase(const std::string& key, unsigned int idx = 0);
852 
860  void SetParameterImageBase(const std::string& key, ImageBaseType* img, unsigned int idx = 0);
861 
872  void RegisterPipeline();
873 
881  void FreeRessources();
882 
883  bool IsExecuteDone();
884 
886  bool IsMultiWritingEnabled();
887 
888 protected:
890  Application();
891 
893  ~Application() override;
894 
895  /* Register a ProcessObject as a new progress source */
896  void AddProcess(itk::ProcessObject* object, std::string description);
897 
899  void AddChoice(std::string const& paramKey, std::string const& paramName);
900 
904  void AddParameter(ParameterType type, std::string const& paramKey, std::string const& paramName);
905 
907  void AddRAMParameter(std::string const& paramKey = "ram");
908 
910  void AddRAMParameter(std::string const& paramKey, std::string const& paramName, unsigned int defaultValue);
911 
913  void AddRANDParameter(std::string const& paramKey = "rand");
914 
916  void AddRANDParameter(std::string const& paramKey, std::string const& paramName, unsigned int defaultValue);
917 
919  void ClearChoices(std::string const& key);
920 
922  std::vector<int> GetSelectedItems(std::string const& paramKey);
923 
925  void MandatoryOn(std::string const& paramKey);
926 
928  void MandatoryOff(std::string const& paramKey);
929 
930  /* Set the user level of access to a parameter */
931  void SetParameterUserLevel(std::string const& paramKey, UserLevel level);
932 
933  /* Set the parameter role (input/output) */
934  void SetParameterRole(std::string const& paramKey, Role role);
935 
936  /* Get an image value
937  *
938  * Can be called for types :
939  * \li ParameterType_InputImage
940  */
941  template <class TImageType>
942  TImageType* GetParameterImage(std::string const& parameter);
943 
945  void AutomaticValueOn(std::string const& paramKey);
946 
948  void AutomaticValueOff(std::string const& paramKey);
949 
950  /* Set an output image value
951  *
952  * Can be called for types :
953  * \li ParameterType_OutputImage
954  */
955  template <class TImageType>
956  void SetParameterOutputImage(std::string const& parameter, TImageType* value);
957 
959  itkSetMacro(MultiWriting, bool);
960 
961  /* Enable in-application prevention of modifications to m_UserValue (default behaviour) */
962  void EnableInPrivateDo();
963 
964  /* Disable in-application prevention of modifications to m_UserValue */
965  void DisableInPrivateDo();
966 
967 private:
968  /* Implement this method to add parameters */
969  virtual void DoInit() = 0;
970 
971  /* Implement this method to update non valued parameters */
972  virtual void DoUpdateParameters() = 0;
973 
974  /* Implement this method to build the output */
975  virtual void DoExecute() = 0;
976 
977  /* This method will be called after the
978  * ExecuteAndWriteOutput() call to allow for cleanup. Default
979  * implementation does nothing */
980  virtual void AfterExecuteAndWriteOutputs();
981 
982  virtual void DoFreeRessources(){};
983 
984  Application(const Application&) = delete;
985  void operator=(const Application&) = delete;
986 
987  std::string m_Name;
988  std::string m_Description;
991 
992  itk::ProcessObject::Pointer m_ProgressSource;
994 
995  std::set<itk::ProcessObject::Pointer> m_Filters;
996 
998  std::string m_DocLongDescription;
999 
1002 
1004  std::string m_DocAuthors;
1005 
1007  std::string m_DocLimitations;
1008 
1010  std::string m_DocSeeAlso;
1011 
1013  std::vector<std::string> m_DocTags;
1014 
1016  std::string m_Doclink;
1017 
1020 
1023 
1026 
1029 
1039 
1040 }; // end class
1041 
1042 } // end namespace Wrapper
1043 } // end namespace otb
1044 
1045 
1046 #ifndef OTB_MANUAL_INSTANTIATION
1047 #include "otbWrapperApplication.hxx"
1048 #endif
1049 
1050 
1051 namespace otb
1052 {
1053 namespace Wrapper
1054 {
1055 
1056 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8VectorImageType* Application::GetParameterImage<UInt8VectorImageType>(std::string const&);
1057 extern template OTBApplicationEngine_EXPORT_TEMPLATE Int16VectorImageType* Application::GetParameterImage<Int16VectorImageType>(std::string const&);
1058 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt16VectorImageType* Application::GetParameterImage<UInt16VectorImageType>(std::string const&);
1059 extern template OTBApplicationEngine_EXPORT_TEMPLATE Int32VectorImageType* Application::GetParameterImage<Int32VectorImageType>(std::string const&);
1060 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt32VectorImageType* Application::GetParameterImage<UInt32VectorImageType>(std::string const&);
1061 
1062 extern template OTBApplicationEngine_EXPORT_TEMPLATE FloatVectorImageType* Application::GetParameterImage<FloatVectorImageType>(std::string const&);
1063 extern template OTBApplicationEngine_EXPORT_TEMPLATE DoubleVectorImageType* Application::GetParameterImage<DoubleVectorImageType>(std::string const&);
1064 
1065 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt16VectorImageType*
1066  Application::GetParameterImage<ComplexInt16VectorImageType>(std::string const&);
1067 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt32VectorImageType*
1068  Application::GetParameterImage<ComplexInt32VectorImageType>(std::string const&);
1069 
1070 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexFloatVectorImageType*
1071  Application::GetParameterImage<ComplexFloatVectorImageType>(std::string const&);
1072 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexDoubleVectorImageType*
1073  Application::GetParameterImage<ComplexDoubleVectorImageType>(std::string const&);
1074 
1075 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8RGBImageType* Application::GetParameterImage<UInt8RGBImageType>(std::string const&);
1076 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8RGBAImageType* Application::GetParameterImage<UInt8RGBAImageType>(std::string const&);
1077 
1078 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8ImageType* Application::GetParameterImage<UInt8ImageType>(std::string const&);
1079 extern template OTBApplicationEngine_EXPORT_TEMPLATE Int16ImageType* Application::GetParameterImage<Int16ImageType>(std::string const&);
1080 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt16ImageType* Application::GetParameterImage<UInt16ImageType>(std::string const&);
1081 extern template OTBApplicationEngine_EXPORT_TEMPLATE Int32ImageType* Application::GetParameterImage<Int32ImageType>(std::string const&);
1082 extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt32ImageType* Application::GetParameterImage<UInt32ImageType>(std::string const&);
1083 
1084 extern template OTBApplicationEngine_EXPORT_TEMPLATE FloatImageType* Application::GetParameterImage<FloatImageType>(std::string const&);
1085 extern template OTBApplicationEngine_EXPORT_TEMPLATE DoubleImageType* Application::GetParameterImage<DoubleImageType>(std::string const&);
1086 
1087 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt16ImageType* Application::GetParameterImage<ComplexInt16ImageType>(std::string const&);
1088 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt32ImageType* Application::GetParameterImage<ComplexInt32ImageType>(std::string const&);
1089 
1090 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexFloatImageType* Application::GetParameterImage<ComplexFloatImageType>(std::string const&);
1091 extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexDoubleImageType* Application::GetParameterImage<ComplexDoubleImageType>(std::string const&);
1092 
1093 //
1094 
1095 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8VectorImageType>(std::string const&, UInt8VectorImageType*);
1096 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int16VectorImageType>(std::string const&, Int16VectorImageType*);
1097 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt16VectorImageType>(std::string const&,
1099 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int32VectorImageType>(std::string const&, Int32VectorImageType*);
1100 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt32VectorImageType>(std::string const&,
1102 
1103 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<FloatVectorImageType>(std::string const&, FloatVectorImageType*);
1104 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<DoubleVectorImageType>(std::string const&,
1106 
1107 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt16VectorImageType>(std::string const&,
1109 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt32VectorImageType>(std::string const&,
1111 
1112 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexFloatVectorImageType>(std::string const&,
1114 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexDoubleVectorImageType>(std::string const&,
1116 
1117 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8RGBImageType>(std::string const&, UInt8RGBImageType*);
1118 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8RGBAImageType>(std::string const&, UInt8RGBAImageType*);
1119 
1120 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8ImageType>(std::string const&, UInt8ImageType*);
1121 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int16ImageType>(std::string const&, Int16ImageType*);
1122 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt16ImageType>(std::string const&, UInt16ImageType*);
1123 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int32ImageType>(std::string const&, Int32ImageType*);
1124 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt32ImageType>(std::string const&, UInt32ImageType*);
1125 
1126 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<FloatImageType>(std::string const&, FloatImageType*);
1127 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<DoubleImageType>(std::string const&, DoubleImageType*);
1128 
1129 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt16ImageType>(std::string const&,
1131 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt32ImageType>(std::string const&,
1133 
1134 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexFloatImageType>(std::string const&,
1136 extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexDoubleImageType>(std::string const&,
1138 
1139 } // namespace Wrapper
1140 } // namespace otb
1141 
1142 
1143 #endif // otbWrapperApplication_h_
otb::Wrapper::UInt32VectorImageType
otb::VectorImage< unsigned int > UInt32VectorImageType
Definition: otbWrapperTypes.h:148
otb::Wrapper::Application::SetParameterList
void SetParameterList(ParameterGroup::Pointer paramGroup)
Definition: otbWrapperApplication.h:738
otb::Wrapper::UserLevel
UserLevel
Definition: otbWrapperTypes.h:102
otb::Wrapper::Application::m_ExecuteDone
bool m_ExecuteDone
Definition: otbWrapperApplication.h:1025
otb::Wrapper::Application
This class represent an application TODO.
Definition: otbWrapperApplication.h:76
otb::Wrapper::Application::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperApplication.h:82
otb::Wrapper::Parameter
This class represent a parameter for the wrapper framework This class is a high level class represent...
Definition: otbWrapperParameter.h:49
otb::Wrapper::FloatVectorImageType
otb::VectorImage< float > FloatVectorImageType
Definition: otbWrapperTypes.h:149
otb::Wrapper::Int32ImageType
otb::Image< int > Int32ImageType
Definition: otbWrapperTypes.h:139
otb::Wrapper::UInt16ImageType
otb::Image< unsigned short > UInt16ImageType
Definition: otbWrapperTypes.h:138
otbWrapperDocExampleStructure.h
otbWrapperOutputImageParameter.h
otb::Wrapper::ParameterGroup::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperParameterGroup.h:44
otb::Wrapper::Application::DoFreeRessources
virtual void DoFreeRessources()
Definition: otbWrapperApplication.h:982
otb::Wrapper::DoubleImageType
otb::Image< double > DoubleImageType
Definition: otbWrapperTypes.h:142
otbWrapperTags.h
otb::VectorData
This class represents a hierarchy of vector data.
Definition: otbVectorData.h:58
otb::Wrapper::ImagePixelType
ImagePixelType
Definition: otbWrapperTypes.h:104
otb::Wrapper::FieldParameter::TypeFilterType
std::vector< OGRFieldType > TypeFilterType
Definition: otbWrapperFieldParameter.h:51
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Image
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
otb::Wrapper::Application::m_DocAuthors
std::string m_DocAuthors
Definition: otbWrapperApplication.h:1004
otb::Wrapper::Application::m_ProgressSourceDescription
std::string m_ProgressSourceDescription
Definition: otbWrapperApplication.h:993
otb::Wrapper::Application::m_DocSeeAlso
std::string m_DocSeeAlso
Definition: otbWrapperApplication.h:1010
otb::Wrapper::Application::Self
Application Self
Definition: otbWrapperApplication.h:80
otbWrapperFieldParameter.h
otb::Wrapper::Application::m_DocExample
DocExampleStructure::Pointer m_DocExample
Definition: otbWrapperApplication.h:1001
otb::Wrapper::Int16VectorImageType
otb::VectorImage< short > Int16VectorImageType
Definition: otbWrapperTypes.h:145
otb::Wrapper::ComplexDoubleVectorImageType
otb::VectorImage< DoubleComplexPixelType, 2 > ComplexDoubleVectorImageType
Definition: otbWrapperTypes.h:169
otb::Wrapper::UInt8RGBImageType
otb::Image< itk::RGBPixel< unsigned char > > UInt8RGBImageType
Definition: otbWrapperTypes.h:152
otb::Wrapper::Application::m_ParameterList
ParameterGroup::Pointer m_ParameterList
Definition: otbWrapperApplication.h:989
otb::Wrapper::Int16ImageType
otb::Image< short > Int16ImageType
Definition: otbWrapperTypes.h:137
otb::Wrapper::UInt8VectorImageType
otb::VectorImage< unsigned char > UInt8VectorImageType
Definition: otbWrapperTypes.h:144
otb::Wrapper::ParameterGroup
Definition: otbWrapperParameterGroup.h:39
otb::Wrapper::ComplexFloatVectorImageType
otb::VectorImage< FloatComplexPixelType, 2 > ComplexFloatVectorImageType
Definition: otbWrapperTypes.h:168
otb::Wrapper::UInt16VectorImageType
otb::VectorImage< unsigned short > UInt16VectorImageType
Definition: otbWrapperTypes.h:146
otb::Wrapper::Application::m_Description
std::string m_Description
Definition: otbWrapperApplication.h:988
otb::Wrapper::ElevationParametersHandler
This class represent a helper class for elevation modes. It add the parameters automatically to the a...
Definition: otbWrapperElevationParametersHandler.h:46
otb::Wrapper::Application::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbWrapperApplication.h:83
otb::Wrapper::UInt8RGBAImageType
otb::Image< itk::RGBAPixel< unsigned char > > UInt8RGBAImageType
Definition: otbWrapperTypes.h:153
otbWrapperMacros.h
otb::Wrapper::DocExampleStructure::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbWrapperDocExampleStructure.h:52
otb::Stopwatch
Stopwatch timer.
Definition: otbStopwatch.h:41
otb::Wrapper::Role
Role
Definition: otbWrapperTypes.h:126
otb::Logger::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLogger.h:45
otbWrapperInputImageParameter.h
otb::Logger
An ITK logger specialized for OTB.
Definition: otbLogger.h:40
otb::Wrapper::ComplexInt32ImageType
otb::Image< Int32ComplexPixelType, 2 > ComplexInt32ImageType
Definition: otbWrapperTypes.h:162
otbWrapperInputImageListParameter.h
otb::Wrapper::DoubleVectorImageType
otb::VectorImage< double > DoubleVectorImageType
Definition: otbWrapperTypes.h:150
otb::Wrapper::UInt8ImageType
otb::Image< unsigned char > UInt8ImageType
Definition: otbWrapperTypes.h:136
otb::Wrapper::ImageBaseType
itk::ImageBase< 2 > ImageBaseType
Definition: otbWrapperTypes.h:180
otb::Wrapper::Application::m_Name
std::string m_Name
Definition: otbWrapperApplication.h:987
otb::Wrapper::Application::m_ProgressSource
itk::ProcessObject::Pointer m_ProgressSource
Definition: otbWrapperApplication.h:992
otb::Wrapper::Application::m_Logger
otb::Logger::Pointer m_Logger
Definition: otbWrapperApplication.h:990
otbWrapperParameterGroup.h
otb::Wrapper::ComplexFloatImageType
otb::Image< FloatComplexPixelType, 2 > ComplexFloatImageType
Definition: otbWrapperTypes.h:163
otbWrapperApplication.hxx
otb::Wrapper::Application::m_Filters
std::set< itk::ProcessObject::Pointer > m_Filters
Definition: otbWrapperApplication.h:995
otb::Wrapper::ComplexImagePixelType
ComplexImagePixelType
Definition: otbWrapperTypes.h:119
otb::Wrapper::Application::Superclass
itk::Object Superclass
Definition: otbWrapperApplication.h:81
otb::Wrapper::Application::m_Chrono
otb::Stopwatch m_Chrono
Definition: otbWrapperApplication.h:1019
otb::Wrapper::ComplexInt16VectorImageType
otb::VectorImage< Int16ComplexPixelType, 2 > ComplexInt16VectorImageType
Definition: otbWrapperTypes.h:166
otb::Wrapper::FloatImageType
otb::Image< float > FloatImageType
Definition: otbWrapperTypes.h:141
otb::Wrapper::MapProjectionParametersHandler
This class represent a helper class.
Definition: otbWrapperMapProjectionParametersHandler.h:53
otb::Wrapper::ComplexDoubleImageType
otb::Image< DoubleComplexPixelType, 2 > ComplexDoubleImageType
Definition: otbWrapperTypes.h:164
otb::ObjectList
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >.
Definition: otbObjectList.h:40
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otb::Wrapper::UInt32ImageType
otb::Image< unsigned int > UInt32ImageType
Definition: otbWrapperTypes.h:140
otb::Wrapper::Application::m_DocTags
std::vector< std::string > m_DocTags
Definition: otbWrapperApplication.h:1013
otbLogger.h
otb::Wrapper::Application::m_IsInPrivateDo
bool m_IsInPrivateDo
Definition: otbWrapperApplication.h:1022
otb::ApplicationException
Exception for runtime errors in OTB Applications.
Definition: otbWrapperApplication.h:51
otb::Wrapper::ComplexInt32VectorImageType
otb::VectorImage< Int32ComplexPixelType, 2 > ComplexInt32VectorImageType
Definition: otbWrapperTypes.h:167
otb::Wrapper::Application::m_DocLimitations
std::string m_DocLimitations
Definition: otbWrapperApplication.h:1007
otb::Wrapper::Application::m_MultiWriting
bool m_MultiWriting
Definition: otbWrapperApplication.h:1028
otb::Wrapper::Application::m_Doclink
std::string m_Doclink
Definition: otbWrapperApplication.h:1016
otb::Wrapper::Application::m_DocLongDescription
std::string m_DocLongDescription
Definition: otbWrapperApplication.h:998
otbStopwatch.h
otb::Wrapper::ComplexInt16ImageType
otb::Image< Int16ComplexPixelType, 2 > ComplexInt16ImageType
Definition: otbWrapperTypes.h:161
otb::Wrapper::Int32VectorImageType
otb::VectorImage< int > Int32VectorImageType
Definition: otbWrapperTypes.h:147
otb::Wrapper::ParameterType
ParameterType
Definition: otbWrapperTypes.h:37
otb::VectorImage
Creation of an "otb" vector image which contains metadata.
Definition: otbVectorImage.h:45
otbWrapperTypes.h