From 2fcda8ae8c633b2006454ea149d44f860574a17a Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org> Date: Tue, 11 Sep 2012 13:49:45 +0200 Subject: [PATCH] BUG: uncomment BandIndexToWavelengthPosition and manage panchromatic case --- Code/IO/otbPleiadesImageMetadataInterface.cxx | 32 ++++++++++++------- Code/IO/otbPleiadesImageMetadataInterface.h | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Code/IO/otbPleiadesImageMetadataInterface.cxx b/Code/IO/otbPleiadesImageMetadataInterface.cxx index ffe11b28f5..1214e6bddc 100644 --- a/Code/IO/otbPleiadesImageMetadataInterface.cxx +++ b/Code/IO/otbPleiadesImageMetadataInterface.cxx @@ -663,17 +663,27 @@ PleiadesImageMetadataInterface } // TODO MSD need to update this function -//Comment this part as relative response -//FIXME check if this is coherent with other sensor -// unsigned int -// PleiadesImageMetadataInterface -// ::BandIndexToWavelengthPosition(unsigned int i) const -// { -// otbMsgDevMacro(<< "Pleiades detected: band 0 and 2 inverted"); -// if (i == 0) return 2; -// if (i == 2) return 0; -// return i; -// } +// Comment this part as relative response +// FIXME check if this is coherent with other sensor +unsigned int +PleiadesImageMetadataInterface +::BandIndexToWavelengthPosition(unsigned int i) const +{ + int nbBands = this->GetNumberOfBands(); + //Panchromatic case + if (nbBands == 1) + { + return 0; + } + else + { + otbMsgDevMacro(<< "Pleiades detected: band 0 and 2 inverted"); + if (i == 0) return 2; + if (i == 2) return 0; + } + + return i; +} std::vector<unsigned int> PleiadesImageMetadataInterface diff --git a/Code/IO/otbPleiadesImageMetadataInterface.h b/Code/IO/otbPleiadesImageMetadataInterface.h index 9b0a070616..ecae4a1d5d 100644 --- a/Code/IO/otbPleiadesImageMetadataInterface.h +++ b/Code/IO/otbPleiadesImageMetadataInterface.h @@ -103,7 +103,7 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - //virtual unsigned int BandIndexToWavelengthPosition(unsigned int i) const; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ -- GitLab