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

3 vues (au cours des 30 derniers jours)
Abdul Gaffar
Abdul Gaffar le 11 Juin 2021
Commenté : Abdul Gaffar le 14 Juin 2021
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?

Réponse acceptée

DGM
DGM le 12 Juin 2021
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.

Plus de réponses (0)

Catégories

En savoir plus sur DICOM Format dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by