Fstack
focus_stack(im_stack, nhsize=9, focus=None, alpha=0.2, sth=13)
Generate extended depth-of-field image from focus sequence using noise-robust selective all-in-focus algorithm [1]. Input images may be grayscale or color. For color images, the algorithm is applied to each color plane independently.
For further details, see: [1] Pertuz et. al. "Generation of all-in-focus images by noise-robust selective fusion of limited depth-of-field images" IEEE Trans. Image Process, 22(3):1242 - 1251, 2013.
S. Pertuz, Jan/2016
Modified by Josh, 2021
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im_stack |
np.ndarray
|
Element |
required |
nhsize |
int
|
Size of default window. |
9
|
focus |
Optional[np.ndarray]
|
|
None
|
alpha |
float
|
A scalar in |
0.2
|
sth |
float
|
A scalar. See [1] for details. |
13
|
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
gauss3p(x, y)
Fast 3-point gaussian interpolation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
np.ndarray
|
|
required |
y |
np.ndarray
|
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
np.ndarray
|
|
np.ndarray
|
|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
get_fmeasure(im_stack, nhsize)
Returns focus measure value for each pixel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im_stack |
np.ndarray
|
Element |
required |
nhsize |
int
|
Size of focus measure window. Typical: |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
get_smeasure(fm, nhsize, focus)
Returns selectivity measure value for each pixel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fm |
np.ndarray
|
|
required |
nhsize |
int
|
Size of focus measure window. Typical: |
required |
focus |
np.ndarray
|
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
124 125 126 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 |
|
get_weights(S, fm, alpha, sth)
Computes sharpening parameter phi and then
returns cut off frequency for high pass convolve_2d, omega
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
S |
np.ndarray
|
|
required |
fm |
np.ndarray
|
|
required |
alpha |
float
|
A scalar in |
required |
sth |
float
|
A scalar. Typical: |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
gfocus(im, w_size)
Compute focus measure using gray level local variance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im |
np.ndarray
|
|
required |
w_size |
int
|
Size of convolve_2d window. Typical: |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
|
im2double(im)
Equivalent to Matlab im2double function. Follows answer here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im |
np.ndarray
|
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
rgb2gray(im)
Converts RGB m x n x 3
color image into m x n
greyscale image.
Uses weighted sum indicated here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im |
np.ndarray
|
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
Source code in coppafish/extract/fstack.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|