nd2
get_image(images, fov, channel, use_z=None)
Using dask array from nd2 file, this loads the image of the desired fov and channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
images |
np.ndarray
|
Dask array with |
required |
fov |
int
|
|
required |
channel |
int
|
|
required |
use_z |
Optional[List[int]]
|
|
None
|
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/utils/nd2.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
get_metadata(file_path)
Gets metadata containing information from nd2 data about pixel sizes, position of tiles and numbers of tiles/channels/z-planes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
Path to desired nd2 file. |
required |
Returns:
Type | Description |
---|---|
dict
|
Dictionary containing - |
dict
|
|
dict
|
|
dict
|
|
dict
|
|
Source code in coppafish/utils/nd2.py
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 |
|
get_nd2_tile_ind(tile_ind_npy, tile_pos_yx_nd2, tile_pos_yx_npy)
Gets index of tiles in nd2 file from tile index of npy file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tile_ind_npy |
Union[int, List[int]]
|
Indices of tiles in npy file |
required |
tile_pos_yx_nd2 |
np.ndarray
|
|
required |
tile_pos_yx_npy |
np.ndarray
|
|
required |
Returns:
Type | Description |
---|---|
Union[int, List[int]]
|
Corresponding indices in nd2 file |
Source code in coppafish/utils/nd2.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
load(file_path)
Returns dask array with indices in order fov
, channel
, y
, x
, z
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
Path to desired nd2 file. |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
Dask array indices in order |
Source code in coppafish/utils/nd2.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
save_metadata(json_file, nd2_file, use_channels=None)
Saves the required metadata as a json file which will contain
xy_pos
-List [n_tiles x 2]
. xy position of tiles in pixels.pixel_microns
-float
. xy pixel size in microns.pixel_microns_z
-float
. z pixel size in microns.sizes
- dict with fov (t
), channels (c
), y, x, z-planes (z
) dimensions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_file |
str
|
Where to save json file |
required |
nd2_file |
str
|
Path to nd2 file |
required |
use_channels |
Optional[List]
|
The channels which have been extracted from the nd2 file.
If |
None
|
Source code in coppafish/utils/nd2.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|