-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEPFL_data_load.m
More file actions
62 lines (44 loc) · 1.44 KB
/
EPFL_data_load.m
File metadata and controls
62 lines (44 loc) · 1.44 KB
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
51
% clear all;close all
N_crop = 39;
%% load data images
Cpath = [pwd,'/EPFL DH data/'];
fname = 'sequence-as-stack-Beads-DH-Exp.tif';
info = imfinfo([Cpath,fname]);
imageStack = [];
numberOfImages = length(info);
for k = 1:numberOfImages
currentImage = imread([Cpath,fname], k, 'Info', info);
imageStack(:,:,k) = currentImage;
% imagesc(imageStack(:,:,k));
% drawnow
end
%% load xls data
num = readtable([Cpath,'activations.csv']);
num = num{:,:};
XY_data = num(:,3:4)/1000;
Z_data = num(:,5)/1000;
%% create grid
psize = 0.1;
line_x = (0:size(imageStack,1))*psize;
[X,Y] = meshgrid(line_x);
%% cut stack
xy=[];
for i = 1:6
for j = 1:numberOfImages
x_pos_nm = XY_data((i-1)*151+j,1);
y_pos_nm = XY_data((i-1)*151+j,2);
x_pos_px = round(x_pos_nm./psize);
y_pos_px = round(y_pos_nm./psize);
%residuals
xy(j,1,i) = x_pos_nm-round(x_pos_nm./psize)*psize;
xy(j,2,i) = y_pos_nm-round(y_pos_nm./psize)*psize;
z(j,i) = Z_data((i-1)*151+j);
tmp = imageStack(y_pos_px-floor(N_crop/2):y_pos_px+floor(N_crop/2),x_pos_px-floor(N_crop/2):x_pos_px+floor(N_crop/2),j);
% rescale to match camera size
% DH_PSF(:,:,j,i) = imresize(tmp,10/16,'bilinear');
tmp = tmp-min(tmp(:));
DH_PSF(:,:,j,i) = tmp.*(tmp>0.03*max(tmp(:)));
% imagesc( DH_PSF(:,:,j,i));
% drawnow;
end
end