How to find length or perimeter of a irregular boundary

4 Ansichten (letzte 30 Tage)
Gopichandh Danala
Gopichandh Danala am 1 Sep. 2016
Kommentiert: Akshay Rao am 30 Jun. 2017
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

Akzeptierte Antwort

KSSV
KSSV am 2 Sep. 2016
If you have boundary in hand....calculate the distances of successive points and sum up...wont his give perimeter?
  2 Kommentare
Gopichandh Danala
Gopichandh Danala am 2 Sep. 2016
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 am 30 Jun. 2017
Thanks for the help! I found this useful

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu DICOM Format finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by