-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathset_axistags.py
More file actions
66 lines (57 loc) · 2.21 KB
/
set_axistags.py
File metadata and controls
66 lines (57 loc) · 2.21 KB
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
import h5py
import sys
import json
def main():
1
if __name__ == "__main__":
main(sys.argv[1:])
with open('/groups/mousebrainmicro/mousebrainmicro/users/base/AnnotationData/h5repo/2017-09-25_G-007_consensus/axis_tags_raw.json','r') as f:
raw_tag_data = json.load(f)
raw_render={"axes":
[
{
"key": "t",
"typeFlags": 8,
"resolution": 0,
"description": ""
},
{
"key": "c",
"typeFlags": 1,
"resolution": 0,
"description": ""
},
{
"key": "z",
"typeFlags": 2,
"resolution": 0,
"description": ""
},
{
"key": "y",
"typeFlags": 2,
"resolution": 0,
"description": ""
},
{
"key": "x",
"typeFlags": 2,
"resolution": 0,
"description": ""
}
]
}
with h5py.File('/groups/mousebrainmicro/mousebrainmicro/users/base/AnnotationData/h5repo/2017-09-25_G-007_consensus/test_samples/183588.h5', 'r') as render_data_h5:
rt=render_data_h5['data'][:]
with h5py.File(
'/groups/mousebrainmicro/mousebrainmicro/users/base/AnnotationData/h5repo/2017-09-25_G-007_consensus/test_samples/183588-2.h5',
'w') as render_data_h5:
rt=rt.reshape(rt.shape+(1,))
rt=rt.swapaxes(0,4)
dset_trace = render_data_h5.create_dataset("data", data=rt,
dtype='uint16',
compression="gzip",
compression_opts=9)
render_data_h5['data'].attrs['axistags'] = raw_tag_data.__str__()
with h5py.File('/groups/mousebrainmicro/mousebrainmicro/users/base/AnnotationData/h5repo/2017-09-25_G-007_consensus/183588.h5', 'r+') as render_data_h5:
render_data_h5['data'].attrs['axistags'] = raw_render.__str__()