13 %slice = 4; % Image slice number
15 v = load(
'Kel_v9.dat'); % Direction vectors of rods
16 %
y = load(
'CRW_y2_9.dat'); % Coordinates of fiducials in image plane
17 y = load(
'Syn_y4_9.dat'); % Coordinates of fiducials in image plane
18 R0 = [0.9848 0.0000 -0.1736; 0.0000 1.0000 0.0000; 0.1736 0.0000 0.9848];
19 b0 = [19.3969 -20.0000 5.4202]
'; 20 N = size(p,2) % # of rods 24 R = eye(3); % Initial rotation matrix 25 limit = 100; % # of iterations 34 mat = zeros(3*
N,
N+6);
36 lv(3*
i-2) =
p(1,
i) - dot(
R(1,:), y(:,
i));
37 lv(3*
i-1) =
p(2,
i) - dot(
R(2,:), y(:,
i));
38 lv(3*
i) =
p(3,
i) - dot(
R(3,:), y(:,
i));
40 % Skew symmetric matrix corresponding to vector
y 41 skew_Y = [0 -y(3,i) y(2,i); y(3,i) 0 -y(1,i); -y(2,i) y(1,i) 0];
42 mat(3*
i-2,
i) = -
v(1,
i);
43 mat(3*
i-1,
i) = -
v(2,
i);
44 mat(3*
i,
i) = -
v(3,
i);
45 mat((3*
i-2):(3*
i), (
N+1):(
N+3)) = -
R * skew_Y;
46 mat((3*
i-2):(3*
i), (
N+4):(
N+6)) = eye(3);
48 q = (inv(mat
' * mat)) * (mat' * lv);
49 s = q(1:
N); % Arc lengths
51 b = q((
N+4):(
N+6)); % Translation vector
55 tmp_e(:,
i) = (
p(:,
i) + s(
i) *
v(:,i)) - (
R *
y(:,
i) + b);
59 error2(
cnt, :) = [sqrt(6 - 2 * trace(R0' * R)) norm(b0 - b)]; % NOTE
77 figure(1) % Error vs
# of iterations 79 xlabel('Number of iterations')
81 %logerror = log(error);
82 %plot(
iter, logerror, 'k:')
83 %plot(
iter, logerror, 'k-')
84 %xlabel('Number of iterations')
86 %tit = sprintf('Algorithm 3
for 6*1 approach, slice %d', slice);
88 %legend('solid: synthetic
data', 'dotted: real
data')
To store error at each iteration Calculation by iteration cnt
Algorithm Minimization over and Arc lengths created
To store error at each iteration Calculation by iteration(velocity vector is calculated) cnt
To store error at each iteration error2
Positive constant for(deldot)
Initial rotation matrix R
Initial rotation matrix b
Initial rotation matrix limit
Algorithm Minimization over Position
Algorithm Minimization over Orientation
Algorithm Minimization over and Arc lengths modified
Position vectors of rods v
Algorithm Minimization over and Arc lengths Sangyoon Lee clear all flops(0) % Loading data files %slice
Coordinates of fiducials in image plane R0
Direction vectors of rods y