Skip to content
Snippets Groups Projects
Commit a365e734 authored by Ludovic Hussonnois's avatar Ludovic Hussonnois
Browse files

BUG: Perform more check on noDataValueAvailable.

parent 28b847ed
No related branches found
No related tags found
No related merge requests found
...@@ -128,35 +128,44 @@ SimpleRcsPanSharpeningFusionImageFilter ...@@ -128,35 +128,44 @@ SimpleRcsPanSharpeningFusionImageFilter
m_ConvolutionFilter->SetRadius(this->m_Radius); m_ConvolutionFilter->SetRadius(this->m_Radius);
m_ConvolutionFilter->SetFilter(this->m_Filter); m_ConvolutionFilter->SetFilter(this->m_Filter);
typedef typename TPanImageType::InternalPixelType PanPixelType;
typedef typename TXsImageType::InternalPixelType XsPixelType;
// Write no-data flags for Pan image // Write no-data flags for Pan image
std::vector<bool> noDataValuesPanAvailable; std::vector<bool> tmpNoDataValuePanAvailable;
double tmpNoDataValuePan; std::vector<double> tmpNoDataValuePan;
typename TPanImageType::InternalPixelType noDataValuePan; bool noDataValuePanAvailable = false;
bool retPan = itk::ExposeMetaData<std::vector<bool>>( this->GetPanInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValueAvailable, noDataValuesPanAvailable ); PanPixelType noDataValuePan = 0;
itk::ExposeMetaData<double>( this->GetPanInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValue, tmpNoDataValuePan );
noDataValuePan = static_cast<typename TPanImageType::InternalPixelType>( tmpNoDataValuePan ); bool retPan = itk::ExposeMetaData<std::vector<bool> >( this->GetPanInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValueAvailable, tmpNoDataValuePanAvailable );
bool noDataValuePanAvailable = noDataValuesPanAvailable[0]; retPan &= itk::ExposeMetaData<std::vector<double> >( this->GetPanInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValue, tmpNoDataValuePan );
noDataValuePanAvailable &= retPan;
if(retPan && tmpNoDataValuePanAvailable.size() > 0 && tmpNoDataValuePan.size() > 0)
{
noDataValuePanAvailable = tmpNoDataValuePanAvailable[0] && retPan;
noDataValuePan = static_cast<PanPixelType>( tmpNoDataValuePan[0] );
}
// Write no-data flags for Xs image // Write no-data flags for Xs image
std::vector<bool> noDataValuesXsAvailable; std::vector<bool> noDataValuesXsAvailable;
std::vector<double> tmpNoDataValuesXs; std::vector<double> tmpNoDataValuesXs;
std::vector<typename TXsImageType::InternalPixelType> noDataValuesXs; std::vector<XsPixelType> noDataValuesXs;
bool retXs = itk::ExposeMetaData<std::vector<bool> >( this->GetXsInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValueAvailable, noDataValuesXsAvailable ); bool retXs = itk::ExposeMetaData<std::vector<bool> >( this->GetXsInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValueAvailable, noDataValuesXsAvailable );
itk::ExposeMetaData<std::vector<double> >( this->GetXsInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValue, tmpNoDataValuesXs ); retXs &= itk::ExposeMetaData<std::vector<double> >( this->GetXsInput()->GetMetaDataDictionary(), MetaDataKey::NoDataValue, tmpNoDataValuesXs );
// Check if noData is needed and update noDataValuesAvailable with return function value // Check if noData is needed and update noDataValuesAvailable with return function value
if(retPan || retXs) if ( retPan || retXs )
{ {
m_UseNoData = noDataValuePanAvailable; m_UseNoData = noDataValuePanAvailable;
for ( unsigned int i = 0; i < noDataValuesXsAvailable.size(); ++i ) for ( unsigned int i = 0; i < tmpNoDataValuesXs.size() && i < noDataValuesXsAvailable.size(); ++i )
{ {
noDataValuesXs.push_back(static_cast<typename TXsImageType::InternalPixelType>(tmpNoDataValuesXs[i])); noDataValuesXs.push_back( static_cast<XsPixelType>(tmpNoDataValuesXs[i]) );
m_UseNoData |= (noDataValuesXsAvailable[i] = (noDataValuesXsAvailable[i] && retXs)); m_UseNoData |= (noDataValuesXsAvailable[i] = (noDataValuesXsAvailable[i] && retXs));
} }
} }
// Instantiate fusion filter // Instantiate fusion filter
if ( m_UseNoData ) if ( m_UseNoData )
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment