compute and draw Histogram using DCMTK?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
alwittta
Posts: 111
Joined: Wed, 2006-03-15, 08:30

compute and draw Histogram using DCMTK?

#1 Post by alwittta »

Dear friends,

Please tell me how can I compute and draw Histogram of a 16 bit monochrome image using DCMTK?

Following is a sample 16 bit CR image details:

Rescale Slope == 2.81525
Rescale Inter == -240
Rows 1975
Column 1576
Pix Spacing 0.15/0.15
Bits stored 16
Bits Alloc 10
High Bit 9

min Pix = -240
Max Pix = 2640
(min and max calculated using DicomImage class's getMinMaxValues function)

Thanks and Regards
Alvin

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

That's not really a DICOM (or DCMTK) specific question. See the Wikipedia article on Histograms for baseline information. Basically you have to decide on the number of "bins" (gray value intervals) you want to distinguish in the histogram, and then you have to iterate over all pixels and increase the counter of the bin corresponding to the pixel value - done. An implementation of a histogram algorithm for color images can be found in the source code of the "dcmquant" tool which implements the so-called "Heckbert's cut" algorithm to compute an optimal color palette from a true color image.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest