All other questions regarding DCMTK
Moderator: Moderator Team
hmmr
Posts: 5 Joined: Tue, 2012-11-27, 09:11
#1
Post
by hmmr » Mon, 2013-04-29, 08:01
Could you explain why after calling createWindowsDIB been allocated another number of bytes and was changed width of the image?
Code: Select all
m_spOriginalImage->getDepth(); // 8
m_spOriginalImage->getWidth(); // 1024
m_spOriginalImage->getHeight(); // 1024
const unsigned long nNewWidth = 942;
const unsigned long nNewHeight = 942;
std::shared_ptr<DicomImage> spScaledImage(
m_spOriginalImage->createScaledImage(nNewWidth, nNewHeight, 0, 0) );
// 942*942 = 887364
unsigned long nSize = spScaledImage->getWidth() * spScaledImage->getHeight();
unsigned char * pBuffer = nullptr;
unsigned long nNewSize = spScaledImage->createWindowsDIB((void*&)pBuffer, nSize, 0,
spScaledImage->getDepth(), 1, 1);
// nNewSize = 889248 (!!!)
J. Riesmeier
DCMTK Developer
Posts: 2506 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#2
Post
by J. Riesmeier » Mon, 2013-04-29, 08:51
Reading the
documentation (or knowing how the Window DIB format is defined), it should be obvious that the call to createWindowsDIB(..., 1) aligns each line to a 32-bit address. This is what's usually called "padding".
Why don't you just specify a value of 0 for the "size" parameter?
hmmr
Posts: 5 Joined: Tue, 2012-11-27, 09:11
#3
Post
by hmmr » Mon, 2013-04-29, 12:58
J. Riesmeier wrote: Why don't you just specify a value of 0 for the "size" parameter?
Thanks, that's clear. Then I'll take this into account when creating images.
Users browsing this forum: No registered users and 1 guest