Skip to content
Snippets Groups Projects
Commit 4c7007df authored by Cédric Traizet's avatar Cédric Traizet
Browse files

BUG: complex images can have two times the number of bands in their metadata

parent 91d5a732
No related branches found
No related tags found
No related merge requests found
......@@ -1306,12 +1306,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))
{
......
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