Commit 9c913556 authored by Julien Osman's avatar Julien Osman

Merge branch '2024-metadata-refac' of...

Merge branch '2024-metadata-refac' of gitlab.orfeo-toolbox.org:orfeotoolbox/otb into 2024-metadata-refac
parents b9a74362 4c7007df
......@@ -50,13 +50,23 @@ int otbChangeInformationImageFilter(int itkNotUsed(argc), char* argv[])
filter->UpdateOutputInformation();
ImageType::Pointer outImage = filter->GetOutput();
if (!outImage->GetProjectionRef().empty())
// TODO: RemoveOssim. ChangeInformationImageFilter should change the ImageMetadata object stored in
// the image instead of modifying the itk metadata dictionary. GetProjectionRef() look for the
// projection in ImageMetadata now, so we can't use this method in the test. The temporary solution
// is to look in the itk dictionary instead (this was the old behavior of GetProjectionRef). But
// when ChangeInformationImageFilter will be refactored, GetProjectionRef should be used again..
//if (!outImage->GetProjectionRef().empty())
if (outImage->GetMetaDataDictionary().HasKey(otb::MetaDataKey::ProjectionRefKey))
{
std::cout << "Projection is supposed to be removed but is still present !" << std::endl;
return EXIT_FAILURE;
}
itk::MetaDataDictionary& dict = outImage->GetMetaDataDictionary();
if (!dict.HasKey(otb::MetaDataKey::NoDataValueAvailable) || !dict.HasKey(otb::MetaDataKey::NoDataValue))
{
std::cout << "Missing no data metadata !" << std::endl;
......
......@@ -1309,12 +1309,15 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
}
m_Imd.Bands = bandRangeMetadata;
}
std::cout << m_Imd << std::endl;
if ( !m_Imd.Bands.empty() && (std::size_t)m_NbBands != m_Imd.Bands.size())
{
itkExceptionMacro(<< "Number of bands in metadata inconsistent with actual image.");
}
// TODO : this should be a warning instead of an exception
// For complex pixels the number of bands is twice the number of compnents (in GDAL sense)
if ( !m_Imd.Bands.empty()
&& static_cast<std::size_t>(m_NbBands) != m_Imd.Bands.size()
&& !((m_Imd.Bands.size() == static_cast<std::size_t>(2 * m_NbBands)) && this->GetPixelType() == COMPLEX))
{
itkExceptionMacro(<< "Number of bands in metadata inconsistent with actual image.");
}
if ((m_Dimensions[0] == 0) && (m_Dimensions[1] == 0))
{
......
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