フィルターのクリア

How to find length or perimeter of a irregular boundary

7 ビュー (過去 30 日間)
Gopichandh Danala
Gopichandh Danala 2016 年 9 月 1 日
コメント済み: Akshay Rao 2017 年 6 月 30 日
Hi,
I work with medical images for some application I have to segment tumors out of CT slices then compute the length of the boundary.
I did the segmentation part and computed the boundaries of slices now how can I compute the perimeter of that boundary. I added a tumor boundary slice for reference. More Info:
These Dicom images even come with pixel spacing which is the distance between each pixel lets say pixelSpacing is 0.7mm Now I have to compute the perimeter length respect to pixel spacing
Please give me some ideas about this
Thanks Gopi

採用された回答

KSSV
KSSV 2016 年 9 月 2 日
If you have boundary in hand....calculate the distances of successive points and sum up...wont his give perimeter?
  2 件のコメント
Gopichandh Danala
Gopichandh Danala 2016 年 9 月 2 日
Yes, u r correct Thanks.I was initially worried about diagonal and adjacent pixels in the boundary but I figured it out. posting the code for reference if anyone needs it
The code for this is:
boundary_dist = 0;
BW = thisBinaryImage;
B = bwboundaries(BW);
imshow(BW, [min(min(BW)) max(max(BW))]); hold on;
for k=1:length(B)
boundary = B{k};
cidx = mod(k,length(colors))+1;
plot(boundary(:,2), boundary(:,1),...
colors(cidx),'LineWidth',2);
end
hold off;
for i = 1:length(boundary)
if i ~= length(boundary)
pixel1 = boundary(i,:);
pixel2 = boundary(i+1,:);
else
pixel1 = boundary(i,:);
pixel2 = boundary(1,:); % when it reaches the last boundary pixel
end
pixel_dist = ((pixel1(1,1) - pixel2(1,1)).^2 + (pixel1(1,2) - pixel2(1,2)).^2).^0.5;
boundary_dist = boundary_dist + pixel_dist;
end
display(boundary_dist)
Output:
boundary_dist =
97.3969696196699
Comment on it if any suggestions.. Thanks, Gopi
Akshay  Rao
Akshay Rao 2017 年 6 月 30 日
Thanks for the help! I found this useful

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by