ManageNoData¶
Manage No-Data
Description¶
This application has two modes. The first allows building a mask of no-data pixels from the no-data flags read from the image file. The second allows updating the change the no-data value of an image (pixels value and metadata). This last mode also allows replacing NaN in images with a proper no-data value. To do so, one should activate the NaN is no-data option.
Parameters¶
Input image -in image
Mandatory
Input image
Output Image -out image [dtype]
Mandatory
Output image
Consider NaN as no-data -usenan bool
Default value: false
If active, the application will consider NaN as no-data values as well
No-data handling mode -mode [buildmask|changevalue|apply]
Default value: buildmask
Allows choosing between different no-data handling options
Build a no-data Mask
Change the no-data value
Apply a mask as no-data
Apply an external mask to an image using the no-data value of the input image
Build a no-data Mask options¶
Inside Value -mode.buildmask.inv float
Default value: 1
Value given in the output mask to pixels that are not no data pixels
Outside Value -mode.buildmask.outv float
Default value: 0
Value given in the output mask to pixels that are no data pixels
Change the no-data value options¶
The new no-data value -mode.changevalue.newv float
Default value: 0
The new no-data value
Apply a mask as no-data options¶
Mask image -mode.apply.mask image
Mandatory
Mask to be applied on input image (valid pixels have non null values)
Nodata value used -mode.apply.ndval float
Default value: 0
No Data value used according to the mask image
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
Examples¶
From the command-line:
otbcli_ManageNoData -in QB_Toulouse_Ortho_XS.tif -out QB_Toulouse_Ortho_XS_nodatamask.tif uint8 -mode.buildmask.inv 255 -mode.buildmask.outv 0
From Python:
import otbApplication
app = otbApplication.Registry.CreateApplication("ManageNoData")
app.SetParameterString("in", "QB_Toulouse_Ortho_XS.tif")
app.SetParameterString("out", "QB_Toulouse_Ortho_XS_nodatamask.tif")
app.SetParameterOutputImagePixelType("out", 1)
app.SetParameterFloat("mode.buildmask.inv", 255)
app.SetParameterFloat("mode.buildmask.outv", 0)
app.ExecuteAndWriteOutput()