id: https://w3id.org/ome/ngff
name: OME_NGFF_Axes
version: 0.2.0
description: >-
  This schema defines a standardized way to describe the axes of multidimensional image data. It allows each axis to
  be clearly labeled (e.g., spatial, temporal, channel), assigned appropriate units (such as micrometers or seconds),
  and, when relevant, include orientation information to specify the direction of measurement. The goal is to make
  axis metadata explicit, consistent, and machine-readable—helping tools, datasets, and users work together seamlessly
  and reduce ambiguity in data interpretation and processing.

prefixes:
  ome: https://w3id.org/ome/
  ngff: https://w3id.org/ome/ngff/
  linkml: https://w3id.org/linkml/
  orcid: https://orcid.org/
imports:
  - linkml:types
default_range: string
default_prefix: ngff

created_on: "2025-05-29"
created_by: orcid:0000-0003-1666-5421
contributors:
  - orcid:0000-0001-9475-3756
  - orcid:0000-0002-4920-8123

classes:
  # Class pertaining to OME-NGFF axes definition
  # Example of individual axis object: { "name": "z", "type": "space", "unit": "micrometer"}
  Axes:
    attributes:
      axes:
        description: >
          A list of axes. Although serialized as list, it MUST be dealt with as being a set as in the name of each axis
          MUST be unique. The orientation attribute is OPTIONAL: it MAY be defined on any subset of the axes of type
          space, and it MUST NOT be defined on axes of any other type. Where it is defined, the type of each
          orientation MUST be one of the types defined by this specification, currently only "anatomical", and two
          axes MUST NOT describe the same anatomical axis: a set of axes MUST only have one of the set
          { "left-to-right", "right-to-left" } or { "anterior-to-posterior", "posterior-to-anterior" } or the
          remaining values.
        multivalued: true
        any_of:
          - range: SpaceAxis
          - range: TimeAxis
          - range: ChannelAxis

  Axis:
    abstract: true
    attributes:
      name:
        required: true
        range: AxesNames
      type:
        range: AxisType
        required: true


  ChannelAxis:
    is_a: Axis
    slot_usage:
      name:
        range: string
        equals_string: c
        ifabsent: string(c)
      type:
        range: string
        equals_string: channel
        ifabsent: string(channel)
    defining_slots:
      - name
      - type

  SpaceAxis:
    is_a: Axis
    slot_usage:
      name:
        range: SpaceAxesNames
      type:
        range: string
        equals_string: space
        ifabsent: string(space)
    attributes:
      unit:
        description: >
          Physical unit for spatial measurement along the axis, selected from a standardized list of distance units
          (e.g., micrometer, nanometer).
        range: SpaceUnit
        required: true
      orientation:
        description: >
          The direction of an axis of type space. This attribute is OPTIONAL. An axis with no orientation and an axis
          whose orientation is null are equivalent: in both cases the orientation of that axis is undefined, and
          neither implies a default value. Writers SHOULD omit the attribute rather than serialize a null value.
        any_of:
          - range: AnatomicalOrientation
        required: false
    defining_slots:
      - name
      - type
      - unit

  TimeAxis:
    is_a: Axis
    slot_usage:
      name:
        range: string
        equals_string: t
        ifabsent: string(t)
      type:
        range: string
        equals_string: time
        ifabsent: string(time)
    attributes:
      unit:
        description: >
          Temporal unit of measurement for the axis, selected from standardized time units (e.g., second, minute, hour).
        range: TimeUnit
        required: true
    defining_slots:
      - unit

  Orientation:
    abstract: true
    attributes:
      type:
        range: string
        required: true
      value:
        required: true

  AnatomicalOrientation:
    is_a: Orientation
    slot_usage:
      type:
        equals_string: anatomical
        ifabsent: string(anatomical)
      value:
        range: AnatomicalOrientationValues
slots:
  name:
  type:

enums:
  # AxesNames are bound to change after RFC3 is implemented so this enum is subject to change.
  AxesNames:
    permissible_values:
      t: Axis name relating to the time axis.
      c: Axis name relating to the channel axis.
      z: Axis name relating to the z or depth axis.
      y: Axis relating to the y or height axis.
      x: Axis relating to the x or width axis.
  SpaceAxesNames:
    permissible_values:
      z: Axis name relating to the z or depth axis.
      y: Axis relating to the y or height axis.
      x: Axis relating to the x or width axis.
  AxisType:
    permissible_values:
      channel: >
        Represents distinct image acquisition channels, typically corresponding to different fluorescence markers,
        stains, or detection modalities. Each channel captures a specific signal or wavelength, and the axis
        distinguishes among them in the image data.
      space: >
        Denotes spatial dimensions of the image, such as physical axes in 2D or 3D (e.g., x, y, z). These axes map
        directly to coordinates in the sample or scene and often have associated physical units like microns.
      time: >
        Represents a temporal axis capturing the progression of image data over time points or frames.
        It is used in time-lapse imaging or dynamic studies to distinguish image slices acquired at different moments.
  SpaceUnit:
    permissible_values:
      angstrom:
        unit:
          ucum_code: Ao
      attometer:
        unit:
          ucum_code: am
      centimeter:
        unit:
          ucum_code: cm
      decimeter:
        unit:
          ucum_code: dm
      exameter:
        unit:
          ucum_code: Em
      femtometer:
        unit:
          ucum_code: fm
      foot:
        unit:
          ucum_code: [ft_i] # also us
      gigameter:
        unit:
          ucum_code: Gm
      hectometer:
        unit:
          ucum_code: hm
      inch:
        unit:
          ucum_code: [ in_i ]  # there is also us inch though.
      kilometer:
        unit:
          ucum_code: km
      megameter:
        unit:
          ucum_code: Mm
      meter:
        unit:
          ucum_code: m
      micrometer:
        unit:
          ucum_code: um
      mile:
        unit:
          ucum_code: [mi_i]  # or mi_i depending on the context
      millimeter:
        unit:
          ucum_code: mm
      nanometer:
        unit:
          ucum_code: nm
      parsec:
        unit:
          ucum_code: pc
      petameter:
        unit:
          ucum_code: Pm
      picometer:
        unit:
          ucum_code: pm
      terameter:
        unit:
          ucum_code: Tm
      yard:
        unit:
          ucum_code: [ yd_i ]  # or [yd_us] for US survey yard
      yoctometer:
        unit:
          ucum_code: ym
      yottameter:
        unit:
          ucum_code: Ym
      zeptometer:
        unit:
          ucum_code: zm
      zettameter:
        unit:
          ucum_code: Zm
  TimeUnit:
    permissible_values:
      attosecond:
        unit:
          ucum_code: as
      centisecond:
        unit:
          ucum_code: cs
      day:
        unit:
          ucum_code: d
      decisecond:
        unit:
          ucum_code: ds
      exasecond:
        unit:
          ucum_code: Es
      femtosecond:
        unit:
          ucum_code: fs
      gigasecond:
        unit:
          ucum_code: Gs
      hectosecond:
        unit:
          ucum_code: hs
      hour:
        unit:
          ucum_code: h
      kilosecond:
        unit:
          ucum_code: ks
      megasecond:
        unit:
          ucum_code: Ms
      microsecond:
        unit:
          ucum_code: us
      millisecond:
        unit:
          ucum_code: ms
      minute:
        unit:
          ucum_code: min
      nanosecond:
        unit:
          ucum_code: ns
      petasecond:
        unit:
          ucum_code: Ps
      picosecond:
        unit:
          ucum_code: ps
      second:
        unit:
          ucum_code: s
      terasecond:
        unit:
          ucum_code: Ts
      yoctosecond:
        unit:
          ucum_code: ys
      yottasecond:
        unit:
          ucum_code: Ys
      zeptosecond:
        unit:
          ucum_code: zs
      zettasecond:
        unit:
          ucum_code: Zs
  # This enum related to the current RFC.
  AnatomicalOrientationValues:
    description: >-
      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.
    permissible_values:
      left-to-right: Describes the directional orientation from the left side to the right lateral side of an anatomical structure or body.
      right-to-left: Describes the directional orientation from the right side to the left lateral side of an anatomical structure or body.
      anterior-to-posterior: Describes the directional orientation from the front (anterior) to the back (posterior) of an anatomical structure or body.
      posterior-to-anterior: Describes the directional orientation from the back (posterior) to the front (anterior) of an anatomical structure or body.
      inferior-to-superior: Describes the directional orientation from below (inferior) to above (superior) in an anatomical structure or body.
      superior-to-inferior: Describes the directional orientation from above (superior) to below (inferior) in an anatomical structure or body.
      dorsal-to-ventral: Describes the directional orientation from the top/upper (dorsal) to the belly/lower (ventral) in an anatomical structure or body.
      ventral-to-dorsal: Describes the directional orientation from the belly/lower (ventral) to the top/upper (dorsal) in an anatomical structure or body.
      dorsal-to-palmar: Describes the directional orientation from the top/upper (dorsal) to the palm of the hand (palmar) in a body.
      palmar-to-dorsal: Describes the directional orientation from the palm of the hand (palmar) to the top/upper (dorsal) in a body.
      dorsal-to-plantar: Describes the directional orientation from the top/upper (dorsal) to the sole of the foot (plantar) in a body.
      plantar-to-dorsal: Describes the directional orientation from the sole of the foot (plantar) to the top/upper (dorsal) in a body.
      rostral-to-caudal: Describes the directional orientation from the nasal (rostral) to the tail (caudal) end of an anatomical structure, typically used in reference to the central nervous system.
      caudal-to-rostral: Describes the directional orientation from the tail (caudal) to the nasal (rostral) end of an anatomical structure, typically used in reference to the central nervous system.
      cranial-to-caudal: Describes the directional orientation from the head (cranial) to the tail (caudal) end of an anatomical structure or body.
      caudal-to-cranial: Describes the directional orientation from the tail (caudal) to the head (cranial) end of an anatomical structure or body.
      proximal-to-distal: Describes the directional orientation from the center of the body to the periphery of an anatomical structure or limb.
      distal-to-proximal: Describes the directional orientation from the periphery of an anatomical structure or limb to the center of the body.
      superficial-to-deep: Describes the directional orientation from the outer surface (superficial) to the inner depth (deep) of a layered tissue such as skin, gut, or cortex.
      deep-to-superficial: Describes the directional orientation from the inner depth (deep) to the outer surface (superficial) of a layered tissue such as skin, gut, or cortex.
      apical-to-basal: Describes the directional orientation from the apical surface (apical) to the basal surface (basal) of an epithelial layer or polarized cell structure.
      basal-to-apical: Describes the directional orientation from the basal surface (basal) to the apical surface (apical) of an epithelial layer or polarized cell structure.
      apex-to-base: Describes the directional orientation from the tip (apex) to the broad base (base) of an organ such as the heart or lung.
      base-to-apex: Describes the directional orientation from the broad base (base) to the tip (apex) of an organ such as the heart or lung.
