Sorting fuzzy c means output

조회 수: 1 (최근 30일)
Madalena Silva Ramos Simões
Madalena Silva Ramos Simões 2020년 3월 31일
Hi! I am having trouble sorting out the output of my clustering. I use fuzzy c means (SFCM2D available from Matlab) and each time I compute it, the output is always different. I mean, cluster 1 in a certain image is different from cluster 1 in a different image (different slices of the same medical exam that is). I was wondering how I could sort them so as to always display from the less bright to the brightest. Here is my code so far:
%% Select slice and segment
ncluster = 2;
expo = 2;
max_iter = 50;
%%
List = dir(fullfile(fn, '*.dcm*'));
for f=1:numel(List)
images = dicomread(fullfile(fn, List(f).name));
[MF,Cent] = SFCM2D(images,ncluster);
for i = 1:ncluster
% Reshape, convert to binary and sort the clusters by mean value
imgfi = reshape(MF(i,:,:),size(images, 1),size(images, 2));
imgfi = convert2binary(imgfi);
mean_values = mean(imgfi, 'all');
X = sprintf ("The mean value for cluster %d is %d", i, mean_values);
disp(X)
mean_vector(i) = mean_values;
[val1, idx1] = max(mean_vector);
[val2, idx2] = min(mean_vector);
end
end
I feel like I'm almost there but I'm not able to associate a value of mean to an image output for a cluster. If any of you have any idea how to fix this I would appreciate it :)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Clustering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by