当前位置:   article > 正文

使用各向异性滤波器和图像处理方法进行脑肿瘤检测(MATLAB)

使用各向异性滤波器和图像处理方法进行脑肿瘤检测(MATLAB)

医学图像分割一直以来都是计算机辅助诊断领域的研究热点。在医学图像的处理和分析中,对图像中感兴趣区域的准确分割尤其关键。要对感兴趣区域进行分类识别,首先要从图像中把感兴趣区域精确分割出来,然后有针对性地对感兴趣区域提取特征并分类。目前关于脑部MRI的分割主要的研究都集中在脑部的灰质,白质和脑脊液等组织的分割。

图像分割方法根据分割类型的不同,大致可以分为基于区域的分割方法和基于边界的分割方法。基于区域的分割方法一般是根据图像中点与点之间的灰度值、纹理特征等属性来判断它们的相似度,根据相似度来划分图像区域。基于边界的分割方法是以灰度变化的梯度大小来确定感兴趣区域的边界。在实际应用中,常常将这两种方法结合在一起使用。

鉴于此,采用各向异性滤波器和图像处理方法进行脑肿瘤分割检测,运行环境为MATLAB 2018,主运行代码如下:

  1. %%filter
  2. num_iter = 10;
  3. delta_t = 1/7;
  4. kappa = 15;
  5. option = 2;
  6. disp('Preprocessing image please wait . . .');
  7. inp = anisodiff(s,num_iter,delta_t,kappa,option);
  8. inp = uint8(inp);
  9. inp=imresize(inp,[256,256]);
  10. if size(inp,3)>1
  11. inp=rgb2gray(inp);
  12. end
  13. figure;
  14. imshow(inp);
  15. title('Filtered image','FontSize',20);
  16. %%thresholding
  17. sout=imresize(inp,[256,256]);
  18. t0=60;
  19. th=t0+((max(inp(:))+min(inp(:)))./2);
  20. for i=1:1:size(inp,1)
  21. for j=1:1:size(inp,2)
  22. if inp(i,j)>th
  23. sout(i,j)=1;
  24. else
  25. sout(i,j)=0;
  26. end
  27. end
  28. end
  29. %morphologial operation
  30. label=bwlabel(sout);
  31. stats=regionprops(logical(sout),'Solidity','Area','BoundingBox');
  32. density=[stats.Solidity];
  33. area=[stats.Area];
  34. high_dense_area=density>0.6;
  35. max_area=max(area(high_dense_area));
  36. tumor_label=find(area==max_area);
  37. tumor=ismember(label,tumor_label);
  38. if max_area>100
  39. figure;
  40. imshow(tumor)
  41. title('tumor alone','FontSize',20);
  42. else
  43. h = msgbox('No Tumor!!','status');
  44. %disp('no tumor');
  45. return;
  46. end
  47. %%binding box
  48. box = stats(tumor_label);
  49. wantedBox = box.BoundingBox;
  50. figure
  51. imshow(inp);
  52. title('Bounding Box','FontSize',20);
  53. hold on;
  54. rectangle('Position',wantedBox,'EdgeColor','y');
  55. hold off;
  56. %%getting tumor outline
  57. dilationAmount = 5;
  58. rad = floor(dilationAmount);
  59. [r,c] = size(tumor);
  60. filledImage = imfill(tumor, 'holes');
  61. for i=1:r
  62. for j=1:c
  63. x1=i-rad;
  64. x2=i+rad;
  65. y1=j-rad;
  66. y2=j+rad;
  67. if x1<1
  68. x1=1;
  69. end
  70. if x2>r
  71. x2=r;
  72. end
  73. if y1<1
  74. y1=1;
  75. end
  76. if y2>c
  77. y2=c;
  78. end
  79. erodedImage(i,j) = min(min(filledImage(x1:x2,y1:y2)));
  80. end
  81. end
  82. figure
  83. imshow(erodedImage);
  84. title('eroded image','FontSize',20);
  85. %%subtracting eroded image from bw image
  86. tumorOutline=tumor;
  87. tumorOutline(erodedImage)=0;
  88. figure;
  89. imshow(tumorOutline);
  90. title('Tumor Outline','FontSize',20);
  91. %%inserting outline
  92. rgb = inp(:,:,[1 1 1]);
  93. red = rgb(:,:,1);
  94. red(tumorOutline)=255;
  95. green = rgb(:,:,2);
  96. green(tumorOutline)=0;
  97. blue = rgb(:,:,3);
  98. blue(tumorOutline)=0;
  99. tumorOutlineInserted(:,:,1) = red;
  100. tumorOutlineInserted(:,:,2) = green;
  101. tumorOutlineInserted(:,:,3) = blue;
  102. figure
  103. imshow(tumorOutlineInserted);
  104. title('Detected Tumer','FontSize',20);
  105. %%to display
  106. figure
  107. subplot(231);imshow(s);
  108. title('Input image','FontSize',15);
  109. subplot(232);imshow(inp);
  110. title('Filtered image','FontSize',15);
  111. subplot(233);imshow(inp);
  112. title('Bounding Box','FontSize',15);
  113. hold on;
  114. rectangle('Position',wantedBox,'EdgeColor','y');
  115. hold off;
  116. subplot(234);
  117. imshow(tumor);
  118. title('tumor alone','FontSize',15);
  119. subplot(235);imshow(tumorOutline);
  120. title('Tumor Outline','FontSize',15);
  121. subplot(236);imshow(tumorOutlineInserted);
  122. title('Detected Tumor','FontSize',15);
  123. 知乎学术咨询:
  124. https://www.zhihu.com/consult/people/792359672131756032?isMe=1
  125. 工学博士,担任《Mechanical System and Signal Processing》《中国电机工程学报》《控制与决策》等期刊审稿专家,擅长领域:现代信号处理,机器学习,深度学习,数字孪生,时间序列分析,设备缺陷检测、设备异常检测、设备智能故障诊断与健康管理PHM等。

图片

图片

图片

图片

图片

图片

  • 工学博士,担任《Mechanical System and Signal Processing》《中国电机工程学报》《控制与决策》等期刊审稿专家,擅长领域:现代信号处理,机器学习,深度学习,数字孪生,时间序列分析,设备缺陷检测、设备异常检测、设备智能故障诊断与健康管理PHM等。
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/人工智能uu/article/detail/795309
推荐阅读
相关标签
  

闽ICP备14008679号