ngff_zarr.rfc4

RFC 4 implementation for anatomical orientation in OME-NGFF.

This module implements RFC 4 which adds anatomical orientation support to OME-NGFF axes, based on the LinkML schema.

Module Contents

Classes

AnatomicalOrientationValues

Anatomical orientation refers to the specific arrangement and directional alignment of anatomical structures within an imaging dataset. It is crucial for ensuring accurate alignment and comparison of images to anatomical atlases, facilitating consistent analysis and interpretation of biological data.

AnatomicalOrientation

Anatomical orientation specification for spatial axes.

Functions

itk_lps_to_anatomical_orientation

Convert ITK LPS coordinate system to anatomical orientation.

is_rfc4_enabled

Check if RFC 4 is enabled in the list of enabled RFCs.

add_anatomical_orientation_to_axis

Add anatomical orientation to an axis dictionary.

remove_anatomical_orientation_from_axis

Remove anatomical orientation from an axis dictionary.

Data

LPS

LPS (Left-Posterior-Superior) coordinate system orientations. In LPS, the axes increase from:

RAS

RAS (Right-Anterior-Superior) coordinate system orientations. In RAS, the axes increase from:

API

class ngff_zarr.rfc4.AnatomicalOrientationValues

Bases: str, enum.Enum

Anatomical orientation refers to the specific arrangement and directional alignment of anatomical structures within an imaging dataset. It is crucial for ensuring accurate alignment and comparison of images to anatomical atlases, facilitating consistent analysis and interpretation of biological data.

Initialization

Initialize self. See help(type(self)) for accurate signature.

left_to_right

‘left-to-right’

right_to_left

‘right-to-left’

anterior_to_posterior

‘anterior-to-posterior’

posterior_to_anterior

‘posterior-to-anterior’

inferior_to_superior

‘inferior-to-superior’

superior_to_inferior

‘superior-to-inferior’

dorsal_to_ventral

‘dorsal-to-ventral’

ventral_to_dorsal

‘ventral-to-dorsal’

dorsal_to_palmar

‘dorsal-to-palmar’

palmar_to_dorsal

‘palmar-to-dorsal’

dorsal_to_plantar

‘dorsal-to-plantar’

plantar_to_dorsal

‘plantar-to-dorsal’

rostral_to_caudal

‘rostral-to-caudal’

caudal_to_rostral

‘caudal-to-rostral’

cranial_to_caudal

‘cranial-to-caudal’

caudal_to_cranial

‘caudal-to-cranial’

proximal_to_distal

‘proximal-to-distal’

distal_to_proximal

‘distal-to-proximal’

class ngff_zarr.rfc4.AnatomicalOrientation

Anatomical orientation specification for spatial axes.

value: ngff_zarr.rfc4.AnatomicalOrientationValues

None

type: Literal[anatomical]

‘anatomical’

ngff_zarr.rfc4.LPS: Dict[str, ngff_zarr.rfc4.AnatomicalOrientation]

None

LPS (Left-Posterior-Superior) coordinate system orientations. In LPS, the axes increase from:

  • X: right-to-left (L = Left)

  • Y: anterior-to-posterior (P = Posterior)

  • Z: inferior-to-superior (S = Superior) This is the standard coordinate system used by ITK and many medical imaging applications.

Example usage: ngff_image = NgffImage( data=data, dims=(“z”, “y”, “x”), scale={“x”: 1.0, “y”: 1.0, “z”: 1.0}, translation={“x”: 0.0, “y”: 0.0, “z”: 0.0}, axes_orientations=LPS )

ngff_zarr.rfc4.RAS: Dict[str, ngff_zarr.rfc4.AnatomicalOrientation]

None

RAS (Right-Anterior-Superior) coordinate system orientations. In RAS, the axes increase from:

  • X: left-to-right (R = Right)

  • Y: posterior-to-anterior (A = Anterior)

  • Z: inferior-to-superior (S = Superior) This coordinate system is commonly used in neuroimaging applications like FreeSurfer and FSL.

Example usage: ngff_image = NgffImage( data=data, dims=(“z”, “y”, “x”), scale={“x”: 1.0, “y”: 1.0, “z”: 1.0}, translation={“x”: 0.0, “y”: 0.0, “z”: 0.0}, axes_orientations=RAS )

ngff_zarr.rfc4.itk_lps_to_anatomical_orientation(
axis_name: str,
) Optional[ngff_zarr.rfc4.AnatomicalOrientation]

Convert ITK LPS coordinate system to anatomical orientation.

ITK uses the LPS (Left-Posterior-Superior) coordinate system by default. In LPS, the axes increase from:

  • X: right-to-left (L = Left)

  • Y: anterior-to-posterior (P = Posterior)

  • Z: inferior-to-superior (S = Superior)

Parameters

axis_name : str The axis name (‘x’, ‘y’, or ‘z’)

Returns

Optional[AnatomicalOrientation] The corresponding anatomical orientation, or None for non-spatial axes

ngff_zarr.rfc4.is_rfc4_enabled(enabled_rfcs: Optional[list[int]]) bool

Check if RFC 4 is enabled in the list of enabled RFCs.

ngff_zarr.rfc4.add_anatomical_orientation_to_axis(
axis_dict: dict,
orientation: ngff_zarr.rfc4.AnatomicalOrientation,
) dict

Add anatomical orientation to an axis dictionary.

Parameters

axis_dict : dict The axis dictionary to modify orientation : AnatomicalOrientation The anatomical orientation to add

Returns

dict The modified axis dictionary

ngff_zarr.rfc4.remove_anatomical_orientation_from_axis(axis_dict: dict) dict

Remove anatomical orientation from an axis dictionary.

Parameters

axis_dict : dict The axis dictionary to modify

Returns

dict The modified axis dictionary