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
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!