-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDeepPIV_3D_Reconstruction_150630.m
64 lines (55 loc) · 1.62 KB
/
DeepPIV_3D_Reconstruction_150630.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
clc;clear;close all
%%%%%%%%%%%%%%%%%%%%%%%%%%
%USER INPUT REQUIRED BELOW
dataset='150601_batho';
vel=10; %mm/s %UNKNOWN
inc=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%e
dir='/Users/kakani/Desktop/150601_RachelCarson_DeepPIV/data_analysis/';
imdir=[dir,'3DR/baby_bathos/'];
tif='.tif';
%retrieving data set-specific parameters
[start,finish,fps,fstop,shutter,calib]=videoinfo(dataset,vel);
%retrieving smoothed image stack data
im_file=[imdir,dataset,'_IMAGEsm.mat'];
if exist(im_file,'file')==2
load(im_file);
else
display('Warning: Cannot find smoothed image stack');
break
end
%define physical domain
length=(finish-start)/fps*vel*calib;
[X,Y,Z]=meshgrid(1:size(IMAGEsm,2),1:size(IMAGEsm,1),1:length/size(IMAGEsm,3):length);
[optimizer, metric] = imregconfig('multimodal');
optimizer.InitialRadius = 0.009;
optimizer.Epsilon = 1.5e-4;
optimizer.GrowthFactor = 1.01;
optimizer.MaximumIterations = 300;
IMAGEtform=IMAGEsm(:,:,1);
skip=1;
for i=1:1:size(IMAGEsm,3)-skip
if i==1
fixed=IMAGEsm(:,:,i);
else
fixed=movingtform;
end
moving=IMAGEsm(:,:,i+skip);
% figure(1)
% imshowpair(fixed, moving,'falsecolor')
% pause(0.1)
tform = imregtform(moving, fixed, 'rigid', optimizer, metric);
movingtform = imwarp(moving,tform,'OutputView',imref2d(size(fixed)));
% figure(2)
% imshowpair(fixed, movingtform,'falsecolor');
% pause(0.1)
IMAGEtform(:,:,i+skip)=movingtform;
end
%%
for i=1:1:size(IMAGEtform,3)
combined=[IMAGEsm(:,:,i),IMAGEtform(:,:,i)];
imshow(combined)
pause(0.1)
end
% im_file=[imdir,dataset,'_IMAGEout.dcm'];
% dicomwrite(IMAGEout,out_file,'Endian','Big');