-
Notifications
You must be signed in to change notification settings - Fork 0
/
graddevmultiply.asv
58 lines (44 loc) · 2.33 KB
/
graddevmultiply.asv
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
size_gd=size(grad_dev_uvw);
for u_in=1:size_gd(1)
for v_in=1:size_gd(2)
for w_in=1:size_gd(3)
J_o=zeros(3,3);
J_phi=zeros(3,3);
J_o(1,1)=1+grad_dev_uvw(u_in,v_in,w_in,1);
J_o(1,2)=grad_dev_uvw(u_in,v_in,w_in,4);
J_o(1,3)=grad_dev_uvw(u_in,v_in,w_in,7);
J_o(2,1)=grad_dev_uvw(u_in,v_in,w_in,1+1);
J_o(2,2)=1+grad_dev_uvw(u_in,v_in,w_in,4+1);
J_o(2,3)=grad_dev_uvw(u_in,v_in,w_in,7+1);
J_o(3,1)=grad_dev_uvw(u_in,v_in,w_in,1+2);
J_o(3,2)=grad_dev_uvw(u_in,v_in,w_in,4+2);
J_o(3,3)=1+grad_dev_uvw(u_in,v_in,w_in,7+2);
J_phi(1,1)=grad_dev_phi_uvw(u_in,v_in,w_in,1);
J_phi(1,2)=grad_dev_phi_uvw(u_in,v_in,w_in,4);
J_phi(1,3)=grad_dev_phi_uvw(u_in,v_in,w_in,7);
J_phi(2,1)=grad_dev_phi_uvw(u_in,v_in,w_in,1+1);
J_phi(2,2)=grad_dev_phi_uvw(u_in,v_in,w_in,4+1);
J_phi(2,3)=grad_dev_phi_uvw(u_in,v_in,w_in,7+1);
J_phi(3,1)=grad_dev_phi_uvw(u_in,v_in,w_in,1+2);
J_phi(3,2)=grad_dev_phi_uvw(u_in,v_in,w_in,4+2);
J_phi(3,3)=grad_dev_phi_uvw(u_in,v_in,w_in,7+2);
%J_phi_o=J_phi*J_o-eye(3);
determinant(u_in,v_in,w_in)=det(J_o);
determinant1(u_in,v_in,w_in)=det(J_phi_o+eye(3));
grad_dev_phi_o_uvw(u_in,v_in,w_in,1)=J_phi_o(1,1);
grad_dev_phi_o_uvw(u_in,v_in,w_in,4)=J_phi_o(1,2);
grad_dev_phi_o_uvw(u_in,v_in,w_in,7)=J_phi_o(1,3);
grad_dev_phi_o_uvw(u_in,v_in,w_in,1+1)=J_phi_o(2,1);
grad_dev_phi_o_uvw(u_in,v_in,w_in,4+1)=J_phi_o(2,2);
grad_dev_phi_o_uvw(u_in,v_in,w_in,7+1)=J_phi_o(2,3);
grad_dev_phi_o_uvw(u_in,v_in,w_in,1+2)=J_phi_o(3,1);
grad_dev_phi_o_uvw(u_in,v_in,w_in,4+2)=J_phi_o(3,2);
grad_dev_phi_o_uvw(u_in,v_in,w_in,7+2)=J_phi_o(3,3);
if(isnan(det(J_phi_o))==0 & det(J_phi_o)~=0.0 & det(J_phi_o)~=-1)
brain_mask(u_in,v_in,w_in)=1.0;
else
brain_mask(u_in,v_in,w_in)=0.0;
end
end
end
end