Image segmentation for each slice in a volume stack

17 次查看(过去 30 天)
I am trying to segment the largest boundaries in a cropped image for each slice in a volume. I am using imbinarize, applying a threshold, and then smoothing out the boundaries before using regionprops to calculate the areas of the blobs. I am having trouble getting to the point where I can have a list of areas for each slice in my volume. I believe only the last slice is getting outputted. Here is my code as of now
vol = tiffreadVolume('filename.tiff');
stack = vol(:, :, [224:2:276]);
stack = mat2gray(stack);
[a, rectout] = imcrop(stack(:,:,1))
for i = size(stack,3)
img_crop = imcrop(stack(:, :, i), [rectout]);
imshow(img_crop)
binary_img = imbinarize(img_crop, 0.1);
fill = imfill(binary_img, 'holes')
area_filt = bwareafilt(fill, 5);
imshow(area_filt)
boundaries_trace = bwboundaries(area_filt);
all_areas = regionprops(area_filt, 'Area')
areas = [all_areas.Area];
end

采纳的回答

Matt J
Matt J 2022-11-28
编辑:Matt J 2022-11-28
clear areas
for i = size(stack,3):-1:1
...
all_areas = regionprops(area_filt, 'Area');
areas{i} = [all_areas.Area];
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by