二维测量--血管

对应示例程序:
angio.hdev

目标:提取图像中的血管曲线,并测量直径
思路为:
      1.读取图像
      2.通过设置合理的calculate_lines_gauss_parameters参数,利用算子lines_gauss 提取出图像中血管中心曲线
      3. 对提取出的曲线进行排序,并利用算子get_contour_xld计算出每条小曲线中点的坐标
      4.利用算子get_contour_attrib_xld获取Width_left,Width_right以及Contrast的值
      5.直径的计算公式为:Diameter := (WidthL + WidthR) * sqrt(0.75) ,去均值为最后的结果
      6.在窗口上进行相关显示

图像:
在这里插入图片描述

代码:

dev_update_off ()
read_image (Angio, 'angio-part')
get_image_size (Angio, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width, Height, 'black', WindowID)
set_display_font (WindowID, 14, 'mono', 'true', 'false')
dev_display (Angio)
disp_message (WindowID, 'Original image', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID, 'black', 'true')
stop ()
calculate_lines_gauss_parameters (8, [12,0], Sigma, Low, High)
lines_gauss (Angio, Lines, Sigma, Low, High, 'dark', 'true', 'parabolic', 'true')  //提取血管中心线条
select_contours_xld (Lines, RelLines, 'length', 5.0, 999, 0, 0) //XLD选择
dev_set_colored (12)
dev_display (Angio)
dev_display (RelLines)
disp_message (WindowID, 'Extracted lines', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID, 'black', 'true')
stop ()
count_obj (RelLines, Number)
sort_contours_xld (RelLines, RelLines, 'lower_left', 'true', 'row')  //XLD 排序
gen_empty_obj (PrintedLines)
for I := 1 to Number by 1
    dev_display (Angio)
    dev_set_color ('white')
    dev_display (PrintedLines)
    select_obj (RelLines, Line, I)
    dev_set_color ('green')
    dev_display (Line)
    concat_obj (PrintedLines, Line, PrintedLines)
    get_contour_xld (Line, Row, Col)  //得到线条的点坐标
    meanRow := sum(Row) / |Row|  //求均值Row
    meanCol := sum(Col) / |Col|  //求均值Column
    
    get_contour_attrib_xld (Line, 'width_left', WidthL) //返回Attrib中XLD轮廓Contour的属性Name的值
    get_contour_attrib_xld (Line, 'width_right', WidthR)
    get_contour_attrib_xld (Line, 'contrast', Contrast)
    meanContrast := sum(Contrast) / |Contrast|
    * To display the lines widths, the point at which the gray value drops
    * to 25% of the contrast between the line and the background will be
    * displayed.  This point is given by sqrt(3/4) for the parabolic line
    * model.    
    //进行显示
    
    Diameter := (WidthL + WidthR) * sqrt(0.75)  //直径
    Diam := sum(Diameter) / |Diameter|
    if (meanRow > Height - 50)
        disp_message (WindowID, 'diam: ' + Diam, 'image', Height - 70, meanCol, 'yellow', 'false')
    else
        disp_message (WindowID, 'diam: ' + Diam, 'image', meanRow, meanCol, 'yellow', 'false')
    endif
    disp_message (WindowID, 'Diameters of line segments', 'window', 135, 60, 'black', 'true')
    if (I < 5)
        disp_continue_message (WindowID, 'black', 'true')
        stop ()
    else
       wait_seconds (0.2)
    endif
    
endfor
dev_update_on ()


用到的几个算子:
      calculate_lines_gauss_parameters–从要提取的线条的最大宽度和对比度计算线条高斯的参数sigma、low和high
      lines_gauss --提取血管中心线条
      sort_contours_xld-- XLD轮廓排序
      get_contour_xld–得到线条的点坐标
      get_contour_attrib_xld //返回Attrib中XLD轮廓Contour的属性Name的值

参考资料:
[1]:https://www.cnblogs.com/xiaomaLV2/archive/2011/12/28/2304821.html

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值