Hi LaraS,
To binarize each frame in your multidimensional image array, you can use a loop to iterate over each frame and apply the binary mask.
Here is an example of how you can modify your code:
% binarize frames to create mask
% crop image to get rid of autofluorescent blob (assuming A is your image array)
crop_A = A(50:1200, 50:1000, :); % crop all frames
% create binary version of cropped image for each frame
bw_A = false(size(crop_A)); % preallocate binary image array
for frame = 1:size(crop_A, 3)
bw_A(:,:,frame) = imbinarize(crop_A(:,:,frame), 'adaptive', 'ForegroundPolarity', 'bright', 'Sensitivity', 0.4);
bw_A(:,:,frame) = bwareaopen(bw_A(:,:,frame), 50, 4);
end
This code will create a binary image array "bw_A" with the same dimensions as your cropped image array "crop_A". Each frame in "bw_A" will be a binary version of the corresponding frame in "crop_A". You can then use this binary image array for further analysis.
For more information about MATLAB's multidimensional array indexing and manipulation capabilities, refer to this documentation:
I hope this helps!