Seperating two different types of pixels

2 views (last 30 days)
I have a medical dicom image. I want the following things to do:
1. To display the histogram of dicom image in a log scale to see all the pixels in the range.
2. To separate the pixels ( there are two types of pixels - one type corresponds to the fat tissue and the other type corresponds to the glandular tissue. The fat tissue pixels contain low energy x-ray/beams , and the glandular tissue pixels contains high energy beams.
how can I separate these two types of pixels
3. How can I count the pixels of these two types separately.
Can anyone please help me.

Accepted Answer

Image Analyst
Image Analyst on 30 Mar 2014
See my image segmentation tutorial : http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 to see how you can discriminate between the two classed based on intensity and size. You can use other characteristics too, depends on what is different between the two classes (fat and glands).
Here's histogram code:
% Let's compute and display the histogram.
[pixelCount, grayLevels] = imhist(grayImage);
bar(grayLevels, pixelCount);
grid on;
title('Histogram of original image', 'FontSize', 24);
xlim([0 grayLevels(end)]); % Scale x axis manually.
You can take the log of the counts before displaying, or else you can use logy() to display the original histogram on a log scale.
  8 Comments
Image Analyst
Image Analyst on 14 Apr 2014
There is no training set. You make a first guess at thresholding. Then you make a second pass with a scanning window. You divide the pixels in the window into three classes: (1) nebulous region where you don't know if it's fat for gland, (2) clearly fat based on how far their gray levels are away from the threshold, and (3) clearly gland. Then in that window, if the central pixels is (1), then you see if there are more (2) or more (3). Whichever class owns more pixels in the window, you assign the uncertain central pixel to that class. Does that make sense? "k" is just a sliding value that where you can adjust the relative proportions in each class before assigning the pixel. Like it must have 6 of the pixels be gland, or 2 or whatever. If you go with simple majority and a 3x3 window, and all 8 neighbors are either class 1 or 2, then k = 5. Make it simple and just go with the majority. If there is no majority, then enlarge your window temporarily until you do get a majority.

Sign in to comment.

More Answers (1)

Ruhul Amin
Ruhul Amin on 15 Apr 2014
Edited: Ruhul Amin on 15 Apr 2014
Dear Image Analyst
Thanks a lot for your kind help . If I use a 3X3 window as a median filter to scan the image, then how can I separate the three pixel classes and how to calculate the pixel no.for different classes.
I have attached the binary image .
Could you please give me some demo codes so that I can proceed with the right steps?

Community Treasure Hunt

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

Start Hunting!