This question is in reference to this paper. In Fig. 1b, the joint histogram of data value and gradient magnitude is plotted. What I understand is that the values in the plot represent the frequencies of voxels having the corresponding data value and gradient. However, I am confused how to implement this in Mathematica. Below is what I have tried so far:
img = ImageRotate[Import["ChapelHillCThead.tif", "Image3D"], {Pi, {1, 0, 0}}];
data = ImageData[img];
imggrad = GradientFilter[img, 1];
grad = ImageData[imggrad];
dataf = Flatten@data;
gradf = Flatten@grad;
nd = BinCounts[dataf, {0, 1, 1/255}];
ng = BinCounts[gradf, {0, 1, 1/255}];
(* This is to calculate the joint histogram *)
jh = Table[Min[nd[[i]], ng[[j]]], {i, 1, 255}, {j, 1, 255}];
I know this cannot give me the desired result. However, I don't find any alternative way apart from checking the data value and gradient for each voxel and count them.
How can I get the desired result in a fast and efficient way?
[The Chapel Hill CT dataset can be found here]
Histogram
function $\endgroup$ImageHistogram[Import["ChapelHillCThead.tif", "Image3D"]]
work for you? $\endgroup$