Commit 471a694d authored by Guillaume Pasero's avatar Guillaume Pasero

Merge branch 'default_display_pleiadeMetaData' into 'release-6.6'

Resolve "wrong default RGB composition for Pleiades image"

See merge request !73
parents 303ae6f0 33d5ed29
......@@ -441,10 +441,10 @@ private:
catch ( itk::ExceptionObject & /*err*/ )
{
}
SetParameterInt("rgb.r",metadataInterface->GetDefaultDisplay()[0]);
SetParameterInt("rgb.g",metadataInterface->GetDefaultDisplay()[1]);
SetParameterInt("rgb.b",metadataInterface->GetDefaultDisplay()[2]);
auto rgbVect = metadataInterface->GetDefaultDisplay();
SetParameterInt("rgb.r",rgbVect[0]);
SetParameterInt("rgb.g",rgbVect[1]);
SetParameterInt("rgb.b",rgbVect[2]);
ossOutput << std::endl << "Image default RGB composition:" << std::endl;
ossOutput << "\t[R, G, B] = [" << GetParameterInt("rgb.r") << "," << GetParameterInt("rgb.g") << "," << GetParameterInt("rgb.b") << "]" << std::endl;
......
......@@ -937,19 +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;
}
const std::string & rgbOrder =
imageKeywordlist.GetMetadataByKey( "support_data.band_name_list" );
std::vector<unsigned int> rgb(3);
std::vector<std::string> bandList;
boost::split(bandList, rgbOrder, boost::is_any_of(" "));
rgb[0] = 0;
rgb[1] = 1;
rgb[2] = 2;
if (bandList[0] == "P")
{
rgb[1] = 0;
rgb[2] = 0;
return rgb;
}
if (bandList.size() >= 3)
{
for (int i = 0 ; i < 3 ; i++ )
{
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