GUI¶
napari.* ¶
Functions:
-
freezeCheck–Freeze timer callback for napari-driven acquisition.
-
metaRuntimeFlags–Build the
cf_metaruntime 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 ¶
resolveFreezeButton ¶
Resolve the hidden VSX Freeze button used by the napari stub GUI.
Input arguments:
-
(cachedHandle¶matlab.ui.control.UIControl or []) –Previously resolved button handle, if available.
Output arguments:
-
(freezeBtn¶matlab.ui.control.UIControl or []) –Valid handle to the hidden Freeze button, or empty when unavailable.
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
freezeResumedByNapariso the next runtime-control callback can emit a one-time resume acknowledgement.
Output arguments:
-
(freezeBtn¶matlab.ui.control.UIControl or []) –Resolved hidden Freeze button handle, if available.
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):0for real hardware,1for Media simulation,2forRcvDataplayback simulation.rcvDataMatFile(char, optional): MAT file containingRcvDataused whensimulateMode = 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 bypublishProcessedFrameduring 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;0in 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.