-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaffine_config.py
71 lines (59 loc) · 1.89 KB
/
affine_config.py
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
65
66
67
68
69
70
71
import numpy as np
class Config():
def __init__(self, trans_center, scale, global_init_mtx_trans):
self._trans_center = trans_center
Apx2sdf = np.eye(4)
Apx2sdf[0, 3] = trans_center[0]
Apx2sdf[1, 3] = trans_center[1]
Apx2sdf[2, 3] = trans_center[2]
Apx2sdf[0, :] *= -1 / scale
Apx2sdf[1, :] *= -1 / scale
Apx2sdf[2, :] *= 1 / scale
self._Apx2sdf = Apx2sdf
# create initial init matrix which performs translation alone
global_init_mtx = np.eye(4)
global_init_mtx[0, 3] = global_init_mtx_trans[0]
global_init_mtx[1, 3] = global_init_mtx_trans[1]
global_init_mtx[2, 3] = global_init_mtx_trans[2]
self._global_init_mtx = global_init_mtx
@property
def trans_center(self):
return self._trans_center
@property
def Apx2sdf(self):
return self._Apx2sdf
@property
def global_init_mtx(self):
return self._global_init_mtx
# Example stats for liver
# trans_center = [-63.5, -63.5, -100.5]
#
# Apx2sdf = np.eye(4)
# Apx2sdf[0, 3] = trans_center[0]
# Apx2sdf[1, 3] = trans_center[1]
# Apx2sdf[2, 3] = trans_center[2]
# Apx2sdf[0, :] *= -1 / 35.0
# Apx2sdf[1, :] *= -1 / 35.0
# Apx2sdf[2, :] *= 1 / 35.0
#
# # create initial init matrix which performs translation alone
# global_init_mtx = np.eye(4)
# global_init_mtx[0, 3] = 77.4
# global_init_mtx[1, 3] = 68.7
# global_init_mtx[2, 3] = 118.2
# Example stats for larynx
# trans_center = [-(161/2), -(161/2), -(611/2)]
#
# Apx2sdf = np.eye(4)
# Apx2sdf[0, 3] = trans_center[0]
# Apx2sdf[1, 3] = trans_center[1]
# Apx2sdf[2, 3] = trans_center[2]
# Apx2sdf[0, :] *= -1 / 20.0
# Apx2sdf[1, :] *= -1 / 20.0
# Apx2sdf[2, :] *= 1 / 20.
#
# # create initial init matrix which performs translation alone
# global_init_mtx = np.eye(4)
# global_init_mtx[0, 3] = 77.4
# global_init_mtx[1, 3] = 68.7
# global_init_mtx[2, 3] = 279.4