Skip to content

GUI

napari.*

Functions:

  • freezeCheck –

    Freeze timer callback for napari-driven acquisition.

  • metaRuntimeFlags –

    Build the cf_meta runtime flag bitmask.

  • resolveFreezeButton –

    Resolve the hidden VSX Freeze button used by the napari stub GUI.

  • setFrozenState –

    Synchronize the VSX freeze latch between base state and the hidden UI control.

  • setup –

    Initialize Effusive for napari-driven acquisition.

  • stubGui –

    VSX GUI stub for napari-driven acquisition.

freezeCheck

()

Freeze timer callback for napari-driven acquisition.

Notes

VSX calls this function periodically (every 0.25s) while acquisition is frozen. It reads freeze/exit commands from shared memory and updates base workspace state so acquisition can resume or exit without requiring a manual GUI interaction first.

This callback is registered with VSX via Mcr_FreezeTimerFunction.

metaRuntimeFlags

Build the cf_meta runtime flag bitmask.

Input arguments:

  • saveActive

    (logical) –

    Whether saving is active (controls bit 0).

  • freezeActive

    (logical) –

    Whether VSX is currently frozen (controls bit 1).

Output arguments:

  • runtimeFlags

    ( uint32 ) –

    Bitmask of runtime flags to write into cf_meta for napari to read.

resolveFreezeButton

Resolve the hidden VSX Freeze button used by the napari stub GUI.

Input arguments:

Output arguments:

setFrozenState

Synchronize the VSX freeze latch between base state and the hidden UI control.

Input arguments:

  • frozen

    (logical) –

    Whether acquisition should be frozen in VSX.

  • cachedHandle

    (matlab.ui.control.UIControl or []) –

    Previously resolved hidden Freeze button handle, if available.

  • resumeAck

    (logical) –

    Whether this transition should mark freezeResumedByNapari so the next runtime-control callback can emit a one-time resume acknowledgement.

Output arguments:

Notes

VSX enters its hardware pause path when the base-workspace freeze variable becomes 1. While paused, VSX waits on the hidden Freeze togglebutton value to return to 0. Both latches must therefore stay in sync for manual pause, timer-driven resume, and MATLAB-originated auto-freeze paths such as z-stack completion.

setup

()

Initialize Effusive for napari-driven acquisition.

Called synchronously from the Python matlab_worker.py subprocess after shared memory segments have been created by the napari viewer. Returns after all setup is complete. The worker then calls VSX(), which blocks for the duration of the acquisition session.

Notes

Base workspace variables (set by matlab_worker.py before this function is called):

  • EFFUSIVE_PATH (char): Path to the Effusive repo root.
  • probeName (char): Probe identifier. One of 'L22-14v', 'L35-16vX', or 'MiniProbe'.
  • transmitFrequency (double): Transmit frequency [MHz].
  • storagePath (char): Root directory for saved session folders.
  • sessionId (char): Session identifier shared with the viewer log.
  • voltage (double): Initial transmit voltage [V].
  • transmitAperturePercentage (double): Initial TX aperture [%].
  • receiveAperturePercentage (double): Initial RX aperture [%].
  • txrxFrameRate (double): Acquisition frame rate [Hz].
  • transmitPulseLength (double): Pulse length [half cycles].
  • nTransmissions (double): Number of compounded angles.
  • nRepeats (double): Ensemble size.
  • planewaveOpeningAngle (double): Total steering angle range [deg].
  • desiredEndDepthMm (double): Imaging depth [mm].
  • tgcGain (double): Initial TGC gain.
  • tgcControlPoints (double): Initial Verasonics TGC control points.
  • simulateMode (double): 0 for real hardware, 1 for Media simulation, 2 for RcvData playback simulation.
  • rcvDataMatFile (char, optional): MAT file containing RcvData used when simulateMode = 2.
  • sharedMemoryNameMeta (char): Shared memory name for the cf_meta segment.
  • sharedMemoryNameBmode (char): Shared memory name for the cf_bmode segment.
  • sharedMemoryNamePdi (char): Shared memory name for the cf_pdi segment.
  • sharedMemoryNameCmd (char): Shared memory name for the cf_cmd segment.
  • sharedMemoryNameStack (char): Shared memory name for the cf_stack segment.
  • sharedMemoryNameRf (char): Shared memory name for the cf_rf segment.
  • sharedMemoryNameAck (char): Shared memory name for the cf_ack segment.

After effusive.napari.setup returns, the cf_meta segment contains:

  • frame_counter (uint64): 0 -- incremented by publishProcessedFrame during acquisition.
  • nz (int32): Image height in pixels.
  • nx (int32): Image width in pixels.
  • z_start_mm (float32): Depth-axis start [mm].
  • z_end_mm (float32): Depth-axis end [mm].
  • x_start_mm (float32): Lateral-axis start [mm].
  • x_end_mm (float32): Lateral-axis end [mm].
  • runtime_flags (uint32): Runtime bitmask where bit 0 indicates save active and bit 1 indicates freeze active.
  • ensemble_time_s (float64): Hardware time tag of the current ensemble in seconds since counter reset; 0 in simulate mode.

After effusive.napari.setup returns, the base workspace also contains FrameRuntimeState (struct), the inter-callback data bus used by processRFEnsembleBlock, processRuntimeControl, and publishProcessedFrame. All fields are empty/false at startup and populated on the first processed frame.

stubGui

()

VSX GUI stub for napari-driven acquisition.

VSX requires a function whose name matches Resource.Parameters.GUI. That function must create a MATLAB figure tagged 'UI'. This stub creates an invisible figure to satisfy VSX without opening any MATLAB controls; all acquisition control is driven from the napari dock widget.

Notes

hv2GUIprofile is normally set by vsx_gui when it builds the second HV slider. TXEventCheck reads it unconditionally, so this stub writes 0 to the base workspace (same default as vsx_gui.m). A hidden freeze togglebutton is created so VSX has a UI element to wait on when freeze is activated (via napari). freezeCheck will toggle this button to unfreeze.