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

From OTBWiki
Jump to: navigation, search
([Request for Changes - 1] Read, write and manage no-data flags in Orfeo ToolBox)
(Tests)
Line 52: Line 52:
  
 
The following tests have been added:
 
The following tests have been added:
* Core/Metadata/test/otbNoDataHelperTest.cxx:
+
* Core/Metadata/test/otbNoDataHelperTest.cxx
 
** Tests the funcions in otbNoDataHelper.h
 
** Tests the funcions in otbNoDataHelper.h
 
** Does not require any input or baseline data
 
** Does not require any input or baseline data
 
** [http://dash.orfeo-toolbox.org/testSummary.php?project=3&name=coreMetaDataNoDataHelperTest&date=2015-09-17 Test passes as of today]
 
** [http://dash.orfeo-toolbox.org/testSummary.php?project=3&name=coreMetaDataNoDataHelperTest&date=2015-09-17 Test passes as of today]
* ImageManipulation/test/otbImageToNoDataMaskFilter.cxx:
+
* ImageManipulation/test/otbImageToNoDataMaskFilter.cxx
 
** Tests the ImageToNoDataMaskFilter class
 
** Tests the ImageToNoDataMaskFilter class
 
** Does not require any input or baseline data
 
** Does not require any input or baseline data

Revision as of 15:52, 17 September 2015

[Request for Changes - 1] Read, write and manage no-data flags in Orfeo ToolBox

Status

Summary

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.

Rationale

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 Adapaters/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)

Applications

  • 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

Tests

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

Documentation

  • Doxygen documentation added for ChangeNoDataValueFilter, ImageToNoDataMaskFilter, new methods in ImageMetadataInterfaceBase, functions in otbNoDataHelper.h
  • Application documentation completed.

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.