plotting the histogram of images (difference in MATLAB and ImageJ)

조회 수: 1 (최근 30일)
Shel
Shel 2018년 8월 9일
댓글: Shel 2018년 8월 15일
I need to plot the histogram of a medical image (512*512) in MATLAB but as I could not find how to set a good range for the x-y axis and I was not sure about the accuracy of imhist command (it looked somehow strange!) I tried to write the code as following however it does not work. I will highly appreciate any suggestions on how to remove the error(s) and plot the histogram of the image in this regard.
A=dicomread('med.dcm');
C := matrix (255,2);
B := matrix(512 512);
binwidth = max(A(:))- min(A(:));
for k=1:512
for l=1:512
for j=0:256
A(k,l) = min (A(:))+j*binwidth;
if A(k,l)<A(k,l)+binwidth/2
B(k,l)== A(k,l);
elseif A(k,l)== A(k,l)+binwidth/2
B(k,l)== A(k,l);
else
B(k,l)== A(k,l)+binwidth
end
end
end
end
s==0;
for i=min(A(:)): max(A(:))
for p=1:262144
for k=1:512
for l=1:512
if B(k,l)== i
C(p,2)==s+1;
else
i=i+binwidth;
C(p,2)==s;
C(p,1)==i;
end
end
end
end
end
hist(C(:))
  댓글 수: 9
jonas
jonas 2018년 8월 13일
편집: jonas 2018년 8월 13일
Well, I've never used ImageJ, but to me it seems quite obvious that those two images are not identical. See attached figure. My eyes, as well as the features of the histogram, tells me that the ImageJ one has been tampered with somehow. My guess is that the filter you applied is not the same in MATLAB as in ImageJ. Perhaps the unit of 7 differs, or perhaps it is the method involved that is different.
And no, I'm not saying that ImageJ does anything automatically. The others images you uploaded does not have the same smooth features.
Shel
Shel 2018년 8월 15일
Thanks for your time answering my questions. As I found, the filtering in imagej is in a circular form (setting a radius for filtration) and matlab is in square,rectangle. Might it be the reason? Also, would you please let me know what is wrong with my code in the first comment? Thanks

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 3-D Volumetric Image Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by