-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterpolateStack.m
More file actions
49 lines (29 loc) · 1.25 KB
/
Copy pathInterpolateStack.m
File metadata and controls
49 lines (29 loc) · 1.25 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
addpath ('\\phhydra\data-new\phhydra\data\analysis\users\Yonit\Layer Separation - Matlab\matlabCode');
image_dir='\\phhydra\data-new\phhydra\Analysis\users\Yonit\Layer Separation - Matlab\Examples\2018_10_22_pos4\Original_Files';
out_dir='\\phhydra\data-new\\phhydra\Analysis\users\Yonit\Layer Separation - Matlab\Examples\2018_10_22_pos4\US_Original_Files';
exp_name = '2018_10_22_pos4';
mkdir(out_dir);
cd (image_dir);
tpoints = dir('*.tiff*');
for j = 1:length(tpoints)
% Read raw data for each time point
fileName = [image_dir,'\',tpoints(j).name];
image3D = read3Dstack (fileName,image_dir);
V = double(image3D);
[X1,Y1,Z1] = size(V);
[X,Y,Z] = meshgrid((1:X1),(1:Y1),(1:Z1));
x_res = 1;
y_res = 1;
z_res = 2;
[Xq,Yq,Zq] = meshgrid(1:(X1*x_res),1:(Y1*y_res),1:(1/z_res):Z1);
Vq = interp3(X,Y,Z,V,Xq,Yq,Zq);
Vq_uint16= uint16(Vq);
first_frame = Vq_uint16(:,:,1);
t_point_name = strcat(exp_name,'_T_',num2str(j,'%03.f'),'.tiff');
cd(out_dir);
imwrite(first_frame,t_point_name,'tiff');
for i = 2:((Z1-1)*z_res+1)
next_frame = Vq_uint16(:,:,i);
imwrite(next_frame,t_point_name,'WriteMode','append');
end
end