-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathErics_images.m
52 lines (36 loc) · 1.54 KB
/
Erics_images.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
close all; clear all;
% Set variables
moving_avg_width = 9;
delta_r_end_time = 150;
baseline_index = 1;
image_data_type = 'uint16';
lap_percent = 0.80;
output_video_frame_rate = 10;
overlay_video_circle_radii = 1;
% select file with window
directory_name = selectFolderOfTiffs();
filenames_struct = getFilenameStruct( directory_name, '.tif' );
image_sequence = loadImageSequence( filenames_struct, image_data_type );
num_images = size( image_sequence, 3 );
% get the mean of each frame
mean_frame_trace = calculateMeanFrameSequenceTrace( image_sequence );
brightest_frame = getBrightestFrame( mean_frame_trace, image_sequence );
roi_image = detectROIs( brightest_frame, lap_percent );
% compare with overlay
overlay_image = overlayFullROIs( brightest_frame, roi_image );
%figure('name', 'overlay image' );
%imshow( overlay_image );
% process whole video
cell_roi_centroids = calculateROICentroids( roi_image );
createCentroidOverlayVideo( directory_name, output_video_frame_rate, ...
image_sequence, cell_roi_centroids, overlay_video_circle_radii );
% calculate roi mean pixel value for every frame
sequence_roi_means = calculateROIPixelMeansSequence( image_sequence, ...
cell_roi_centroids );
smoothed_roi_means = movmean( sequence_roi_means, moving_avg_width, 2 );
normalized_roi_means = normalizeTraces( smoothed_roi_means, baseline_index );
delta_r = calculateDeltaBright( normalized_roi_means, delta_r_end_time );
conditon_mean_delta_r = mean( delta_r );
conditon_median_delta_r = median( delta_r );
figure()
plot( 1:num_images, normalized_roi_means' );