OTB icon indicating copy to clipboard operation
OTB copied to clipboard

ENH: add 3d image support to StreamingManager and PipelineMemoryPrint…

Open heralex opened this issue 3 years ago • 1 comments

…Calculator

Summary

Add nD image support to otbStreamingManager and 3D image support to PipelineMemoryPrintCalculator

Rationale

The StreamingManager class defines a small, i.e. 100 pixel, region around the image centre that is used to estimate the memory footprint of the processing pipeline. The current implementation only explicitly sets the index for dimensions 0 and 1 respectively. Since the index value assignment does not account for the actual number of dimensions of the image, a 1D image would produce a segmentation fault when the value of index[1] is assigned.

The PipelineMemoryPrintCalculator currently only supports 2D images. The number of image dimensions is currently hard coded in ::EvaluateDataObjectPrint in macro OTB_IMAGE_SIZE_BLOCK.

Implementation Details

otbStreamingManager.hxx

  • The assignment of index and size values of the test region is done considering the actual number of image dimensions.
  • smallRegion.Crop(region) is removed because it is superfluous with the new implementation.

otbPipelineMemoryPrintCalculator.cxx

  • I added a set of image memory print calculation statements for 3-dimensional images to the OTB_IMAGE_SIZE_BLOCK macro
  • Note: This revision will be performance neutral for 2D images but enables use of this class for 3D images. A future improvement of this class would be to template it over the image type to enable nD support.

Copyright

The copyright owner is Manaaki Whenua - Landcare Research (MWLR). MWLR has signed the ORFEO ToolBox Contributor License Agreement.

heralex avatar Mar 09 '21 04:03 heralex

Dear @heralex, thank you for your contribution!

I copied your Pull Request in our forge, the unit tests are now running.

Sincerely. Julien.

Julien-Osman avatar Mar 29 '21 12:03 Julien-Osman