Counting Number of Voxels between 2 points without drawing lines

2 ビュー (過去 30 日間)
Hege
Hege 2021 年 4 月 19 日
コメント済み: Hege 2021 年 5 月 4 日
Hi All,
I have curve volumes and I know the coordinates of each and every voxels including the endpoints. I have many curve volumes like this and, I would like to know the straight distance of endpoints(A-B) by VOXELS. I calculated the distance using Pythagoras therom using the X,Y, Z coordinates.But I would like to know the straight distance by voxels WITHOUT drawing a line between those two points. I have lots of volumes like this and I cannot draw lines between those openning points hence it takes high computational power. Appreciate your comments.

採用された回答

Matt J
Matt J 2021 年 4 月 20 日
編集済み: Matt J 2021 年 4 月 20 日
Assuming you have a binarized image and the curve is the only object in that image,
[I,J]=find( bwmorph(yourImage,'endpoints'));
distance=norm([I(1), J(1)] - [I(2),J(2)]),
  15 件のコメント
Matt J
Matt J 2021 年 4 月 30 日
編集済み: Matt J 2021 年 4 月 30 日
The shortest voxelized line which can take diagonal steps is of length,
distance = norm(Pt1-Pt2, inf) - 1
assuming as before that you exclude the end-voxels.
Hege
Hege 2021 年 5 月 4 日
Hi Matt,
Thank you so much and this is a great solution for my work. I applied it many different ways and it works. Thank you again!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by