Luxar Viewer API Documentation - v2026.10.19
    Preparing search index...
    Index
    dims: SimpleDims | null = null

    The shared dimension state for the entire scene

    dimensionRanges: [number, number][] | null = null

    Min/max bounds for each dimension derived from metadata

    listeners: Set<(changed: boolean) => void | Promise<void>> = ...

    Observer callbacks that react to dimension changes (can be async)

    pendingUpdatePromise: Promise<void> | null = null

    Promise tracking pending listener completion (for animation synchronization)

    • The default position policy — shared by initFromScene and resetPositions so the two can never diverge:

      • Displayed dimensions (X, Y, Z): 0 (camera-controlled)
      • Discrete/categorical dimensions (time, channels, frames): range minimum, which is the anchor of the min + k·step navigation grid.
      • Continuous non-displayed dimensions (4th+ spatial dims): CENTER (no natural "first")

      Parameters

      Returns number

    • Initializes the scene-level dimension state from metadata embedded in the scene.

      This method searches through the THREE.js scene hierarchy to find nD objects with embedded dimension metadata, then establishes the shared dimensional coordinate system for the entire scene.

      Search strategy:

      1. Check scene.userData.sceneDimensions first (direct attachment)
      2. Recursively search scene children for embedded metadata
      3. Use the first valid dimension metadata found

      Initialization logic:

      • Parse metadata into standardized DimensionMetadata format
      • Establish ranges from metadata or sensible defaults
      • Set non-displayed dimensions to their minimum values
      • Identify which dimensions should be displayed (max 3)

      Parameters

      • scene: Object3D

        THREE.js scene (or a single Luxar root group, which carries the metadata itself — what a LuxarLayer passes so a host scene holding several layers cannot hand one layer another's dimensions)

      Returns boolean

      True if dimensions were successfully initialized, false if no metadata found

    • Provides read-only access to the current dimension state.

      This is the primary interface for components that need to access the current slice positions, displayed dimensions, and metadata.

      Returns SimpleDims | null

      Current dimension state or null if not initialized

    • Gets the navigable bounds for each dimension.

      These ranges define the valid navigation space and are used by UI components (sliders, keyboard handlers) to constrain user input and calculate appropriate step sizes.

      Returns [number, number][] | null

      Array of [min, max] bounds for each dimension, or null if not initialized

    • Updates the position in a specific dimension and triggers re-slicing.

      This is the central method for dimension navigation, handling both user input validation and observer notification. It ensures all dimension changes are properly constrained and communicated.

      Value processing:

      1. Validate dimension index bounds
      2. Clamp value to valid range for this dimension
      3. Quantize discrete dimensions to their step size
      4. Update internal state
      5. Notify observers only when the resulting value changes, unless forced

      Parameters

      • dimIndex: number

        Index of dimension to update

      • value: number

        New position value in dimension units

      • options: { force?: boolean } = {}
        • Optionalforce?: boolean

          Re-notify listeners at the current value to refine a pinned slice

      Returns boolean

      whether the position changed (a forced re-notify at the same value is not a change)

    • Reset every dimension back to its initial default position (same policy as initFromScene) and notify listeners — sliders, slicing, and status displays all refresh reactively. Used by the rail Home popover's "Reset dimensions" action. A reset still notifies when every dimension is already at its default, with changed=false. No-op before initialization.

      Returns void

    • Registers a callback to be invoked whenever dimension state changes.

      This implements the observer pattern, allowing UI components and visualization objects to react automatically to navigation events. Typical subscribers include sliders, points, and status displays.

      Callbacks can be async — their completion can be awaited via waitForUpdate().

      Parameters

      • callback: (changed: boolean) => void | Promise<void>

        Function to call on a change or forced refresh (can return Promise). Receives false for a refresh that leaves the slice position unchanged.

      Returns void

    • Unregisters a dimension change callback.

      Important for preventing memory leaks when components are destroyed.

      Parameters

      • callback: (changed: boolean) => void | Promise<void>

        Previously registered callback function

      Returns void

    • Private

      Triggers all registered observer callbacks.

      This is called internally whenever dimension state changes, propagating updates throughout the reactive system. Async callbacks are collected and their completion is tracked via currentUpdatePromise.

      Parameters

      • changed: boolean

      Returns void

    • Returns a promise that resolves when all pending listener updates complete.

      Used by animation systems to wait for data loading before advancing frames. Returns immediately resolved promise if no update is in progress.

      Returns Promise<void>

      Promise that resolves when pending updates complete

    • Provides access to the complete dimension metadata array.

      Used by UI components that need detailed information about dimension properties like names, units, discreteness, etc.

      Returns DimensionMetadata[]

      Array of dimension metadata, empty if not initialized

    • Extracts human-readable names for all dimensions.

      Provides fallback names when metadata doesn't specify custom names. Used by UI components for labeling sliders and status displays.

      Returns string[]

      Array of dimension names (e.g., ["Time", "X", "Y", "Z"])

    • Extracts physical units for all dimensions.

      Used by UI components to display appropriate unit labels next to numeric values (e.g., "μm", "s", "nm").

      Returns string[]

      Array of dimension units, empty strings for dimensionless quantities

    • Determines if the dataset has navigable dimensions beyond the displayed 3D view.

      This is used by UI components to decide whether to show dimension navigation controls (sliders, keyboard hints). If all dimensions are displayed in 3D, no additional navigation UI is needed.

      Returns boolean

      True if there are dimensions not currently displayed in 3D space