Creating an appropriate histogram from MR Image
Show older comments
I'm trying to plot a histogram for an ROI dicom image from an MRI. I'm doing this in order to try to threshold the image. I'm creating a mask from a free-drawn ROI and then plotting a histogram from it. Below is the code i'm using to create the histograms, as well as the images produced. My issue is essentially the x-axis and the number of bins used. First, the x-axis seems very excessive for the dicom image, as can be seen by the zoomed in image. Is there any way to restrict this to an appropriate range? Also, only when i manually write in a large number of bins does the histogram separate in a way that can be useful. Is there a way to do this automatically without a preset number?
CODE USED:
Image = dicomread(dicomImagePath);
figure
imshow(Image,[])

customROI = imfreehand(gca);
mask = customROI.createMask();
figure
imshow(maskedImage,[])

figure
imhist(maskedImage)

Zoomed in manually:

figure
imhist(maskedImage,10000)

Zoomed in manually:

figure
imhist(maskedImage,100000)

Zoomed in manually:

1 Comment
John BG
on 23 Jul 2017
so you want to automate
I = imread('pout.tif');
J = imadjust(I);
imshow(J)
figure, imhist(J,64)
the removal of the left and right voids of the histogram, shown manually in the the Image processing Toolbox
pages 11-38,39
Accepted Answer
More Answers (0)
Categories
Find more on Neuroimaging in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!