How to calculate entropy of a DICOM image (16-bit depth)?

3 次查看(过去 30 天)
According to MatLab,
  • By default, entropy uses two bins for logical arrays and 256 bins for uint8, uint16, or double arrays.
  • entropy converts any class other than logical to uint8 for the histogram count calculation so that the pixel values are discrete and directly correspond to a bin value.
How to calculate exact value of entropy for 16-bit DICOM image without converting to uint8 class, i.e, utilizing 2^(16) bins?

采纳的回答

DGM
DGM 2021-6-12
Just open up entropy() or look at the docs to see how it works.
% just grab some image and make it into an example
inpict = imread('cameraman.tif'); % this is uint8
inpict = im2uint16(inpict); % make it uint16
% process it to move the data outside of 2^8 locations
inpict = imfilter(inpict,fspecial('disk',3));
% this is what entropy() does
counts = imhist(inpict(:),2^16);
numel(counts) % it's using 65536 bins
counts = counts(counts~=0); % get rid of empty bins
numel(counts) % how many bins are left?
counts = counts/numel(inpict); % normalize the sum
E = -sum(counts.*log2(counts)) % this is the result with 65536 bins
F = entropy(inpict) % this is the result with 256 bins
For illustrative purposes, try commenting out the imfilter() line and see what happens to the bin counts and the relationship between E and F.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 DICOM Format 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by