Image segmentation for each slice in a volume stack
12 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!