【发布时间】:2016-03-02 23:24:52
【问题描述】:
在图像上应用skeletonization后(),
我想使用 python 测量骨架的最长分支或脊柱。 ImageJ 有几个工具可以完成这项工作,一个是 Measure_Skeleton_length,另一个是 AnalyzeSkeleton。 python中的任何工具或建议?
【问题讨论】:
标签: python image-processing scipy scikit-image
在图像上应用skeletonization后(),
我想使用 python 测量骨架的最长分支或脊柱。 ImageJ 有几个工具可以完成这项工作,一个是 Measure_Skeleton_length,另一个是 AnalyzeSkeleton。 python中的任何工具或建议?
【问题讨论】:
标签: python image-processing scipy scikit-image
我不知道 python 工具,但从算法的角度来看,这是一种方法:
那么你在地图计算过程中找到的最大距离就是你想要的距离。第 1 点是基本编码,所以你可以在 Python 中完成,但你必须为第 2 点找到一个库。
【讨论】:
skimage.graph 计算它们之间的最短连接路径。最大结果可能接近最长的分支长度。
这是对原始问题的一个很晚的回复,但以防万一仍然有需要的人最终可能会阅读这篇文章。有一个很棒的用于分析骨架的 python 包,名为FilFinder (pip install fil_finder),它优雅地解决了这个问题。以下是他们的tutorial采用的代码
import numpy as np
import cv2
import matplotlib.pyplot as plt
from fil_finder import FilFinder2D
import astropy.units as u
skeleton = ... #in numpy array format
fil = FilFinder2D(skeleton, distance=250 * u.pc, mask=skeleton)
fil.preprocess_image(flatten_percent=85)
fil.create_mask(border_masking=True, verbose=False,
use_existing_mask=True)
fil.medskel(verbose=False)
fil.analyze_skeletons(branch_thresh=40* u.pix, skel_thresh=10 * u.pix, prune_criteria='length')
plt.imshow(fil.skeleton, cmap='gray')
plt.contour(fil.skeleton_longpath, colors='r')
plt.axis('off')
plt.show()
哪个输出
【讨论】: