Scale
central_tile(tilepos_yx, use_tiles)
returns tile in use_tiles closest to centre.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tilepos_yx |
np.ndarray
|
|
required |
use_tiles |
List[int]
|
|
required |
Returns:
Type | Description |
---|---|
int
|
tile in |
Source code in coppafish/extract/scale.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
get_scale(nbp_file, nbp_basic, r, use_tiles, use_channels, use_z, scale_norm, filter_kernel, smooth_kernel=None)
Convolves the image for tile t
, channel c
, z-plane z
with filter_kernel
then gets the multiplier to apply to filtered nd2 images by dividing scale_norm
by the max value of this
filtered image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nbp_file |
NotebookPage
|
|
required |
nbp_basic |
NotebookPage
|
|
required |
r |
int
|
Round to get |
required |
use_tiles |
List[int]
|
|
required |
use_channels |
List[int]
|
|
required |
use_z |
List[int]
|
|
required |
scale_norm |
int
|
Desired maximum pixel value of npy images. Typical: |
required |
filter_kernel |
np.ndarray
|
|
required |
smooth_kernel |
Optional[np.ndarray]
|
|
None
|
Returns:
Type | Description |
---|---|
int
|
|
int
|
|
int
|
|
float
|
|
Source code in coppafish/extract/scale.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
get_scale_from_txt(txt_file, scale, scale_anchor, tol=0.001)
This checks whether scale
and scale_anchor
values used for producing npy files in tile_dir match
values used and saved to txt_file
on previous run.
Will raise error if they are different.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
txt_file |
str
|
|
required |
scale |
Optional[float]
|
Value of |
required |
scale_anchor |
Optional[float]
|
Value of |
required |
tol |
float
|
Two scale values will be considered the same if they are closer than this. |
0.001
|
Returns:
Type | Description |
---|---|
float
|
scale - If txt_file exists, this will be the value saved in it otherwise will just be the input value. |
float
|
scale_anchor - If txt_file exists, this will be the value saved in it otherwise will just be the input value. |
Source code in coppafish/extract/scale.py
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 |
|
get_z_plane(nbp_file, nbp_basic, r, t, use_channels, use_z)
Finds z plane and channel that has maximum pixel value for given round and tile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nbp_file |
NotebookPage
|
|
required |
nbp_basic |
NotebookPage
|
|
required |
r |
int
|
Round to consider. |
required |
t |
int
|
npy tile index (index |
required |
use_channels |
List[int]
|
|
required |
use_z |
List[int]
|
|
required |
Returns:
Type | Description |
---|---|
int
|
|
int
|
|
np.ndarray
|
|
Source code in coppafish/extract/scale.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
save_scale(txt_file, scale, scale_anchor)
This saves scale
and scale_anchor
to txt_file
. If either scale
and scale_anchor
are None
,
they will be set to 0 when saving.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
txt_file |
str
|
|
required |
scale |
Optional[float]
|
Value of |
required |
scale_anchor |
Optional[float]
|
Value of |
required |
Source code in coppafish/extract/scale.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|