origin module¶
LPS origin specification for image construction.
This module exposes a single small value type, Origin, which
replaces the legacy three-kwarg dance (set_origin, set_corner,
set_corner_lps) on the various zarr_to_* builders. Instances are
constructed via classmethods that name what they mean, and translate to
the legacy kwargs internally.
- class aind_zarr_utils.origin.Origin(point=None, corner_code=None, corner_lps=None)[source]¶
Bases:
objectLPS-origin specification for an anatomical image.
Construct via the classmethods:
default()— origin at LPS(0, 0, 0).at()— origin set directly to the given LPS point.at_corner()— origin chosen so that the named anatomical corner of the image lands at the given LPS point.
Internally this is a tagged union: at most one of
pointor the pair(corner_code, corner_lps)is set; bothNonemeans the default origin.- classmethod at(point)[source]¶
Return an
Originwhose value ispointin LPS millimeters.- Return type:
- classmethod at_corner(corner_code, lps_point)[source]¶
Return an
Originthat anchors a labelled corner tolps_point.
- __init__(point=None, corner_code=None, corner_lps=None)¶
Overview¶
Origin replaces the legacy set_origin / set_corner /
set_corner_lps argument group with one explicit value.
Examples¶
Default origin:
img = asset.image(level=3, origin=Origin.default())
Set origin directly:
img = asset.image(level=3, origin=Origin.at((0.0, 0.0, 0.0)))
Anchor a labelled corner:
img = asset.image(
level=3,
origin=Origin.at_corner("RAS", (0.0, 0.0, 0.0)),
)
Origin is only accepted when pipeline=False. Pipeline images and stubs
use the corrected origin from the pipeline metadata.