Skip to content

effusive.sequences

sequences.*

Functions:

  • addUpdateAndRunCommand –

    Update a structure in the runAcq environment.

  • calculateApertureApodization –

    Calculate a Tukey-windowed aperture apodization vector.

  • configureMiniProbeTransducer –

    Configure mini probe transducer Trans structure.

  • configurePowerDopplerEvents –

    Configure an event sequence for power Doppler imaging.

  • configurePowerDopplerSequence –

    Configure a Power Doppler plane wave sequence for a given transducer.

  • configureReceive –

    Configure the Verasonics receive structure array.

  • configureReceiveSpec –

    Configure the EchoFrame receive specification struct.

  • configureResource –

    Configure the Verasonics Resource structure.

  • configureTGC –

    Configure the Verasonics time gain compensation structure.

  • configureTGCVector –

    Configure the TGC compensation vector for EchoFrame reconstruction.

  • configureTPC –

    Configure the transmit power controller (TPC) Verasonics structure.

  • configureTransmitBeams –

    Configure the Verasonics transmit beam steering structure.

  • configureTransmitSpec –

    Configure the EchoFrame transmit specification struct.

  • configureTransmitWaveform –

    Configure the Verasonics transmit waveform structure.

  • getCommonProcessFunctions –

    Configure standard external processing functions.

  • getCommonSequenceControl –

    Get standard sequence control commands.

  • setTriggerOutEnabled –

    Enable or disable trigger-out on the trigger-out events.

addUpdateAndRunCommand

Update a structure in the runAcq environment.

When updating a VSX structure (e.g., Events) in an external process function, it then needs to be updated in the runAcq environment via a control command. This function handles this update by automatically adding a new update&Run command to the Control structure.

Input arguments:

  • structure

    (char) –

    Name of the Verasonics structure to update. Must be one of: 'Resource', 'Trans', 'Media', 'SFormat', 'PData', 'TW', 'TX', 'Receive', 'TGC', 'Recon', 'Process', 'SeqControl', or 'Event'.

calculateApertureApodization

Calculate a Tukey-windowed aperture apodization vector.

Input arguments:

  • numElements

    (int) –

    Total number of transducer elements.

  • aperturePercentage

    (float) –

    Active aperture as a percentage of total elements (0-100).

  • taperRatio

    (float) –

    Tukey window taper ratio passed to tukeywin. Transmit and receive apertures traditionally use different tapers (e.g. 0.1 and 0.2).

Output arguments:

configureMiniProbeTransducer

()

Configure mini probe transducer Trans structure.

This probe uses the L22-14v connector but with custom element mapping.

Output arguments:

  • struct –

    The Trans structure to be used with VSX for the mini probe.

configurePowerDopplerEvents

Configure an event sequence for power Doppler imaging.

Input arguments:

  • nBuffers

    (int) –

    Number of receive buffers.

  • nRepeats

    (int) –

    Ensemble size for Power Doppler calculation.

  • nTransmissions

    (int) –

    Number of plane wave angles for compounding.

  • SeqControl

    (struct) –

    Pre-existing sequence control structure to extend with additional transferToHost, waitForTransferComplete, and markTransferProcessed commands.

Output arguments:

  • Event

    ( struct ) –

    Event array defining the full Power Doppler acquisition sequence.

  • SeqControl

    ( struct ) –

    Updated sequence control structure including the new commands.

  • triggerOutEventIndex

    ( double ) –

    Indices into Event for the trigger-out events, one per buffer.

configurePowerDopplerSequence

Configure a Power Doppler plane wave sequence for a given transducer.

This function configures all Verasonics and EchoFrame structures needed for Power Doppler imaging. It automatically sets up the transducer based on the probe name using VSX's computeTrans function.

Input arguments:

  • probeName

    (('L22-14v', 'L35-16vX', 'MiniProbe'), default: 'L22-14v' ) –

    Probe identifier. Must be one of: - 'L22-14v': L22-14v linear array (15.625 MHz default) - 'L35-16vX': L35-16vX linear array (28 MHz default) - 'MiniProbe': Custom Cortexlab mini probe

  • txrxFrameRate

    (float, default: 15e3 ) –

    Acquisition frame rate before angle compounding [Hz].

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • transmitPulseLength

    (int, default: 3 ) –

    Pulse length in half cycles.

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • transmitFrequency

    (float, default: NaN ) –

    Transmit frequency [MHz]. Set to NaN to use probe-specific default from VSX (15.625 MHz for L22-14v, 28 MHz for L35-16vX).

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • maxHighVoltage

    (float, default: NaN ) –

    Maximum high voltage [V]. Set to NaN to use probe-specific default from VSX (25 V for L22-14v/L35-16vX, 15 V for MiniProbe).

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • transmitAperturePercentage

    (float, default: 100 ) –

    Transmit aperture percentage (0-100).

    Danger

    This parameter affects acoustic safety. Reducing aperture reduces output power but changing it requires acoustic safety assessment.

  • receiveAperturePercentage

    (float, default: 100 ) –

    Receive aperture percentage (0-100). Less critical for acoustic safety than transmit aperture.

  • startDepthMm

    (float, default: 0 ) –

    Starting imaging depth [mm].

  • desiredEndDepthMm

    (float, default: 12 ) –

    Desired end imaging depth [mm].

  • nTransmissions

    (int, default: 30 ) –

    Number of plane wave angles for compounding.

  • nRepeats

    (int, default: 300 ) –

    Ensemble size for Power Doppler calculation.

  • planewaveOpeningAngle

    (float, default: 20 ) –

    Total steering angle range for plane waves [degrees].

  • c0

    (float, default: 1510 ) –

    Speed of sound assumption [m/s].

  • samplingMode

    (char, default: 'BS100BW' ) –

    Sampling mode. Must be one of:

    • 'BS50BW': 50% bandwidth of the demodulation frequency
    • 'BS67BW': 67% bandwidth.
    • 'BS100BW': 100% bandwidth.
    • 'NS200BW': 200% bandwidth.
  • tgcGain

    (float, default: 900 ) –

    Time gain compensation gain.

  • extraVoxelsX

    (int, default: 128 ) –

    Extra voxels in X dimension for reconstruction. Should ideally be a power of two.

  • extraVoxelsZ

    (int, default: 0 ) –

    Extra voxels in Z dimension for reconstruction. Should ideally be a power of two.

  • svdRejectHighPercentage

    (float, default: 40 ) –

    Percentage of singular vectors from tissue subspace to remove.

  • svdRejectLowPercentage

    (float, default: 1 ) –

    Percentage of singular vectors from noise subspace to remove.

  • initialTransmitVoltage

    (float, default: 1.6 ) –

    Initial transmit voltage [V].

  • zerosEndWavelengths

    (float, default: 3 ) –

    Number of wavelengths to zero at the end of the TGC vector.

Output arguments:

  • sequence

    ( struct ) –

    Complete sequence configuration containing all Verasononics and EchoFrame structures: - Trans : Transducer configuration - Resource : System resource configuration - TX : Transmit beamforming structures - TW : Transmit waveform - Receive : Receive beamforming structures - TGC : Time gain compensation - SeqControl : Sequence control commands - Event : Event sequence definition - Process : External processing functions - RcvProfile : Receive profile settings - TPC : Transmit power control - ProbeSpec : EchoFrame probe specifications - TransmitSpec : EchoFrame transmit specifications - ReceiveSpec : EchoFrame receive specifications - ReconSpec : EchoFrame reconstruction specifications

configureReceive

Configure the Verasonics receive structure array.

Input arguments:

  • transFrequencyMHz

    (float) –

    Transducer center frequency [MHz].

  • ReceiveSpec

    (struct) –

    EchoFrame receive specification.

Output arguments:

  • Receive

    ( struct ) –

    Verasonics receive structure array with one entry per acquisition.

configureReceiveSpec

Configure the EchoFrame receive specification struct.

Input arguments:

  • numElements

    (int) –

    Number of transducer elements.

  • numRcvChannels

    (int) –

    Number of hardware receive channels.

  • transFrequencyMHz

    (float) –

    Transducer center frequency [MHz].

  • lensCorrection

    (float) –

    Lens correction depth offset [wavelengths].

  • c0

    (float) –

    Speed of sound [m/s].

  • samplingMode

    (('BS50BW', 'BS67BW', 'BS100BW', 'NS200BW'), default: 'BS50BW' ) –

    IQ sampling bandwidth mode.

  • aperturePercentage

    (float) –

    Receive aperture percentage (0-100).

  • startDepthMm

    (float) –

    Start imaging depth [mm].

  • desiredEndDepthMm

    (float) –

    Desired end imaging depth [mm]. Actual end depth is rounded up to the nearest multiple of 128 samples.

  • nTransmissions

    (int) –

    Number of plane-wave transmit angles per ensemble.

  • nRepeats

    (int) –

    Ensemble size (number of full angle sweeps).

  • txrxFrameRate

    (float) –

    TX/RX frame rate [Hz].

  • tgcGain

    (float) –

    TGC gain applied uniformly when tgcControlPoints contains NaN.

  • tgcControlPoints

    (double(1, 8)) –

    TGC control points. Set to nan(1, 8) to use uniform tgcGain.

  • nBuffers

    (int) –

    Number of receive ping-pong buffers.

Output arguments:

  • ReceiveSpec

    ( struct ) –

    EchoFrame receive specification with all derived depth, sampling, buffer-size, and timing fields populated.

configureResource

Configure the Verasonics Resource structure.

Input arguments:

  • ReceiveSpec

    (struct) –

    EchoFrame receive specification; nBuffers, nSamples, nTransmissions, and nRepeats are used to size the receive buffer.

  • c0

    (float) –

    Speed of sound [m/s].

Output arguments:

  • Resource

    ( struct ) –

    Verasonics resource structure with acquisition parameters and receive buffer configured.

configureTGC

Configure the Verasonics time gain compensation structure.

Input arguments:

  • ReceiveSpec

    (struct) –

    EchoFrame receive specification; tgcGain and endDepthWavelengths used.

  • Trans

    (struct) –

    Verasonics transducer structure. Not directly referenced in this function, but must be present in the workspace for computeTGCWaveform to access Trans.frequency via evalin('caller', ...).

Output arguments:

  • TGC

    ( struct ) –

    Verasonics time gain compensation structure.

configureTGCVector

(ReconSpec: struct, ReceiveSpec: struct, zerosEndWavelengths: double = 3)

Configure the TGC compensation vector for EchoFrame reconstruction.

Input arguments:

  • ReconSpec

    (struct) –

    EchoFrame reconstruction specification; tgcVector field is set.

  • ReceiveSpec

    (struct) –

    EchoFrame receive specification; samples_per_wavelength and nSamplesIQ used.

  • options

    –

    Number of wavelengths to zero at the end of the TGC vector.

Output arguments:

  • ReconSpec

    ( struct ) –

    Updated reconstruction specification with tgcVector set.

configureTPC

Configure the transmit power controller (TPC) Verasonics structure.

Input arguments:

  • initialTransmitVoltage

    (double) –

    Initial transmit voltage at startup.

Output arguments:

  • struct –

    Transmit power controller Verasonics structure.

configureTransmitBeams

Configure the Verasonics transmit beam steering structure.

Input arguments:

  • TransmitSpec

    (struct) –

    EchoFrame transmit specification; apodization and planewaveOpeningAngle used.

  • Trans

    (struct) –

    Verasonics transducer structure.

  • Resource

    (struct) –

    Verasonics resource structure.

  • ReceiveSpec

    (struct) –

    EchoFrame receive specification; nTransmissions used.

Output arguments:

  • TX

    ( struct ) –

    Verasonics transmit beamforming structure array, one entry per steering angle.

Notes

Base workspace variables:

  • Resource (struct, write): Temporarily written to the base workspace for computeTXDelays, then cleared.
  • Trans (struct, write): Temporarily written to the base workspace for computeTXDelays, then cleared.

configureTransmitSpec

Configure the EchoFrame transmit specification struct.

Input arguments:

  • numElements

    (int) –

    Number of transducer elements.

  • txrxFrameRate

    (float) –

    TX/RX frame rate [Hz].

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • transmitPulseLength

    (int) –

    Transmit pulse length [half cycles].

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • aperturePercentage

    (float) –

    Transmit aperture percentage (0-100).

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • planewaveOpeningAngle

    (float) –

    Total steering angle range for plane waves [degrees].

    Danger

    This parameter affects acoustic safety. Do not change without understanding the acoustic safety implications.

  • c0

    (float) –

    Speed of sound [m/s].

Output arguments:

  • TransmitSpec

    ( struct ) –

    EchoFrame transmit specification.

configureTransmitWaveform

Configure the Verasonics transmit waveform structure.

Input arguments:

  • transmitFrequency

    (double) –

    Transmit frequency [Hz].

  • pulseLength

    (int) –

    Pulse length in half cycles.

Output arguments:

  • TW

    ( struct ) –

    Verasonics transmit waveform structure.

getCommonProcessFunctions

()

Configure standard external processing functions.

This function initializes a Process structure with four external processing functions used in most sequences:

  • Process(1) = effusive.vantage.enableRFTimeTagging should be used as the very first Event in the sequence and will enable RF time tagging.
  • Process(2) = effusive.rf.processRFEnsembleBlock runs echoframe_mex and writes results into FrameRuntimeState.
  • Process(3) = effusive.control.processRuntimeControl decodes napari commands and applies hardware/storage mutations.
  • Process(4) = effusive.rf.publishProcessedFrame writes display data to shared memory and emits timing reports.

Output arguments:

  • struct –

    Process struct initialized with the four process functions.

getCommonSequenceControl

Get standard sequence control commands.

This function initializes a SeqControl structure with four sequence control commands used in most sequences:

  • SeqControl(1): triggerOut.
  • SeqControl(2): timeToNextAcq, with argument transmitReceiveTimeMus.
  • SeqControl(3): returnToMatlab.
  • SeqControl(4): jump to first Event.

Input arguments:

  • transmitReceiveTimeMus

    (integer) –

    Time between two acquisition events, in microseconds ranging from 0 to 4190000.

Output arguments:

  • SeqControl

    ( struct ) –

    SeqControl struct initialized with the four control commands.

setTriggerOutEnabled

Enable or disable trigger-out on the trigger-out events.

Input arguments:

  • enabled

    (logical) –

    Desired trigger-out state for each buffer trigger-out event.

Output arguments:

  • didUpdate

    ( logical ) –

    True when the Event structure was changed and queued for update.