-
Notifications
You must be signed in to change notification settings - Fork 0
/
save_data_to_file.py
53 lines (39 loc) · 1.21 KB
/
save_data_to_file.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
# How to grab our data and put it into a .npy file
# To load data in code:
#
# import numpy as np
#
# membrane_images = np.load('nXp_data.npy')
#
import ndio
import ndio.remote.OCP as OCP
oo = OCP()
import ndio.remote.OCPMeta as NDLIMS
nn = NDLIMS()
import ndio.convert.tiff as ndtiff # For export to tiff later
import numpy as np
print "Done importing packages"
tokens = oo.get_public_tokens()
image_token = 'kasthuri11cc'
annotation_token = 'cv_kasthuri11_membrane_2014'
# Get channel ROI for token
channel_ROI = nn.get_metadata(annotation_token)['channels']
# Get membrane ROI coordinates
membrane_group_ROI = channel_ROI['image']['rois']['ac4']
# Sets membrane query in Python
membrane_query = {
'token': 'cv_kasthuri11_membrane_2014',
'channel': 'image',
'x_start': membrane_group_ROI['x'][0],
'x_stop': membrane_group_ROI['x'][1],
'y_start': membrane_group_ROI['y'][0],
'y_stop': membrane_group_ROI['y'][1],
'z_start': membrane_group_ROI['z'][0],
'z_stop': membrane_group_ROI['z'][1],
'resolution': membrane_group_ROI['resolution'],
}
print "Getting images"
membrane_images = oo.get_cutout(**membrane_query)
print "Printing to file"
np.save('nXp_data.npy', membrane_images)
print "Done."