|
29-前列腺图像分割(采用图像滤波器(MATLAB视频开源免费观看)
百度网盘链接:https://pan.baidu.com/s/1nxayULYGE61AyFhgnEPmkA
具体链接在halcom.cn论坛,联系人QQ:3283892722
该论坛是一个学习交流平台,我会逐一的和大家分享学习。
欢迎大家录制视频,你可在论坛进行打赏分享。
- clc,clear,close all
- warning off
- x = dicomread('4.dcm');
- im = mat2gray(x);
- figure(1),imshow(im,[])
- title('原图像');
- im1 = imadjust(im);
- imshow(im1,[])
- %% gabor滤波
- im1 = im2uint8(im1);
- Sx = 0.5; % x方向的差异系数
- Sy = 0.5; % y方向的差异系数
- U = 1.0; % x方向的中心频率
- V = 1.0; % y方向的中心频率
- [G,gabout] = gabor_filter(im1,Sx,Sy,U,V);
- figure(2),imshow(gabout,[]);
- title('Gabor滤波图像');
- %% 提取关键分析区域
- ra = 120;
- rb = 130;
- im2 = gabout(ra:320, rb:400); % crop part
- imshow(im2,[])
- %% 巴特沃斯高、低通滤波
- im3 = freqfilter_btw_lp(im2,4,1);
- figure(3),imshow(im3,[]);
- title('巴特沃斯低通滤波图像');
- im4 = freqfilter_btw_Hp(im2,4,2);
- figure(4),imshow(im4,[]);
- title('巴特沃斯高通滤波图像');
- %% 分割1
- bw = im4>10;
- se = strel('disk', 3);
- bw1 = imdilate(bw, se); % 膨胀操作
- % bw2 = imerode(bw1, se); % 腐蚀
- % imshow(bw1)
- bw2 = bwareaopen(bw1, 500); % 剔除小块
- cc = bwconncomp(bw2); % 连通域操作
- s = regionprops(bw2, {'centroid', 'area'});
- [~, id] = max([s.Area]);
- bw2(labelmatrix(cc)~=id) = 0;
- imshow(bw2);
- for i=1:6
- bw2 = imdilate(bw2, se); % 膨胀操作
- end
- bw3 = imfill(bw2,'holes');
- for i=1:7
- bw2 = imerode(bw2, se); % 腐蚀操作
- bw3 = imerode(bw3, se); % 腐蚀操作
- end
- bw4 = logical( bw3-bw2 );
- imshow(bw4);
- for i=13
- bw4 = imdilate(bw4, se); % 膨胀操作
- end
- im5 = immultiply( im2, bw4 );
- imshow(im5,[])
- %% 分割2
- im31 = freqfilter_btw_Hp(im3,16,1);
- bw31 = im31>0;
- bw32 = immultiply( bw31, bw4 );
- bw33 = imclose(bw32, se);
- bw34 = imfill(bw33,'holes');
- % blob分析
- bw35 = bwareaopen(bw34, 500); % 剔除小块
- cc = bwconncomp(bw35); % 连通域操作
- s = regionprops(bw35, {'centroid', 'area', 'Perimeter'});
- % 计算圆度
- metric = 4*pi*[s.Area]./[s.Perimeter].^2;
- [~, id] = max([metric]);
- bw35(labelmatrix(cc)~=id) = 0;
- bw36 = imclose(bw35, se);
- for i=13
- bw36 = imdilate(bw36, se); % 膨胀操作
- end
- im6 = immultiply( im2, bw36 );
- imshow(im6,[])
- %% 分割完后,将结果映射到实物图上
- region1 = zeros(size(im));
- region1(ra:320, rb:400) = bw4;
- edge1 = edge(region1);
- [x, y] = find(edge1==1);
- im7(:,:,1)=im;
- im7(:,:,2)=im;
- im7(:,:,3)=im;
- for i=1:length(x)
- im7(x(i), y(i), 1) = 255;
- im7(x(i), y(i), 2) = 0;
- im7(x(i), y(i), 3) = 0;
- end
- figure(7),imshow(im7)
- region2 = zeros(size(im));
- region2(ra:320, rb:400) = bw36;
- edge1 = edge(region2);
- [x, y] = find(edge1==1);
- im7(:,:,1)=im;
- im7(:,:,2)=im;
- im7(:,:,3)=im;
- for i=1:length(x)
- im7(x(i), y(i), 1) = 255;
- im7(x(i), y(i), 2) = 255;
- im7(x(i), y(i), 3) = 0;
- end
- figure(8),imshow(im7)
- region3 = zeros(size(im));
- region3(ra:320, rb:400) = bw36;
- edge1 = edge(region3);
- region3 = zeros(size(im));
- region3(ra:320, rb:400) = bw4;
- edge2 = edge(region3);
- edge3 = logical( edge1+edge2 );
- [x, y] = find(edge3==1);
- im7(:,:,1)=im;
- im7(:,:,2)=im;
- im7(:,:,3)=im;
- for i=1:length(x)
- im7(x(i), y(i), 1) = 255;
- im7(x(i), y(i), 2) = 0;
- im7(x(i), y(i), 3) = 255;
- end
- figure(9),imshow(im7)
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|