Commit 33d5ed29 authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: #1568: support for MS and P products

parent d96e3ade
......@@ -937,30 +937,48 @@ PleiadesImageMetadataInterface
itkExceptionMacro(<< "Invalid Metadata, no Pleiades Image");
}
std::vector<unsigned int> rgb(3);
rgb[0] = 0;
rgb[1] = 1;
rgb[2] = 2;
ImageKeywordlistType imageKeywordlist;
if (! dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
return rgb;
}
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
if ( !imageKeywordlist.HasKey( "support_data.band_name_list" ) )
{
itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
return rgb;
}
std::vector<unsigned int> rgb(3);
const std::string & rgbOrder =
imageKeywordlist.GetMetadataByKey( "support_data.band_name_list" );
rgb[0] = 0;
rgb[1] = 1;
rgb[2] = 2;
std::vector<std::string> bandList;
boost::split(bandList, rgbOrder, boost::is_any_of(" "));
if (bandList[0] == "P")
{
rgb[1] = 0;
rgb[2] = 0;
return rgb;
}
if ( imageKeywordlist.HasKey( "support_data.band_name_list" ) )
{
const std::string & rgbOrder =
imageKeywordlist.GetMetadataByKey( "support_data.band_name_list" );
auto place = rgbOrder.find("B");
if (bandList.size() >= 3)
{
for (int i = 0 ; i < 3 ; i++ )
{
rgb[i] = rgbOrder[place+1] -'0';
place = rgbOrder.find("B", place+1 );
std::string band = bandList[i];
if (band[0] == 'B')
{
rgb[i] = lexical_cast<unsigned int>(band.c_str() + 1);
}
}
}
}
return rgb;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment