Luxar Viewer API Documentation - v2026.9.22
    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<() => 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: Scene

        THREE.js scene containing nD objects with metadata

      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 all observers (triggers UI updates and re-slicing)

      Parameters

      • dimIndex: number

        Index of dimension to update

      • value: number

        New position value in dimension units

      Returns void

    • 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. 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: () => void | Promise<void>

        Function to call when dimensions change (can return Promise)

      Returns void

    • Unregisters a dimension change callback.

      Important for preventing memory leaks when components are destroyed.

      Parameters

      • callback: () => 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.

      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