2727----------------
2828Functions:
2929
30- - `get_active_voxel_size()`
31-
32- def get_active_voxel_size() -> tuple[float, float, float]
30+ - `get_active_voxel_size() -> tuple[float, float, float]`
3331
3432 Get the active voxel size in meters along the x, y, and z axes.
3533
36- - `get_active_scale()`
37-
38- def get_active_scale() -> tuple[float, float, float]
34+ - `get_active_scale() -> tuple[float, float, float]`
3935
4036 Get the scaling factors between simulation and optical pixels.
4137
42- - `create_context(xpixel, ypixel, zpixel, xscale, yscale, zscale)`
43-
44- def create_context(
45- xpixel: float | None = None,
46- ypixel: float | None = None,
47- zpixel: float | None = None,
48- xscale: int | None = None,
49- yscale: int | None = None,
50- zscale: int | None = None,
51- ) -> Context
38+ - `create_context(xpixel, ypixel, zpixel, xscale, yscale, zscale) -> Context`
5239
5340 Create a unit context that defines how pixels map to meters.
5441
@@ -64,14 +51,17 @@ def create_context(
6451>>> from deeptrack.backend import units
6552
6653Retrieve the active voxel size in meters:
54+
6755>>> units.get_active_voxel_size()
6856(1e-06, 1e-06, 1e-06)
6957
7058Retrieve the scaling factors between simulation and optical pixels:
59+
7160>>> units.get_active_scale()
7261(1.0, 1.0, 1.0)
7362
7463Create a custom unit context and use it to convert simulation pixels:
64+
7565>>> from deeptrack import units_registry as u
7666>>>
7767>>> ctx = units.create_context(
@@ -90,6 +80,7 @@ def create_context(
90801e-06 meter
9181
9282Use the ConversionTable to convert physical quantities to target units:
83+
9384>>> conversion_table = units.ConversionTable(
9485... length=(u.meter, u.micrometer),
9586... time=(u.second, u.millisecond),
@@ -99,13 +90,15 @@ def create_context(
9990 'time': 500.0 <Unit('millisecond')>}
10091
10192Support for PyTorch tensors:
93+
10294>>> import torch
10395>>>
10496>>> conversion_table.convert(length=torch.tensor([1.0, 2.0]))
10597{'length': <Quantity([1000000. 2000000.], 'micrometer')>}
10698
10799"""
108100
101+
109102from __future__ import annotations
110103
111104from typing import Any
0 commit comments