Difference between revisions of "Request for Changes-1: Read, Write and manage no-data flags in Orfeo ToolBox"

From OTBWiki
Jump to: navigation, search
Line 5: Line 5:
* Submitted on 17.09.2015
* Submitted on 17.09.2015
* Proposed target release: 5.2
* Proposed target release: 5.2
* Adopted (+3 from Jordi, Manuel, Julien)
* Adopted (+3 from Jordi, Manuel, Julien), merged in OTB 5.1
* Git branch: https://git.orfeo-toolbox.org/otb.git/shortlog/refs/heads/rfc-7-backend
* Git branch: https://git.orfeo-toolbox.org/otb.git/shortlog/refs/heads/rfc-7-backend

Latest revision as of 10:01, 21 September 2015



This Request for Changes implements reading no data flags to the Image MetaDataDictionary and write them back if the driver supports it. Some low-level helper functions are provided to manipulate those flags, as well as filters to build a no-data mask and update the no-data value. An application allows to perform both operations.


This will improve OTB support of no-data flags, which was very poor until now. See Request for Comments 7.

Implementation details

Note that gdal no-data flags consist in, for each channel:

  • A boolean flag to tell if a no-data value exists for this channel
  • A value to be used as no-data

Implementation proposed in this Request for Changes reflects this (support setup for each channel separately). Internally, flags are managed through a std::vector<bool> and values through a std::vector<double>.

Note that filters and applications also have an option to consider NaN values as no-data as well.

Classes and files

  • Module Adapters/OSSIMAdapters:
    • otb::MetaDataKey: Add key for no-data available and no-data values MetaData
  • Module IO/IOGDAL:
    • GdalImageIO: Read/Write no-data values and flags from/to MetaDataDictionary.
  • Module Core/Metadata:
    • Adding NoDataHelper.cxx and .h files containing functions to help no-data flag manipulation (import/export flags from/to MetaDataDictionary, test a pixel for no-data, update no-data in a pixel)
    • Add a method ot ImageMetadataInterfaceBase to get the no-data flags
  • Filtering/ImageManipulation:
    • Add a ImageToNoDataMaskFilter, which outputs a mask of pixel containg no-data
    • Add a ChangeNoDataValueFilter, which allows to change the no-data value in an image (update MetaDataDictionary and Image content)


  • In Applications/AppImageUtils, the ReadImageInfo application has been modified to output no-data flags and values
  • In Applications/AppImageUtils, the ManageNoData application has been created. It allows to :
    • Create a mask of pixels containing no-data values using the ImageToNoDataMaskFilter
    • Update the no-data value (only a single value is supported for all channels) using the ChangeNoDataValueFilter


Branch is tested on the dashboard

The following tests have been added:

  • Core/Metadata/test/otbNoDataHelperTest.cxx
  • ImageManipulation/test/otbImageToNoDataMaskFilter.cxx
  • Filtering/ImageManipulation/test/otbChangeNoDataValueFilter.cxx


  • Doxygen documentation added for ChangeNoDataValueFilter, ImageToNoDataMaskFilter, new methods in ImageMetadataInterfaceBase, functions in otbNoDataHelper.h
  • Application documentation completed.
  • CookBook section added : "4.4.2 Images with no-data values"

Additional notes

Application ManageNoData is not tested per se. Testing it would require to add an image with no-data flags in OTB-Data/Input.