Image segmentation for each slice in a volume stack

11 Ansichten (letzte 30 Tage)
Jackie
Jackie am 28 Nov. 2022
Kommentiert: Jackie am 28 Nov. 2022
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

Akzeptierte Antwort

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

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by