Image files can contain a no-data value in their metadata. It represents a special pixel value that should be treated as ”no data available for this pixel”. For instance, SRTM tiles use a particular no-data value of -32768 (usually found on sea areas).
On multiband images, the no-data values are handled independently for each band. The case of an image with no-data values defined only for a subset of its bands is supported.
This metadata is now handled by OTB image readers and writer (using the GDAL driver). The no-data value can be read from an image files and stored in the image metadata dictionary. It can also be exported by image writers. The OTB filters that produce a no-data value are able to export this value so that the output file will store it.
An application has been created to manage the no-data value. The ManageNoData application has the following features :
For instance, the following command converts the no-data value of the input image to the default value for DEM (which is -32768) :
The third mode ”apply” can be useful if you apply a formula to the entire image. This will likely change the values of pixels flagged as no-data, but the no-data value in the image metadata doesn’t change. If you want to fix all no-data pixels to their original value, you can extract the mask of the original image and apply it on the output image. For instance:
You can also use this ”apply” mode with an additional parameter ”mode.apply.ndval”. This parameter allow to set the output nodata value applying according to your input mask.