-
Notifications
You must be signed in to change notification settings - Fork 0
/
8_update_transforms.py
81 lines (73 loc) · 1.68 KB
/
8_update_transforms.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
72
73
74
75
76
77
78
79
80
81
import mobie
import os
transforming_sources = [
["em-overview"],
["em-detail-a1-A"],
["em-detail-a2-A",
"tomo_53_lm",
"tomo_53_hm",
"fluorescence-a2-c0",
"fluorescence-a2-c1",
"fluorescence-a2-c2"
]
]
trafo_names = ["manual_shift_a3", "manual_shift_a1", "manual_trafo_a2"]
transforms = [
[
1.0,
0.0,
0.0,
1.7940359100750243,
0.0,
1.0,
0.0,
-6.6635619517072655,
0.0,
0.0,
1.0,
0.0
],
[
1.0,
0.0,
0.0,
-2.4988357318902317,
0.0,
1.0,
0.0,
-7.688725328893014,
0.0,
0.0,
1.0,
0.0
],
[
0.9998476951563912,
0.01745240643728351,
0.0,
0.4546800322595175,
-0.01745240643728351,
0.9998476951563912,
0.0,
-3.527570751462804,
0.0,
0.0,
1.0,
0.0
]
]
root = os.getcwd()
data = 'data/hela'
ds = mobie.metadata.read_dataset_metadata(os.path.join(root, data))
views = ds['views']
def add_transforms():
for tf_sources, trafo, name in zip(transforming_sources, transforms, trafo_names):
for view in views.values():
for tf_source in tf_sources:
if [tf_source] in [sD['imageDisplay']['sources'] for sD in view['sourceDisplays'] if
'imageDisplay' in sD]:
view['sourceTransforms'].append(
mobie.metadata.get_affine_source_transform([tf_source], trafo, name=name))
mobie.metadata.write_dataset_metadata(data, ds)
if __name__ == "__main__":
add_transforms()