diff --git a/Code/IO/otbGDALImageIO.cxx b/Code/IO/otbGDALImageIO.cxx index eb5ae0b571e760d9653993c7ef2af5da43be209d..4415a172123c99577b7334c7382ce78c573743d0 100644 --- a/Code/IO/otbGDALImageIO.cxx +++ b/Code/IO/otbGDALImageIO.cxx @@ -714,6 +714,16 @@ void GDALImageIO::InternalReadImageInformation() { m_BytePerPixel = 4; } + else if (this->GetComponentType() == LONG) + { + long tmp; + m_BytePerPixel = sizeof(tmp); + } + else if (this->GetComponentType() == ULONG) + { + long tmp; + m_BytePerPixel = sizeof(tmp); + } else if (this->GetComponentType() == FLOAT) { m_BytePerPixel = 4; @@ -1304,6 +1314,26 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) m_BytePerPixel = 4; m_PxType->pixType = GDT_UInt32; } + else if (this->GetComponentType() == LONG) + { + long tmp; + m_BytePerPixel = sizeof(tmp); + if( m_BytePerPixel == 8 ) + { + itkWarningMacro(<< "Cast a long (64 bits) image into an int (32 bits) one.") + } + m_PxType->pixType = GDT_Int32; + } + else if (this->GetComponentType() == ULONG) + { + unsigned long tmp; + m_BytePerPixel = sizeof(tmp); + if( m_BytePerPixel == 8 ) + { + itkWarningMacro(<< "Cast an unsigned long (64 bits) image into an unsigned int (32 bits) one.") + } + m_PxType->pixType = GDT_UInt32; + } else if (this->GetComponentType() == FLOAT) { m_BytePerPixel = 4;