15,964,052 members
See more:
Hello, I look for the easiest way for extracting specific cluster of segmented image using fuzzy c means.

For example I divided my gray image two 6 clusters, then I just want to keep 4th cluster of the image, and change other clusters to black color.

Thank you in advance for providing the solution.
Posted

## Solution 1

First of all, you need to decide how to represent "this extraction". As the belonging to the cluster is fuzzy, "degree of belonging" or each point to a cluster is some value between 0 to 1, "extraction" is not a fully defined operation.

For example, you can 1) introduce some threshold dividing "extracted" and "dimmed" subset of points by this fuzzy-set "degree of belonging" value; 2) "dim" each pixel by some factor proportional to this "degree of belonging" value, so the pixel value with degree of 0 was totally black, and those with degree of belonging 1 was totally untouched; 3) formulate some other criterion for representing the pixels with the "degree of belonging" more than 0 but less than 1.

http://en.wikipedia.org/wiki/Fuzzy_clustering#Fuzzy_c-means_clustering[^],
http://home.deib.polimi.it/matteucc/Clustering/tutorial_html/cmeans.html[^].

All required data is available from Matlab `fcm`; please learn the documentation: http://www.mathworks.com/help/fuzzy/fcm.html[^].

—SA

v2
Zeinab Shajirat 7-Oct-14 3:17am
Thank you Sergery, for your help. After of implementing fuzzy c means on my picture i will have for example 4 clusters, which values of 0.0.001, 0.125, 0.2987 and 0.5083 belong to clusters of 1 through 4 respectively. Now, i just want in one time to keep value of 0.125 and make other zero and in another time i just want to keep value of 0.2987 and change other clusters to zero (black). Thank you in advance for considering my question.
Sergey Alexandrovich Kryukov 7-Oct-14 11:10am
Not clear. (And didn't you already accept one answer formally, yours? Really? :-)
—SA
Zeinab Shajirat 7-Oct-14 11:25am
My mother tongue is not english. I did not understand your question, sorry! :)
Sergey Alexandrovich Kryukov 7-Oct-14 11:27am
Mine, too. I just said that I did not understand what is the remaining problem and how your answer post solved it.
—SA
Zeinab Shajirat 7-Oct-14 11:35am
Actually, i should write more code to solve the problem completely. But the code i provided is core for solving my problem.

## Solution 2

"uv" contains unique values, "n" contains occurrences of each unique value.
`[uv,~,indx] = unique (fuzzy_img);`

`n = accumarray(indx(:),1);`

Sergey Alexandrovich Kryukov 7-Oct-14 11:03am
How can this be an answer to your question? And how could you even self-accept it formally?
—SA
Zeinab Shajirat 7-Oct-14 11:17am
I'm sorry if my question was not clear. Actually it is first time that i ask question in this website. I will try to ask clear questions in future.

Actually, i have abdominal MRI images, which i segment them by fuzzy c means into 4 clusters. I want to know that the liver will fall in which cluster. So i need know label or pixel value of each cluster, by comparing occurrences of each value i will understand which one is desired cluster.

The solution that u provided for me, was used in my code previously.
In the continue i needed the code that i found.
Zeinab Shajirat 7-Oct-14 11:19am
I reject my solution. But the solution was what i want.
Thank you
Sergey Alexandrovich Kryukov 7-Oct-14 11:22am
Then I did not understand why. Anyway, if this is the only missing piece, my congratulations!
—SA
Zeinab Shajirat 7-Oct-14 11:27am
Thank you for your time and help.