Zonalstatistics
Summary
Add a new application for zonal statistics.
Rationale
There is currently no such application in the Orfeo ToolBox. This application enables to compute statistics (min, max, mean, standard deviation) of objects in a vector image.
Implementation Details
Input objects can be described from a vector data, or from a label image:
- mode vector: the 
VectorDatais rasterized at the same origin/spacing/size as the input image. Polygons are numbered starting from 0. The statistics are computed using aStreamingStatisticsMapFromLabelImageFilter. - mode label image: the statistics are directly computed using a 
StreamingStatisticsMapFromLabelImageFilter, from the input image and the label image. 
The application enables to produce output stats in multiple forms:
- as XML (Using a XMLFileWriter as the ComputeImagesStatistics application do),
 - VectorData (stats are written in features of each polygons),
 - or Raster (stats are stored in bands of the output image)
 
Classes and files
- A new application in 
AppClassification:ZonalStatistics(otbZonalStatistics.cxx) - 5 tests were added in 
AppClassification/test 
Applications
New: ZonalStatistics application (otbZonalStatistics.cxx)
Tests
- Input vector / Output vector
 - Input raster / Output XML (without nodata-value for the label image)
 - Input raster / Output XML (with nodata-value for the label image)
 - Input vector / Output raster
 - Input raster / Output raster
 
I've pushed a new branch in otb-data called "zonalstatistics" which contains new files in baseline and input:
- Baseline/apTvClVectorData_QB1_ter_with_stats.sqlite
 - Input/Classification/VectorData_QB1_ter.tif
 - Baseline/apTvClVectorData_QB1_ter_stats.xml
 - Baseline/apTvClVectorData_QB1_ter_stats_nodata.xml
 
Additional notes
Please feel free to discuss this feature.
Copyright
The copyright owner is IRSTEA and has signed the ORFEO ToolBox Contributor License Agreement.
***Check before merging:*** - All discussions are resolved - At least 2
Edited  by Rémi Cresson