otbApplication.Application¶
-
class
otbApplication.
Application
(*args, **kwargs)¶ This class represent an application.
This class is an abstract class that is used to set a framework for the different applications that will derived from it. It defines the basic actions that one needs to create or use an application, mainly through parameter manipulation. See the Parameter class documentation for more information.
C++ includes: otbWrapperApplication.h
-
__init__
(*args, **kwargs)¶
Methods
AddDocTag
(tag)Add a tag to the application doc tag AddExample
(*args)Add an example to the application doc example. AddImageToParameterInputImageList
(parameter, img)Add an image to an InputImageList parameter. AddObserver
(event, arg1)AddParameterStringList
(parameter, str)Add a value to a parameter list as a string. BreakOnError
ClearParameterInputImageList
(parameter)Clear all images from an InputImageList parameter. ClearValue
(paramKey)If a user value was provided clear it and update the other parameters DisableParameter
(paramKey)Disable the use of an optional parameter. EnableParameter
(paramKey)Enable the use of an optional parameter. Execute
()Run the application. ExecuteAndWriteOutput
()Run the application, then writes all the output to disk if they have an associated filename. GetCLExample
()Generate the first command line example GetChoiceKeys
(choiceKey)Returns the list of choices (key) of the ListView parameter or the Choice parameter. GetChoiceNames
(choiceKey)Returns the list of choices (name) of the ListView parameter or the Choice parameter. GetCommand
(tag)GetDescription
()Get the application description GetDocAuthors
()Doc element accessors. GetDocLimitations
()Doc element accessors. GetDocLongDescription
()Doc element accessors. GetDocName
()Doc element accessors. GetDocSeeAlso
()Doc element accessors. GetDocTags
()Get the application doc tag GetExampleComment
(id)Get the comment of the id th example of the application doc example GetExampleNumberOfParameters
(id)Get the number of parameter of the id th example of the application doc GetExampleParameterKey
(exId, paramId)Get the parameter key of the paramId th parameter of the id th example of GetExampleParameterValue
(exId, paramId)Get the parameter value of the paramId th parameter of the id th example of GetHtmlExample
()Generate the first command line example (HTML style) GetImageAsNumpyArray
(paramKey[, dt])Get an image as a Numpy Array of type dt. GetMetaDataDictionary
()GetName
()Get the application name GetNameOfClass
()RTTI support GetNumberOfElementsInParameterInputImageList
(…)Get the number of images in an InputImageList parameter. GetNumberOfExamples
()Get the number of example in the application doc example GetOutputParametersSumUp
()Return all enable parameters which role is Role_Output GetParameterAsString
(paramKey)Get the parameter as a std::string GetParameterByKey
(name)Get the internal application parameter specified. GetParameterComplexOutputImage
(parameter)Get the complex output image parameter. GetParameterComplexOutputImagePixelType
(…)Get the pixel type in which the complex image will be saved. GetParameterDescription
(arg2)Returns the description of a parameter. GetParameterFloat
(parameter)Get a floating from a parameter. GetParameterInt
(parameter)Get an integer from a parameter. GetParameterList
()Get the internal application parameters GetParameterName
(arg2)Returns the name of a parameter. GetParameterOutputImage
(parameter)Get the output image parameter GetParameterOutputImagePixelType
(parameter)Get the pixel type in which the image will be saved. GetParameterRole
(paramKey)Get the role of the parameter GetParameterString
(parameter)Get a string parameter value. GetParameterStringList
(parameter)Get a string list parameter value. GetParameterType
(paramKey)Get the parameter type GetParameterTypeAsString
(parameter_type)Get the parameter_type as a string “parameter_type”. GetParameterUserLevel
(paramKey)Return the user level of access to a parameter GetParameterValue
(paramKey)TODO GetParametersKeys
([recursive])Get the list of all parameters as a vector of their key. GetProgressDescription
()GetProgressSource
()GetVectorImageAsDoubleNumpyArray_
(pkey)GetVectorImageAsFloatNumpyArray_
(pkey)GetVectorImageAsInt16NumpyArray_
(pkey)GetVectorImageAsInt32NumpyArray_
(pkey)GetVectorImageAsNumpyArray
(paramKey[, dt])Get an vector image as a Numpy Array of type dt. GetVectorImageAsUInt16NumpyArray_
(pkey)GetVectorImageAsUInt32NumpyArray_
(pkey)GetVectorImageAsUInt8NumpyArray_
(pkey)HasAutomaticValue
(paramKey)Return true if the specified parameter was set automatically in the application. HasObserver
(event)HasUserValue
(paramKey)Returns true if the parameter has an associated value provided externally (not automatically computed by the application). HasValue
(paramKey)Returns true if the parameter has an associated value. Init
()Initialize the application, instantiating the parameter list InvokeEvent
(arg0)IsApplicationReady
()Checks if the application is ready to be executed. IsMandatory
(paramKey)Return true if the specified parameter is mandatory. IsParameterEnabled
(paramKey)Return the enable state of an optional parameter. New
Print
(os[, indent])RemoveAllObservers
()RemoveObserver
(tag)SetDescription
(_arg)Set the application description SetDocAuthors
(_arg)Doc element accessors. SetDocExampleParameterValue
(key, value[, exId])Set the parameter key value of the id th example of the application doc SetDocLimitations
(_arg)Doc element accessors. SetDocLongDescription
(_arg)Doc element accessors. SetDocName
(_arg)Doc element accessors. SetDocSeeAlso
(_arg)Doc element accessors. SetDocTags
(val)Set the application doc tag to val SetExampleComment
(comm, i)Set the i th example comment to comm SetImageFromDoubleNumpyArray_
(pkey, buffer)SetImageFromFloatNumpyArray_
(pkey, buffer)SetImageFromInt16NumpyArray_
(pkey, buffer)SetImageFromInt32NumpyArray_
(pkey, buffer)SetImageFromInt64NumpyArray_
(pkey, buffer)SetImageFromInt8NumpyArray_
(pkey, buffer)SetImageFromNumpyArray
(paramKey, npArray)Set the Image of paramKey from a Numpy Array. SetImageFromUInt16NumpyArray_
(pkey, buffer)SetImageFromUInt32NumpyArray_
(pkey, buffer)SetImageFromUInt64NumpyArray_
(pkey, buffer)SetImageFromUInt8NumpyArray_
(pkey, buffer)SetMetaDataDictionary
(rhs)SetName
(name)Set the application name SetNthParameterInputImageList
(parameter, id, img)Set the nth image of an InputImageList parameter. SetNthParameterStringList
(parameter, id, str)Set the nth value of a parameter list as a string. SetParameterComplexInputImage
(parameter, …)Set the input complex image parameter. SetParameterComplexOutputImagePixelType
(…)Set the complex pixel type in which the image will be saved. SetParameterDescription
(paramKey, dec)Set the description of a parameter. SetParameterEmpty
(parameter, value[, …])Set Active flag to value and UserValue to hasUserValueFlag . SetParameterFloat
(parameter, value[, …])Set a floating value. SetParameterInputImage
(parameter, inputImage)Set the input image parameter SetParameterInt
(parameter, value[, …])Set an integer value. SetParameterOutputImagePixelType
(parameter, …)Set the pixel type in which the image will be saved. SetParameterString
(parameter, value[, …])Set a string value. SetParameterStringList
(parameter, values[, …])Set a string value. SetParameterUserValue
(paramKey, value)Set UserValue flag of parameter with key paramKey SetParameterValue
(paramKey, value)TODO SetVectorImageFromDoubleNumpyArray_
(pkey, buffer)SetVectorImageFromFloatNumpyArray_
(pkey, buffer)SetVectorImageFromInt16NumpyArray_
(pkey, buffer)SetVectorImageFromInt32NumpyArray_
(pkey, buffer)SetVectorImageFromInt64NumpyArray_
(pkey, buffer)SetVectorImageFromInt8NumpyArray_
(pkey, buffer)SetVectorImageFromNumpyArray
(paramKey, npArray)Set the VectorImage of paramKey from a Numpy Array. SetVectorImageFromUInt16NumpyArray_
(pkey, buffer)SetVectorImageFromUInt32NumpyArray_
(pkey, buffer)SetVectorImageFromUInt64NumpyArray_
(pkey, buffer)SetVectorImageFromUInt8NumpyArray_
(pkey, buffer)ToString
()UpdateParameters
()Update the value of parameters for which no user value has been provided __init__
(*args, **kwargs)-
AddDocTag
(tag)¶ Add a tag to the application doc tag
-
AddExample
(*args)¶ Add an example to the application doc example.
Return the id of the added example
-
AddImageToParameterInputImageList
(parameter, img)¶ Add an image to an InputImageList parameter.
Add an image to an InputImageList parameter as an ImageBase pointer instead of reading from file. Useful to connect pipelines between different application instances.
- parameter :
The parameter key
- img :
The ImageBase * of the image to add
- itk::Exception :
if parameter is not found or not an InputImageList parameter
-
AddParameterStringList
(parameter, str)¶ Add a value to a parameter list as a string.
Can be called for parameter type ParameterType_InputImageList .
- parameter :
The parameter key
- str :
The filename of the image to add
- itk::Exception :
if parameter is not found or not an InputImageList parameter
-
ClearParameterInputImageList
(parameter)¶ Clear all images from an InputImageList parameter.
- parameter :
The parameter key
- itk::Exception :
if parameter is not found or not an InputImageList parameter
-
ClearValue
(paramKey)¶ If a user value was provided clear it and update the other parameters
-
DisableParameter
(paramKey)¶ Disable the use of an optional parameter.
-
EnableParameter
(paramKey)¶ Enable the use of an optional parameter.
-
Execute
()¶ Run the application.
For pipeline ready application, this only wire and configure the pipeline, and provides the output image or vector data parameters as pointers.
In other cases, the application must handle the I/O (intermediary results for example)
Returns 0 on success, or a non-null integer on error
-
ExecuteAndWriteOutput
()¶ Run the application, then writes all the output to disk if they have an associated filename.
This is a helper function for wrappers without pipeline support.
Returns 0 on success, or a non-null integer on error
-
GetCLExample
()¶ Generate the first command line example
-
GetChoiceKeys
(choiceKey)¶ Returns the list of choices (key) of the ListView parameter or the Choice parameter.
-
GetChoiceNames
(choiceKey)¶ Returns the list of choices (name) of the ListView parameter or the Choice parameter.
-
GetDescription
()¶ Get the application description
-
GetDocAuthors
()¶ Doc element accessors.
-
GetDocLimitations
()¶ Doc element accessors.
-
GetDocLongDescription
()¶ Doc element accessors.
-
GetDocName
()¶ Doc element accessors.
-
GetDocSeeAlso
()¶ Doc element accessors.
-
GetDocTags
()¶ Get the application doc tag
-
GetExampleComment
(id)¶ Get the comment of the id th example of the application doc example
-
GetExampleNumberOfParameters
(id)¶ Get the number of parameter of the id th example of the application doc example
-
GetExampleParameterKey
(exId, paramId)¶ Get the parameter key of the paramId th parameter of the id th example of the application doc example
-
GetExampleParameterValue
(exId, paramId)¶ Get the parameter value of the paramId th parameter of the id th example of the application doc example
-
GetHtmlExample
()¶ Generate the first command line example (HTML style)
-
GetImageAsNumpyArray
(paramKey, dt='float')¶ Get an image as a Numpy Array of type dt.
If datatype is unknown this method assumes to numpy.float32 Valid datatypes are: * int8 * int16 * int32 * uint8 * uint16 * uint32 * float * double
NOTE: This method always return an numpy array with dimension 3
-
GetName
()¶ Get the application name
-
GetNumberOfElementsInParameterInputImageList
(parameter)¶ Get the number of images in an InputImageList parameter.
- parameter :
The parameter key
The number of images
- itk::Exception :
if parameter is not found or not an InputImageList parameter
-
GetNumberOfExamples
()¶ Get the number of example in the application doc example
-
GetOutputParametersSumUp
()¶ Return all enable parameters which role is Role_Output
Return all parameters which role is Role_Output and that are enable in a vector of pairs that contains the parameter key (first) and its value (second).
-
GetParameterAsString
(paramKey)¶ Get the parameter as a std::string
Can be called for types :
- ParameterType_String
- ParameterType_InputFilename
- ParameterType_OutputFilename
- ParameterType_Directory
- ParameterType_InputImage
- ParameterType_ComplexInputImage
- ParameterType_InputVectorData
- ParameterType_OutputImage
- ParameterType_OutputVectorData
- ParameterType_ListView
- ParameterType_Choice
- ParameterType_OutputProcessXML
- ParameterType_InputProcessXML
- ParameterType_StringList (get parameter string list)
- ParameterType_InputImageList (get parameter string list)
- ParameterType_InputVectorDataList (get parameter string list)
- ParameterType_InputFilenameList (get parameter string list)
- ParameterType_Int
- ParameterType_Radius
- ParameterType_RAM
-
GetParameterByKey
(name)¶ Get the internal application parameter specified.
WARNING: this method may disappear from the API
-
GetParameterComplexOutputImage
(parameter)¶ Get the complex output image parameter.
Get the complex output image parameter as an ImageBase * instead of writing to disk. Useful to connect pipelines between different application instances.
- parameter :
The parameter key
The ImageBase * pointer to the output image
- itk::Exception :
if parameter is not found or not an ComplexOutputImageParameter
-
GetParameterComplexOutputImagePixelType
(parameter)¶ Get the pixel type in which the complex image will be saved.
Can be called for type ParameterType_ComplexOutputImage
-
GetParameterDescription
(arg2)¶ Returns the description of a parameter.
-
GetParameterFloat
(parameter)¶ Get a floating from a parameter.
Can be called for type ParameterType_Float
-
GetParameterInt
(parameter)¶ Get an integer from a parameter.
Can be called for types :
- ParameterType_Int
- ParameterType_Float
- ParameterType_Radius
- ParameterType_Choice
- ParameterType_RAM
-
GetParameterList
()¶ Get the internal application parameters
WARNING: this method may disappear from the API
-
GetParameterName
(arg2)¶ Returns the name of a parameter.
-
GetParameterOutputImage
(parameter)¶ Get the output image parameter
Get the output image parameter as an ImageBase * instead of writing to disk. Useful to connect pipelines between different application instances.
- parameter :
The parameter key
The ImageBase * to the output image
- itk::Exception :
if parameter is not found or not an OutputImageParameter
-
GetParameterOutputImagePixelType
(parameter)¶ Get the pixel type in which the image will be saved.
Can be called for type ParameterType_OutputImage
-
GetParameterRole
(paramKey)¶ Get the role of the parameter
-
GetParameterString
(parameter)¶ Get a string parameter value.
Can be called for types :
- ParameterType_String
- ParameterType_InputFilename
- ParameterType_OutputFilename
- ParameterType_Directory
- ParameterType_InputImage (get the filename)
- ParameterType_ComplexInputImage (get the filename)
- ParameterType_InputVectorData (get the filename)
- ParameterType_OutputImage (get the filename)
- ParameterType_OutputVectorData (get the filename)
- ParameterType_ListView (get the string list)
- ParameterType_Choice (get the string list)
-
GetParameterStringList
(parameter)¶ Get a string list parameter value.
Can be called for types :
- ParameterType_StringList
- ParameterType_ListView (get the filename list)
- ParameterType_InputImageList (get the filename list)
- ParameterType_InputVectorDataList (get the filename list)
- ParameterType_InputFilenameList (get the filename list)
-
GetParameterType
(paramKey)¶ Get the parameter type
-
GetParameterTypeAsString
(parameter_type)¶ Get the parameter_type as a string “parameter_type”.
-
GetParameterUserLevel
(paramKey)¶ Return the user level of access to a parameter
-
GetParameterValue
(paramKey)¶ TODO
-
GetParametersKeys
(recursive=True)¶ Get the list of all parameters as a vector of their key.
The recursive allows you to get all parameters inside group prameter (default value is )
-
GetProgressDescription
()¶
-
GetProgressSource
()¶
-
GetVectorImageAsDoubleNumpyArray_
(pkey)¶
-
GetVectorImageAsFloatNumpyArray_
(pkey)¶
-
GetVectorImageAsInt16NumpyArray_
(pkey)¶
-
GetVectorImageAsInt32NumpyArray_
(pkey)¶
-
GetVectorImageAsNumpyArray
(paramKey, dt='float')¶ Get an vector image as a Numpy Array of type dt.
If datatype is unknown this method assumes to numpy.float32 Valid datatypes are: * int8 * int16 * int32 * uint8 * uint16 * uint32 * float * double NOTE: This method always return an numpy array with dimension 3
-
GetVectorImageAsUInt16NumpyArray_
(pkey)¶
-
GetVectorImageAsUInt32NumpyArray_
(pkey)¶
-
GetVectorImageAsUInt8NumpyArray_
(pkey)¶
-
HasAutomaticValue
(paramKey)¶ Return true if the specified parameter was set automatically in the application.
-
HasUserValue
(paramKey)¶ Returns true if the parameter has an associated value provided externally (not automatically computed by the application).
-
HasValue
(paramKey)¶ Returns true if the parameter has an associated value.
This value can be an automatically computed value, default value, or a value set externally by user
-
Init
()¶ Initialize the application, instantiating the parameter list
-
IsApplicationReady
()¶ Checks if the application is ready to be executed.
It checks that there is no parameter missing.
-
IsMandatory
(paramKey)¶ Return true if the specified parameter is mandatory.
-
IsParameterEnabled
(paramKey)¶ Return the enable state of an optional parameter.
-
SetDescription
(_arg)¶ Set the application description
-
SetDocAuthors
(_arg)¶ Doc element accessors.
-
SetDocExampleParameterValue
(key, value, exId=0)¶ Set the parameter key value of the id th example of the application doc example to val
-
SetDocLimitations
(_arg)¶ Doc element accessors.
-
SetDocLongDescription
(_arg)¶ Doc element accessors.
-
SetDocName
(_arg)¶ Doc element accessors.
-
SetDocSeeAlso
(_arg)¶ Doc element accessors.
-
SetDocTags
(val)¶ Set the application doc tag to val
-
SetExampleComment
(comm, i)¶ Set the i th example comment to comm
-
SetImageFromDoubleNumpyArray_
(pkey, buffer)¶
-
SetImageFromFloatNumpyArray_
(pkey, buffer)¶
-
SetImageFromInt16NumpyArray_
(pkey, buffer)¶
-
SetImageFromInt32NumpyArray_
(pkey, buffer)¶
-
SetImageFromInt64NumpyArray_
(pkey, buffer)¶
-
SetImageFromInt8NumpyArray_
(pkey, buffer)¶
-
SetImageFromNumpyArray
(paramKey, npArray)¶ Set the Image of paramKey from a Numpy Array.
This method takes a numpy array and set ImageIOBase of InputImageParameter by creating an otbImage with same pixel type as numpyarray.dtype
-
SetImageFromUInt16NumpyArray_
(pkey, buffer)¶
-
SetImageFromUInt32NumpyArray_
(pkey, buffer)¶
-
SetImageFromUInt64NumpyArray_
(pkey, buffer)¶
-
SetImageFromUInt8NumpyArray_
(pkey, buffer)¶
-
SetName
(name)¶ Set the application name
-
SetNthParameterInputImageList
(parameter, id, img)¶ Set the nth image of an InputImageList parameter.
Set the nth image of an InputImageList parameter as an ImageBase pointer instead of reading from file. Useful to connect pipelines between different application instances.
- parameter :
The parameter key
- id :
Position at which to set the ImageBase pointer
- img :
The ImageBase * of the image to add
- itk::Exception :
if parameter is not found or not an InputImageList parameter or if id is out of bounds
-
SetNthParameterStringList
(parameter, id, str)¶ Set the nth value of a parameter list as a string.
Can be called for parameter type ParameterType_InputImageList .
- parameter :
The parameter key
- id :
Position at which to set the ImageBase pointer
- str :
The filename of the image to add
- itk::Exception :
if parameter is not found or not an InputImageList parameter or if id is out of bounds
-
SetParameterComplexInputImage
(parameter, inputImage)¶ Set the input complex image parameter.
Set the input complex image parameter as an ImageBase * instead of filename. Useful to connect pipelines between different application instances.
- parameter :
The parameter key
- inputImage :
ImageBase pointer to use as input
- itk::Exception :
if parameter is not found or not an ComplexInputImageParameter
-
SetParameterComplexOutputImagePixelType
(parameter, cpixelType)¶ Set the complex pixel type in which the image will be saved.
Can be called for type ParameterType_ComplexOutputImage
-
SetParameterDescription
(paramKey, dec)¶ Set the description of a parameter.
-
SetParameterEmpty
(parameter, value, hasUserValueFlag=True)¶ Set Active flag to value and UserValue to hasUserValueFlag .
-
SetParameterFloat
(parameter, value, hasUserValueFlag=True)¶ Set a floating value.
Can be called for type ParameterType_Float
-
SetParameterInputImage
(parameter, inputImage)¶ Set the input image parameter
Set the input image parameter as an ImageBase * instead of filename. Useful to connect pipelines between different application instances.
- parameter :
The parameter key
- inputImage :
ImageBase pointer to use as input
- itk::Exception :
if parameter is not found or not an InputImageParameter
-
SetParameterInt
(parameter, value, hasUserValueFlag=True)¶ Set an integer value.
Can be called for types :
- ParameterType_Int
- ParameterType_Float
- ParameterType_Radius
- ParameterType_Choice
-
SetParameterOutputImagePixelType
(parameter, pixelType)¶ Set the pixel type in which the image will be saved.
Can be called for type ParameterType_OutputImage
-
SetParameterString
(parameter, value, hasUserValueFlag=True)¶ Set a string value.
Can be called for types :
- ParameterType_Choice
- ParameterType_ListView
- ParameterType_String
- ParameterType_InputFilename
- ParameterType_OutputFilename
- ParameterType_Directory
- ParameterType_RAM
- ParameterType_Int (conversion)
- ParameterType_Float (conversion)
- ParameterType_Radius (conversion)
- ParameterType_InputImage (set filename)
- ParameterType_ComplexInputImage (set filename)
- ParameterType_InputVectorData (set filename)
- ParameterType_OutputImage (set filename)
- ParameterType_ComplexOutputImage (set filename)
- ParameterType_OutputVectorData (set filename)
- ParameterType_OutputProcessXML (set filename)
- ParameterType_InputProcessXML (set filename)
-
SetParameterStringList
(parameter, values, hasUserValueFlag=True)¶ Set a string value.
Can be called for types :
- ParameterType_StringList
- ParameterType_InputFilenameList
- ParameterType_ListView (set selected names)
- ParameterType_InputVectorDataList (set filenames)
- ParameterType_InputImageList (set filenames)
-
SetParameterUserValue
(paramKey, value)¶ Set UserValue flag of parameter with key paramKey
-
SetParameterValue
(paramKey, value)¶ TODO
-
SetVectorImageFromDoubleNumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromFloatNumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromInt16NumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromInt32NumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromInt64NumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromInt8NumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromNumpyArray
(paramKey, npArray)¶ Set the VectorImage of paramKey from a Numpy Array.
This method takes a numpy array and set ImageIOBase of InputImageParameter by creating an otbVectorImage with same pixel type as numpyarray.dtype. NOTE: Input (npArray) must be an ndarray with 3 dimension, len(npArray.shape) must be > 2
-
SetVectorImageFromUInt16NumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromUInt32NumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromUInt64NumpyArray_
(pkey, buffer)¶
-
SetVectorImageFromUInt8NumpyArray_
(pkey, buffer)¶
-
UpdateParameters
()¶ Update the value of parameters for which no user value has been provided
-