Skip to content

Multi writer

@CSSI_OTB requested to merge cs-si/otb:multi_writer into develop


This branch contains a Multi-writer class, designed to writer several files in a synchronized way.


The multi-writer has been developed for Sentinel2 processing chains, and has been revamped to a more generic version. There is also a feature request about a synchronized writer (#1532 (closed)).

Implementation Details

Classes and files

M       Modules/Core/Streaming/include/otbStreamingManager.h
M       Modules/Core/Streaming/include/otbStreamingManager.txx

Allow to access the splitter base type.

M       Modules/IO/ImageIO/include/otbImageFileWriter.h
M       Modules/IO/ImageIO/include/otbImageFileWriter.txx

The writing of output information in the image has been moved to the GenerateOutputInformation().

A       Modules/IO/ImageIO/include/otbMultiImageFileWriter.h
A       Modules/IO/ImageIO/include/otbMultiImageFileWriter.txx
M       Modules/IO/ImageIO/src/CMakeLists.txt
A       Modules/IO/ImageIO/src/otbMultiImageFileWriter.cxx

The new MultiImageFileWriter is not a templated class, but it relies on internal template class Sink<TImage>. This writer will stream a list of input images and write the chunks for each output file. Each input image is divided into the same number of streams, and the processing is synchronized:

  • The pipeline computes the chunk n° i for each output image.
  • Then the MultiWriter writes to disk the chunk n° i for each output image
  • The pipeline compute the chunk n° i+1 ...

Note that there is no constraint on inputs having the same size.

The last changes are not required, but they prepare the way for the integration of MultiImageWriter into otb::Wrapper::Application.

M       Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h
A       Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx
M       Modules/MPI/MPIVrtWriter/otb-module.cmake

The function using MPI to write an image as several TIF and a VRT file has been moved into a standard filter, so that we have a ProcessObject to call Update().

M       Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx

The implementation of the output image parameter has been simplified. It will now prepare the caster and writer during InitializeWriters(), and you can trigger the pipeline later using Write(). Note that with this mini refactoring, even the MPI writers (SPTW and VRT) can be retrieved by GetWriter(), enabling progress monitoring (which was not the case before)

M       Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx

Due to the previous change on OutputImageParameter, the InitializeWriters() has to be called after setting the default RAM.



M       Modules/IO/ImageIO/test/CMakeLists.txt
M       Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
A       Modules/IO/ImageIO/test/otbMultiImageFileWriterTest.cxx

New test for the MultiImageFileWriter.


Additional notes

Edited by Guillaume Pasero

Merge request reports