Request for Changes-86: Add extended filename for band selection

From OTBWiki
Jump to: navigation, search

[Request for Changes - 86] Add extended filename for band selection


  • Author: Marina Bertolino
  • Additional Contributors: Manuel Grizonnet, Guillaume Pasero
  • Submitted on 20.03.2017
  • Proposed target release 6.0
  • Adopted : +3 from Victor, Guillaume, Rémi
  • Merged : 82c7c2053edbe079dc90535956b5996604689ef8


The extended filename 'bands' allows band selection on the ImageReader and ImageWriter.


Following the ask from different users, a new extended filename has been added.

An example for using this extended filename:

  • ImageReader otbcli_Quicklook -in "landsat8.tif?bands=2,3,4" -out quicklook.tif
  • ImageWriter otbcli_Quicklook -in landsat8.tif -out "quicklook.tif?bands=2,3,4"

Implementation details

Classes and files

M       Documentation/SoftwareGuide/Latex/ReadWrite.tex
M       Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h
M       Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h
M       Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h
M       Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx
M       Modules/IO/ExtendedFilename/src/otbExtendedFilenameToReaderOptions.cxx
M       Modules/IO/ExtendedFilename/src/otbExtendedFilenameToWriterOptions.cxx
M       Modules/IO/ExtendedFilename/test/CMakeLists.txt
M       Modules/IO/ExtendedFilename/test/otbExtendedFilenameToReaderOptionsTest.cxx
M       Modules/IO/ImageIO/include/otbImageFileReader.h
M       Modules/IO/ImageIO/include/otbImageFileReader.txx
M       Modules/IO/ImageIO/include/otbImageFileWriter.h
M       Modules/IO/ImageIO/include/otbImageFileWriter.txx
M       Modules/IO/ImageIO/test/CMakeLists.txt
A       Modules/IO/ImageIO/test/otbImageFileReaderOptBandTest.cxx
A       Modules/IO/ImageIO/test/otbImageFileWriterOptBandTest.cxx
M       Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx



Add new baselines:

  • Baseline/OTB/Images/ioTvExtendedFilenameToReaderOptions_BandList.txt
  • Baseline/OTB/Images/ioTvExtendedFilenameToReaderOptions_FullOptions.txt
  • Baseline/OTB/Images/ioTvExtendedFilenameToReaderOptions_NoOptions.txt
  • Baseline/OTB/Images/QB_Toulouse_Ortho_XS_OptBand2to4.tif
  • Baseline/OTB/Images/QB_Toulouse_Ortho_XS_OptBandReorg.tif


Reader/Writer options : &bands=r1,r2,...,rn

Select a subset of bands from the input/output image.

The syntax is inspired by Python indexing syntax with bands=r1,r2,r3,...,rn where each ri is a band range that can be :

  • a single index (1-based) :
    • '2' means 2nd band,
    • '-1' or 'n' means last band.
  • or a range of bands :
    • '3:' means 3rd band until the last one,
    • ':-2' means the first bands until the second to last,
    • '2:4' means bands 2,3 and 4.
  • empty by default (all bands are write from the input/output image).

Additional notes