Hello Mat

 找回密码
 立即注册
查看: 6232|回复: 1

医学图像分割(gabor+巴特沃斯滤波器+形态学)

[复制链接]

1323

主题

1551

帖子

0

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22647
发表于 2018-7-29 23:09:33 | 显示全部楼层 |阅读模式
29-前列腺图像分割(采用图像滤波器(MATLAB视频开源免费观看)
百度网盘链接:https://pan.baidu.com/s/1nxayULYGE61AyFhgnEPmkA
具体链接在halcom.cn论坛,联系人QQ:3283892722
该论坛是一个学习交流平台,我会逐一的和大家分享学习。
欢迎大家录制视频,你可在论坛进行打赏分享。
  1. clc,clear,close all
  2. warning off
  3. x = dicomread('4.dcm');
  4. im = mat2gray(x);
  5. figure(1),imshow(im,[])
  6. title('原图像');
  7. im1 = imadjust(im);
  8. imshow(im1,[])
  9. %% gabor滤波
  10. im1 = im2uint8(im1);
  11. Sx = 0.5;  % x方向的差异系数
  12. Sy = 0.5;  % y方向的差异系数
  13. U = 1.0;   % x方向的中心频率
  14. V = 1.0;   % y方向的中心频率
  15. [G,gabout] = gabor_filter(im1,Sx,Sy,U,V);
  16. figure(2),imshow(gabout,[]);
  17. title('Gabor滤波图像');
  18. %% 提取关键分析区域
  19. ra = 120;
  20. rb = 130;
  21. im2 = gabout(ra:320, rb:400);  % crop part
  22. imshow(im2,[])
  23. %% 巴特沃斯高、低通滤波
  24. im3 = freqfilter_btw_lp(im2,4,1);
  25. figure(3),imshow(im3,[]);
  26. title('巴特沃斯低通滤波图像');
  27. im4 = freqfilter_btw_Hp(im2,4,2);
  28. figure(4),imshow(im4,[]);
  29. title('巴特沃斯高通滤波图像');
  30. %% 分割1
  31. bw = im4>10;
  32. se = strel('disk', 3);
  33. bw1 = imdilate(bw, se); % 膨胀操作
  34. % bw2 = imerode(bw1, se); % 腐蚀
  35. % imshow(bw1)
  36. bw2 = bwareaopen(bw1, 500);  % 剔除小块
  37. cc = bwconncomp(bw2);   % 连通域操作
  38. s = regionprops(bw2, {'centroid', 'area'});
  39. [~, id] = max([s.Area]);
  40. bw2(labelmatrix(cc)~=id) = 0;
  41. imshow(bw2);
  42. for i=1:6
  43.     bw2 = imdilate(bw2, se); % 膨胀操作
  44. end
  45. bw3 = imfill(bw2,'holes');
  46. for i=1:7
  47.     bw2 = imerode(bw2, se); % 腐蚀操作
  48.     bw3 = imerode(bw3, se); % 腐蚀操作
  49. end
  50. bw4 = logical( bw3-bw2 );
  51. imshow(bw4);
  52. for i=13
  53.     bw4 = imdilate(bw4, se); % 膨胀操作
  54. end
  55. im5 = immultiply( im2, bw4 );
  56. imshow(im5,[])
  57. %% 分割2
  58. im31 = freqfilter_btw_Hp(im3,16,1);
  59. bw31 = im31>0;
  60. bw32 = immultiply( bw31, bw4 );
  61. bw33 = imclose(bw32, se);
  62. bw34 = imfill(bw33,'holes');
  63. % blob分析
  64. bw35 = bwareaopen(bw34, 500);  % 剔除小块
  65. cc = bwconncomp(bw35);   % 连通域操作
  66. s = regionprops(bw35, {'centroid', 'area', 'Perimeter'});
  67. % 计算圆度
  68. metric = 4*pi*[s.Area]./[s.Perimeter].^2;
  69. [~, id] = max([metric]);
  70. bw35(labelmatrix(cc)~=id) = 0;
  71. bw36 = imclose(bw35, se);
  72. for i=13
  73.     bw36 = imdilate(bw36, se); % 膨胀操作
  74. end
  75. im6 = immultiply( im2, bw36 );
  76. imshow(im6,[])
  77. %% 分割完后,将结果映射到实物图上
  78. region1 = zeros(size(im));
  79. region1(ra:320, rb:400) = bw4;
  80. edge1 = edge(region1);
  81. [x, y] = find(edge1==1);
  82. im7(:,:,1)=im;
  83. im7(:,:,2)=im;
  84. im7(:,:,3)=im;
  85. for i=1:length(x)
  86.     im7(x(i), y(i), 1) = 255;
  87.     im7(x(i), y(i), 2) = 0;
  88.     im7(x(i), y(i), 3) = 0;
  89. end
  90. figure(7),imshow(im7)

  91. region2 = zeros(size(im));
  92. region2(ra:320, rb:400) = bw36;
  93. edge1 = edge(region2);
  94. [x, y] = find(edge1==1);
  95. im7(:,:,1)=im;
  96. im7(:,:,2)=im;
  97. im7(:,:,3)=im;
  98. for i=1:length(x)
  99.     im7(x(i), y(i), 1) = 255;
  100.     im7(x(i), y(i), 2) = 255;
  101.     im7(x(i), y(i), 3) = 0;
  102. end
  103. figure(8),imshow(im7)

  104. region3 = zeros(size(im));
  105. region3(ra:320, rb:400) = bw36;
  106. edge1 = edge(region3);
  107. region3 = zeros(size(im));
  108. region3(ra:320, rb:400) = bw4;
  109. edge2 = edge(region3);
  110. edge3 = logical( edge1+edge2 );
  111. [x, y] = find(edge3==1);
  112. im7(:,:,1)=im;
  113. im7(:,:,2)=im;
  114. im7(:,:,3)=im;
  115. for i=1:length(x)
  116.     im7(x(i), y(i), 1) = 255;
  117.     im7(x(i), y(i), 2) = 0;
  118.     im7(x(i), y(i), 3) = 255;
  119. end
  120. figure(9),imshow(im7)
复制代码




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-11-22 23:06 , Processed in 0.231007 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表