function [] = genProjection(path2vid) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Creates the projections used for performing segmentation and training the % stardist CNN % Inputs: % - vidloc: location of the videos with to be processed % Output: (none) % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% hmdir = pwd; if isfolder(path2vid) A = dir('*_registered.h5'); else [path,name,~] = fileparts(path2vid); A = dir(fullfile(path,name+"*_registered.h5")); end for fn = 1:length(A) cd(A(fn).folder) video = h5read(A(fn).name, '/video3'); img1 = mean(video(:, :, 1:floor(end/3)), 3); img2 = mean(video(:, :, end-floor(end/3):end), 3); maximg = max(cat(3, img1, img2), [], 3); saveName = strcat(A(fn).name(1:end-3), '_projection.tif'); imwrite(maximg/max(maximg(:)), saveName); end cd(hmdir)