OPM Tools Module
OPM-specific data handling tools.
This module provides tools and utilities specifically for handling oblique plane microscopy (OPM) data.
History:
- 2024/12: Refactored repo structure.
- 2024/07: Initial commit.
Functions:
Name | Description |
---|---|
chunk_indices | Calculate indices for evenly distributed chunks. |
chunked_orthogonal_deskew | Chunked orthogonal deskew of oblique data. |
deskew | Numba accelerated orthogonal interpolation for oblique data. |
deskew_shape_estimator | Generate shape of orthogonal interpolation output array. |
lab2cam | Convert xyz coordinates to camera coordinates sytem, x', y', and stage position. |
chunk_indices(length, chunk_size)
Calculate indices for evenly distributed chunks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
length | int | axis array length | required |
chunk_size | int | size of chunks | required |
Returns:
Name | Type | Description |
---|---|---|
indices | Sequence[int, ...] | chunk indices |
Source code in src/merfish3danalysis/utils/opmtools.py
chunked_orthogonal_deskew(oblique_image, psf_data, chunk_size=15000, overlap_size=550, scan_crop=700, camera_bkd=100, camera_cf=0.24, camera_qe=0.9, z_downsample_level=2, perform_decon=True, decon_iterations=10, decon_chunks=1024)
Chunked orthogonal deskew of oblique data.
Optionally performs deconvolution on each chunk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
oblique_image | ArrayLike | oblique image stack | required |
psf_data | ArrayLike | PSF data for deconvolution | required |
chunk_size | int | size of chunks | 15000 |
overlap_size | int | overlap size | 550 |
scan_crop | int | crop size | 700 |
camera_bkd | int | camera background | 100 |
camera_cf | float | camera conversion factor | 0.24 |
camera_qe | float | camera quantum efficiency | 0.9 |
z_downsample_level | z downsample level | 2 | |
perform_decon | bool | perform deconvolution | True |
decon_iterations | int | number of deconvolution iterations | 10 |
decon_chunks | int | deconvolution chunk size | 1024 |
Returns:
Name | Type | Description |
---|---|---|
deskewed_image | ArrayLike | deskewed image stack |
Source code in src/merfish3danalysis/utils/opmtools.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
deskew(data, theta=30.0, distance=0.4, pixel_size=0.115)
Numba accelerated orthogonal interpolation for oblique data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data | ArrayLike | image stack of uniformly spaced OPM planes | required |
theta | float | angle relative to coverslip | 30.0 |
distance | float | step between image planes along coverslip | 0.4 |
pixel_size | float | in-plane camera pixel size in OPM coordinates | 0.115 |
Returns:
Name | Type | Description |
---|---|---|
output | ArrayLike | image stack of deskewed OPM planes on uniform grid |
Source code in src/merfish3danalysis/utils/opmtools.py
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 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 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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
deskew_shape_estimator(input_shape, theta=30.0, distance=0.4, pixel_size=0.115)
Generate shape of orthogonal interpolation output array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_shape | Sequence[int] | shape of oblique array | required |
theta | float | angle relative to coverslip | 30.0 |
distance | float | step between image planes along coverslip | 0.4 |
pixel_size | float | in-plane camera pixel size in OPM coordinates | 0.115 |
Returns:
Name | Type | Description |
---|---|---|
output_shape | Sequence[int] | shape of deskewed array |
Source code in src/merfish3danalysis/utils/opmtools.py
lab2cam(x, y, z, theta=30.0 * np.pi / 180.0)
Convert xyz coordinates to camera coordinates sytem, x', y', and stage position.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x | int | coverslip x coordinate | required |
y | int | coverslip y coordinate | required |
z | int | coverslip z coordinate | required |
theta | float | OPM angle in radians | 30.0 * pi / 180.0 |
Returns:
Name | Type | Description |
---|---|---|
xp | int | xp coordinate |
yp | int | yp coordinate |
stage_pos | int | distance of leading edge of camera frame from the y-axis |