DicomImageClass::rangeToBits adds 1 (DCMTK 3.5.4)

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
cfremgen
Posts: 7
Joined: Wed, 2006-08-16, 15:31

DicomImageClass::rangeToBits adds 1 (DCMTK 3.5.4)

#1 Post by cfremgen »

Hi there!

DicomImageClass::rangeToBits uses tobits from diutils.h to calculate the number of bits necessary for a specific value.

Is the adding of 1 to the result of tobits intended? Because this leads to a higher number of bits than I expect. Or am I just misinterpreting the functionality of this method?
Example:
parameters of rangeToBits:
minvalue = -1024, maxvalue = 64511
parameter tb_value of tobits = 64511 -> tobits returns 16, rangeToBits returns 17

I encounterd this using the following:
DiMonoImage::getMonoInterData()->getBits();

kind regards
christian

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

rangeToBits() returns the number of bits that are required to store values in the given range. In order to store values in the range between -1024 and 64511 you need 17 bits (assuming "symmetry" of the negative and positive axis). In fact, 17 bits allow you to store values in the range -65536 to 65535, but 16 bit would be limited to -32768 to 32767.

cfremgen
Posts: 7
Joined: Wed, 2006-08-16, 15:31

#3 Post by cfremgen »

So do I understand correctly, that rangeToBits returns the bit-range necessary for the stored values with rescale intercept applied?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

No, rangeToBits() just returns the number of bits that are required to store values in the given range (min/max). See implementation of this function for details.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest