使用Matlab的模糊C均值算法进行肿瘤分割

4
我有一个分段的肝脏。我需要分割其中的肿瘤。我使用了FCM方法。这是一个3级的FCM阈值分割。当我将其应用于图像时,我需要肿瘤区域(比其他部分更暗的区域)单独进行分割。但是我得到了相反的结果。周围所有的区域都被分割了。请帮忙解决。程序包括两个文件,testfcmthresh.m和一个函数fcmthresh.m 输入为“分段肝脏(使用区域生长)”和FCM输出图像: input segemented liver output FCM image 从这里开始 我尝试使用imcomplement()补充图像。但是我得到的整个背景也变成了白色,因为背景原本很暗。请帮忙解决。

after imclearborder after fcm

function [bw,level]=fcmthresh(IM,sw)
%FCMTHRESH Thresholding by 3-class fuzzy c-means clustering
%  [bw,level]=fcmthresh(IM,sw) outputs the binary image bw and threshold level of
%  image IM using a 3-class fuzzy c-means clustering. It often works better
%  than Otsu's methold which outputs larger or smaller threshold on
%  fluorescence images.
%  sw is 0 or 1, a switch of cut-off position.
%  sw=0, cut between the small and middle class
%  sw=1, cut between the middle and large class
%
%  Contributed by Guanglei Xiong (xgl99@mails.tsinghua.edu.cn)
%  at Tsinghua University, Beijing, China.

% check the parameters
if (nargin<1)
    error('You must provide an image.');
elseif (nargin==1)
    sw=0;
elseif (sw~=0 && sw~=1)
    error('sw must be 0 or 1.');
end

data=reshape(IM,[],1);
[center,member]=fcm(data,3);
[center,cidx]=sort(center);
member=member';
member=member(:,cidx);
[maxmember,label]=max(member,[],2);
if sw==0
    level=(max(data(label==1))+min(data(label==2)))/2;
else
    level=(max(data(label==2))+min(data(label==3)))/2;
end
bw=im2bw(IM,level);

%testfcmthresh.m

clear;clc;
im=imread('mliver3.jpg');
fim=mat2gray(im);
level=graythresh(fim);
bwfim=im2bw(fim,0.1);
[bwfim0,level0]=fcmthresh(fim,0);
[bwfim1,level1]=fcmthresh(fim,1);
subplot(2,2,1);
imshow(fim);title('Original');
subplot(2,2,2);
imshow(bwfim);title(sprintf('Otsu,level=%f',level));
subplot(2,2,3);
imshow(bwfim0);title(sprintf('FCM0,level=%f',level0));
subplot(2,2,4);
imshow(bwfim1);title(sprintf('FCM1,level=%f',level1));
% imwrite(bwfim1,'fliver6.jpg');

1
我们可以有肿瘤和肝脏的图片吗? - Blender
我是一个新用户,所以我不能在这里发布图片。如果您给我您的ID,我会将其发送到那里。提前致谢。附言:我的项目正在使用Matlab。 - Gomathi
将它们上传到某个地方,并将链接放在问题中。我会编辑图片。 - Blender
我已经编辑了我的问题(添加了图片的链接)。将会有两张图片。输入的“分割肝脏图像”和最终的“fcm输出”图像。请检查一下。 - Gomathi
翻转/反转图像怎么样? - tim
1个回答

1

我的问题的答案已经在我之前的问题'提取边界内的图像区域'中由Ghaul告知。如果有人需要参考,请查看那里Ghaul的评论。谢谢。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接