C++ API Reference¶
Caution
ARRUS C++ API is currently under development and its API will be modified in the future. Please expect breaking changes.
Notation¶
Class::Handleis a typedef forstd::unique_ptr<Class>Class::SharedHandleis a typedef forstd::shared_ptr<Class>
Session¶
-
ARRUS_CPP_EXPORT Session::Handle
arrus::session::createSession(const std::string &filepath)¶ Reads given configuration file and returns a handle to new session.
- Parameters
filepath – a path to session settings
- Returns
a unique handle to session
-
class
arrus::session::Session¶ A communication session with the device.
Public Types
-
enum class
State¶ Session state.
STOPPED: the session is stopped (no device is running).
STARTED: the session is started (at least one of the session devices is running).
CLOSED: the session was closed (the connection to all the session devices was closed).
Values:
-
enumerator
STOPPED¶
-
enumerator
STARTED¶
-
enumerator
CLOSED¶
Public Functions
-
virtual arrus::devices::Device *
getDevice(const std::string &deviceId) = 0¶ Returns a handle to device with given Id. The string format is: /DeviceType:Ordinal, e.g. “/Us4R:0”.
- Parameters
deviceId – device identifier
- Returns
a handle to the device
-
virtual arrus::devices::Device *
getDevice(const arrus::devices::DeviceId &deviceId) = 0¶ Returns a handle to device with given Id.
- Parameters
deviceId – device identifier
- Returns
a handle to the device
-
virtual UploadResult
upload(const ::arrus::ops::us4r::Scheme &scheme) = 0¶ Uploads a given scheme on the available devices.
Currently, the scheme upload is performed on the Us4R:0 device only.
After uploading a new sequence the previously returned output buffers will be in invalid state.
- Parameters
scheme – scheme to upload
- Returns
upload result information
-
virtual void
startScheme() = 0¶ Starts currently uploaded scheme.
-
virtual void
stopScheme() = 0¶ Stops currently uploaded scheme.
-
virtual void
run(bool sync = false, std::optional<long long> timeout = std::nullopt) = 0¶ Runs the uploaded scheme.
The behaviour of this method depends on the work mode:
MANUAL: triggers execution of batch of sequences only ONCE,
MANUAL_OP: triggers execution of a single TX/RX only ONCE,
HOST, ASYNC: triggers execution of batch of sequences IN A LOOP (Host: trigger is on buffer element release). The run function can be called only once (before the scheme is stopped).
- Parameters
sync – whether this method should work in a synchronous or asynchronous; true means synchronous, i.e. the caller will wait until the triggered TX/RX or sequence of TX/RXs has been done. The sync = true is only allowed when the work mode is set to MANUAL or MANUAL_OP. NOTE: For the US4R device, this method ONLY waits for the completion of the TX/RX sequence. Currently, it DOES NOT WAIT for the data transfer to the host PC or for the processing to finish — to wait for these two events, either wait for the final data using buffer.get(), or register your own callback function.
timeout – timeout [ms]; std::nullopt means to wait infinitely. This parameter is only relevant when sync = true; the value of this parameter only matters when work mode is set to MANUAL or MANUAL_OP
-
virtual void
close() = 0¶ Closes session.
This method disconnects with all the devices available during this session. Sets the state of the session to closed, any subsequent call to the object methods (e.g. upload, startScheme..) will result in InvalidStateException.
-
virtual State
getCurrentState() = 0¶ Returns the current state of the session. See also Session::State.
-
virtual UploadResult
setSubsequence(uint16 start, uint16 end, std::optional<float> sri, uint16 arrayId) = 0¶ Turns on the sequence with the arrayId and sets the TX/RXs to the [start, end) range. This method turns off all the uploaded TX/RX sequences except sequence pointed by
arrayId.This method requires that:
start < end (start == end would mean that the given sequence should bet turned off, and that would mean that all TX/RXs sequences should be turned off, which current does not make sense),
the scheme was uploaded,
the TX/RX sequence length is greater than the
endvalue,the scheme is stopped.
- Parameters
start – the TX/RX number which should now be the first TX/RX
end – the TX/RX number which should now be the last TX/RX
sri – the new SRI to apply
arrayId – id array to select, default: array with id 0
- Returns
the new data buffer and metadata
-
virtual UploadResult
setSubsequences(const std::vector<Slice> &slices, const std::vector<std::optional<float>> &sris) = 0¶ Selects [start, end) slices for each sub-sequence.
The
slicesarray should have exactly n elements, where n is the number of currently uploaded sequences. The element slice[i] sets the [start, end) range for the i-th sequence.The
srisshould have eactly n elements, or should be empty (which means that no additional sri should be applied).To turn off the given sequence, just set start equal to end (e.g. Slice(0, 0)). For such sequences, the metadata will
- Parameters
slices – slices to set to each Scheme sub-sequence
sris – sris to apply to each Scheme sub-sequence
- Returns
returns the buffer and metadata for the modified Scheme. The metadata array size is always equal to the number of seqeuences in the original Scheme
-
virtual bool
hasDevice(const std::string &deviceId) const = 0¶ Returns true if this session has been configured to work with the given device, otherwise false.
- Parameters
deviceId – device identifier
-
virtual bool
hasDevice(const arrus::devices::DeviceId &deviceId) const = 0¶ Returns true if this session has been configured to work with the given device, otherwise false.
- Parameters
deviceId – device identifier
-
enum class
Operations¶
Scheme¶
-
class
arrus::ops::us4r::Scheme¶ A scheme to be executed within the session.
Public Types
-
enum class
WorkMode¶ How the scheme should be executed on the us4r-lite device.
This enum value determines the source of the signal trigger (i.e. whether the signal is triggered by us4oem modules or host PC).
Values:
-
enumerator
ASYNC¶ Trigger generated by us4r, error on overflow.
-
enumerator
SYNC¶ Trigger generated by us4r, us4r waits on overflow
-
enumerator
HOST¶ Trigger generated by host, no error on overflow. DEPRECATED: will be replaced in the future by MANUAL mode
-
enumerator
MANUAL¶ New data acquisition and processing is manually triggered by user. The systems stops per sequence execution.
-
enumerator
MANUAL_OP¶ New data acquisition and processing is manually triggered by user. The systems stops per TX/RX execution.
-
enumerator
Public Functions
-
inline bool
isWorkModeManual() const¶ Returns true if the work mode is MANUAL (MANUAL per sequence or MANUAL_TX_RX (per TX/RX).
-
ARRUS_CPP_EXPORT
Scheme(TxRxSequence txRxSequence, uint16 rxBufferSize, const framework::DataBufferSpec &outputBuffer, WorkMode workMode, std::optional<DigitalDownConversion> ddc, const std::vector<arrus::framework::NdArray> &constants)¶ TODO(0.12.0) Deprecated: please use Scheme::create instead
-
ARRUS_CPP_EXPORT inline
Scheme(TxRxSequence txRxSequence, uint16 rxBufferSize, const framework::DataBufferSpec &outputBuffer, WorkMode workMode)¶ Scheme constructor. This scheme turns off hardware IQ demodulator. TODO(0.12.0) Deprecated: please use Scheme::create instead
- Parameters
txRxSequence – tx/rx sequence to perform
rxBufferSize – the size of the data acquisition buffer in the memory of the Us4R device (a single element of the buffer is an output of a single tx/rx sequence execution)
outputBuffer – output buffer specification
workMode – scheme work mode
-
ARRUS_CPP_EXPORT inline
Scheme(TxRxSequence txRxSequence, uint16 rxBufferSize, const framework::DataBufferSpec &outputBuffer, WorkMode workMode, DigitalDownConversion ddc)¶ Scheme constructor. This scheme turns on hardware IQ demodulator (sees digital down conversion parameter).
TODO(0.12.0) Deprecated: please use Scheme::create instead
- Parameters
txRxSequence – tx/rx sequence to perform
rxBufferSize – the size of the data acquisition buffer in the memory of the Us4R device (a single element of the buffer is an output of a single tx/rx sequence execution)
outputBuffer – output buffer specification
workMode – scheme work mode
digitalDownConversion – DDC parameters
-
ARRUS_CPP_EXPORT inline
Scheme(TxRxSequence txRxSequence, uint16 rxBufferSize, const framework::DataBufferSpec &outputBuffer, WorkMode workMode, const std::vector<framework::NdArray> &constants)¶ TODO(0.12.0) Deprecated: please use Scheme::create instead
-
ARRUS_CPP_EXPORT const TxRxSequence &
getTxRxSequence() const¶ TODO(0.12.0) Deprecated: please use getTxRxSequence(int ordinal) instead
-
enum class
-
class
arrus::framework::DataBufferSpec¶ Class describing output data buffer properties.
Public Functions
-
inline
DataBufferSpec(Type bufferType, const unsigned &nElements)¶ Data buffer specification constructor.
- Parameters
bufferType – buffer type
nElements – number of elements (a single element of the buffer is an output of a single tx/rx sequence execution)
-
inline
DataBufferSpec(Type bufferType, const unsigned &nElements, const ::arrus::devices::DeviceId &placement)¶ Data buffer specification constructor.
- Parameters
bufferType – buffer type
nElements – number of elements
placement – device on which the buffer should be allocated. Allowed values: (CPU, 0), (GPU, 0). Default: (CPU, 0).
-
inline unsigned
getNumberOfElements() const¶ Returns number of elements the buffer consists of.
-
inline const ::arrus::devices::DeviceId &
getPlacement() const¶ Returns the device on which the buffer is placed.
-
inline
Custom Tx/Rx sequences¶
-
class
arrus::ops::us4r::TxRxSequence¶ Public Functions
-
inline
TxRxSequence(std::vector<TxRx> sequence, TGCCurve tgcCurve, float sri = NO_SRI, int16 nRepeats = 1, std::string name = "")¶ Tx/Rx sequence to execute on Us4R device.
- Parameters
sequence – a list of tx/rxs that compose a given sequence
tgcCurve – tgc curve to apply
sri – sequence repetition interval - the total time that a given sequence should take.
nRepeats – - the number of repetitions of a given sequence. Determines the size of the batch
-
inline const std::optional<float>
getSri() const¶ Returns sequence repetition interval (the total time the given sequence should actually take). nullopt means that the frame acquisition time should be determined by total PRI only.
-
inline devices::DeviceId
getRxProbeId() const¶ Returns the ordinal number of the probe used for RX. If the RX probe is not-unique, this method will throw IllegalStateException.
-
inline devices::DeviceId
getTxProbeId() const¶ Returns the ordinal number of the probe used for RX. If the RX probe is not-unique, this method will throw IllegalStateException.
-
inline size_t
size() const¶ Returns the number of ops in the given TX/RX sequence.
-
inline const std::string &
getName() const¶ Returns the name of sequence.
-
inline
-
class
arrus::ops::us4r::Pulse¶ A single pulse (sine wave) produced by us4r device.
DEPRECATED: please use the arrus::ops::us4r::Waveform
Public Functions
-
inline
Pulse(float centerFrequency, float nPeriods, bool inverse, AmplitudeLevel amplitudeLevel = 2)¶ Pulse constructor.
- Parameters
centerFrequency – center frequency of the transmitted pulse
nPeriods – pulse number of periods, should be a multiple of 0.5
inverse – if set to true - inverse the pulse polarity
amplitudeLevel – amplitude level to use, default: 2 (HVM/P 0)
-
inline float
getPulseLength() const¶ Returns pulse duration [s].
Public Static Functions
-
static inline std::optional<Pulse>
fromWaveform(const Waveform &waveform)¶ Converts the input waveform to a pulse. The conversion is possible only when the structure of the waveform is conformant with the output of the toWaveform method — the nullopt is returned otherwise.
- Returns
pulse recovered from the input waveform or std::nullopt, if it was not possible to convert the waveform to the Pulse object
-
inline
-
class
arrus::ops::us4r::TxRx¶ A single tx/rx operation to perform.
-
class
arrus::ops::us4r::Tx¶ A single pulse transmission.
Public Functions
-
inline
Tx(std::vector<bool> aperture, std::vector<float> delays, const Pulse &pulse, devices::DeviceId placement)¶ Tx constructor.
- Parameters
aperture – transmit aperture specified as a bit mask; aperture[i] means that the i-th channel should be turned on
delays – transmit delays to apply; delays[i] applies to channel i
pulse – pulse to transmit @parma placement probe on which the Tx should be performed
-
inline std::vector<float>
getDelaysApertureOnly() const¶ Returns an array with delays for active (i.e. aperture[i] = true) channels only.
-
template<typename
T>
inline std::vector<float>limitToApertureOnly(const std::vector<T> &values) const¶ Returns an array with delays for active (i.e. aperture[i] = true) channels only.
-
inline bool
isNOP() const¶ Returns true if this operator does not perform TX at all (i.e. aperture is set to false).
-
inline
-
class
arrus::ops::us4r::Rx¶ An operation that performs a single data reception (Rx).
Public Functions
-
inline
Rx(std::vector<bool> aperture, std::pair<unsigned int, unsigned int> sampleRange, unsigned int downsamplingFactor = 1, std::pair<unsigned short, unsigned short> padding = {(ChannelIdx)0, (ChannelIdx)0}, devices::DeviceId placement = devices::DeviceId(devices::DeviceType::Probe, 0))¶ Rx constructor.
- Parameters
aperture – receive aperture to use; aperture[i] = true means that the i-th channel should be turned on
rxSampleRange – [start, end) range of samples to acquire, starts from 0
downsamplingFactor – the factor by which the sampling frequency should be divided, an integer
placement – probe on which the RX should be performed.
-
inline
-
class
arrus::ops::us4r::TxRxSequence Public Functions
-
inline
TxRxSequence(std::vector<TxRx> sequence, TGCCurve tgcCurve, float sri = NO_SRI, int16 nRepeats = 1, std::string name = "") Tx/Rx sequence to execute on Us4R device.
- Parameters
sequence – a list of tx/rxs that compose a given sequence
tgcCurve – tgc curve to apply
sri – sequence repetition interval - the total time that a given sequence should take.
nRepeats – - the number of repetitions of a given sequence. Determines the size of the batch
-
inline const std::vector<TxRx> &
getOps() const Returns vector of operations to perform.
-
inline const TGCCurve &
getTgcCurve() const Initial TGC curve points.
-
inline const std::optional<float>
getSri() const Returns sequence repetition interval (the total time the given sequence should actually take). nullopt means that the frame acquisition time should be determined by total PRI only.
-
inline devices::DeviceId
getRxProbeId() const Returns the ordinal number of the probe used for RX. If the RX probe is not-unique, this method will throw IllegalStateException.
-
inline devices::DeviceId
getTxProbeId() const Returns the ordinal number of the probe used for RX. If the RX probe is not-unique, this method will throw IllegalStateException.
-
inline size_t
size() const Returns the number of ops in the given TX/RX sequence.
-
inline const std::string &
getName() const Returns the name of sequence.
-
inline
-
class
arrus::ops::us4r::DigitalDownConversion¶ Public Functions
-
inline
DigitalDownConversion(float demodulationFrequency, std::vector<float> firCoefficients, float decimationFactor, float gain = 12.0)¶ Us4R Digital Down Conversion block.
Note: the decimation factor can also have a fractional part: 0.25, 0.5 or 0.75.
Note: the FIR filter order (i.e. total number of taps)depends on the decimation factor and should be equal: decimationFactor*16 for integer decimation factor; decimationFactor*32 for decimation factor with fractional part 0.5; decimationFactor*64 for decimation facator with fractional part 0.25 or 0.75.
Note: only a upper half of the FIR filter coefficients should be provided.
- Parameters
demodulationFrequency – demodulation frequency to apply [Hz]
firCoefficients – FIR filter coefficients to apply
decimationFactor – decimation factor to apply, should be in range [2, 63]
gain – an extra digital gain to apply (after decimation filter), by default set to 12 dB. Currently only 0 and 12 dB are supported [dB]
-
float
getGain() const¶ Returns an extra digital gain to apply (after the decimation filter).
-
inline
-
using
arrus::ops::us4r::TGCCurve= std::vector<TGCSampleValue>¶ TGC curve to apply on the us4r device.
-
class
Waveform¶ A complete Tx waveform to be applied on the ultrasound pulsers.
NOTE: please use WaveformBuilder class to create new TX Waveforms (avoid constructing objects of this class directly).
- Parameters
segments – subsequent segments of the waveform
nRepetitions – how many times the segments[i] should be repeated
-
class
WaveformSegment¶ Us4R TX waveform segment.
WaveformSegment is a part of the TX waveform, that can be repated multiple times.
The duration[i] is the duration of the i-th state, i.e. state[i].
- Parameters
state – the sequence of of states, one of the following values: -2 (HVM0), -1 (HVM1), 0 (CLAMP), 1 (HVP1), 2 (HVP0)
duration – the duration of the i-th state [seconds]
Devices¶
-
class
arrus::devices::Us4R: public arrus::devices::Ultrasound, public arrus::devices::DeviceWithComponents¶ Us4R system: a group of Us4OEM modules and related components.
By default system starts with IQ demodulator turned off.
Public Functions
-
virtual Us4OEM *
getUs4OEM(Ordinal ordinal) = 0¶ Returns a handle to Us4OEM identified by given ordinal number.
- Parameters
ordinal – ordinal number of the us4oem to get
- Returns
a handle to the us4oem module
-
virtual void
setVoltage(unsigned char voltage) = 0¶ Sets HV voltage.
The voltage is set for the TX amplitude 2 (rail 0).
- Parameters
voltage – voltage to set [V]
-
virtual void
setVoltage(const std::vector<HVVoltage> &voltages) = 0¶ Sets HV voltage. The input vector describes what voltages should be set for each tx voltage level (rail).
voltages[0] are for the TX amplitude/state 1 (-/+), voltage[1] are for TX amplitude/state level 2 and so on.
For the legacy systems (using e.g. the legacy HV256 or us4rPSC) this method expects a list of voltages {0, -/+ voltage}.
- Parameters
voltages – voltages to set [V]
-
virtual unsigned char
getVoltage() = 0¶ Returns configured HV voltage.
- Returns
hv voltage value configured on device [V]
-
virtual float
getMeasuredPVoltage() = 0¶ Returns measured HV voltage (plus).
- Returns
hv voltage measured by device [V]
-
virtual float
getMeasuredMVoltage() = 0¶ Returns measured HV voltage (minus).
- Returns
hv voltage measured by devivce [V]
-
virtual float
getMeasuredHVPVoltage(uint8_t oemId) = 0¶ Gets positive HV voltage measurement by UCD chip on OEM.
- Parameters
oemId – OEM ID
- Returns
positive HV voltage UCD measurement [V]
-
virtual float
getMeasuredHVMVoltage(uint8_t oemId) = 0¶ Gets negative HV voltage measurement by UCD chip on OEM.
- Parameters
oemId – OEM ID
- Returns
negative HV voltage UCD measurement [V]
-
virtual void
disableHV() = 0¶ Disables HV voltage.
-
virtual void
setTgcCurve(const std::vector<float> &tgcCurvePoints) = 0¶ Equivalent to setTgcCurve(curve, true).
-
virtual void
setTgcCurve(const std::vector<float> &tgcCurvePoints, bool applyCharacteristic, bool clip = false) = 0¶ Sets TGC curve points asynchronously.
Setting empty vector turns off analog TGC. Setting non-empty vector turns off DTGC and turns on analog TGC.
TGC curve can have up to 1022 samples.
- Parameters
tgcCurvePoints – tgc curve points to set (gain [dB])
applyCharacteristic – set it to true if you want to compensate response characteristic (pre-computed by us4us). If true, LNA and PGA gains should be set to 24 an 30 dB, respectively, otherwise an arrus::IllegalArgumentException will be thrown.
clip – set it true if you would like to get TGC clipped to the min/max possible gain value; otherwise, an IllegalArgumentException will be raised with message that the maximum possible gain value (resulting from amplifier settings such as LNA and PGA) is exceeded.
-
virtual void
setTgcCurve(const std::vector<float> &t, const std::vector<float> &y, bool applyCharacteristic, bool clip = false) = 0¶ Sets TGC curve points asynchronously.
Setting empty vectors t and y turns off analog TGC. Setting non-empty vector turns off DTGC and turns on analog TGC.
Vectors t and y should have exactly the same size. The input t and y values will be interpolated into target hardware sampling points (according to getCurrentSamplingFrequency and getCurrentTgcPoints). Linear interpolation will be performed, the TGC curve will be extrapolated with the first (left-side of the cure) and the last sample (right side of the curve).
NOTE: TGC curve can have up to 1022 samples.
- Parameters
t – sampling time, relative to the “sample 0”
y – gain values to apply at given sampling time [dB]
applyCharacteristic – set it to true if you want to compensate response characteristic (pre-computed by us4us). If true, LNA and PGA gains should be set to 24 an 30 dB, respectively, otherwise an arrus::IllegalArgumentException will be thrown.
clip – set it true if you would like to get TGC clipped to the min/max possible gain value; otherwise, an IllegalArgumentException will be raised with message that the maximum possible gain value (resulting from amplifier settings such as LNA and PGA) is exceeded.
-
virtual std::vector<float>
getTgcCurvePoints(float maxT) const = 0¶ Returns us4R TGC sampling points (along time axis, relative to the “sample 0”), up to given maximum time.
- Parameters
maxT – maximum time range
- Returns
TGC time points at which TGC curve sample takes place
-
virtual void
setVcat(const std::vector<float> &t, const std::vector<float> &y, bool applyCharacteristic, bool clip = false) = 0¶ Sets VCAT time points asynchronously.
Setting empty vectors t and y turns off analog TGC. Setting non-empty vector turns off DTGC and turns on analog TGC.
Vectors t and y should have exactly the same size. The input t and y values will be interpolated into target hardware sampling points (according to getCurrentSamplingFrequency and getCurrentTgcPoints). Linear interpolation will be performed, the TGC curve will be extrapolated with the first (left-side of the cure) and the last sample (right side of the curve).
NOTE: the curve can have up to 1022 samples.
- Parameters
t – sampling time, relative to the “sample 0”
y – attenuation values to apply at given sampling time [dB]
applyCharacteristic – set it to true if you want to compensate response characteristic (pre-computed by us4us). If true, LNA and PGA gains should be set to 24 an 30 dB, respectively, otherwise an arrus::IllegalArgumentException will be thrown.
clip – set it true if you would like to get TGC clipped to the min/max possible gain value; otherwise, an IllegalArgumentException will be raised with message that the maximum possible gain value (resulting from amplifier settings such as LNA and PGA) is exceeded.
-
virtual void
setVcat(const std::vector<float> &tgcCurvePoints) = 0¶ Equivalent to setVcat(curve, true, false).
-
virtual void
setVcat(const std::vector<float> &tgcCurvePoints, bool applyCharacteristic, bool clip = false) = 0¶ Sets VCAT points asynchronously.
Setting empty vector turns off analog TGC. Setting non-empty vector turns off DTGC and turns on analog TGC.
The curve can have up to 1022 samples.
- Parameters
tgcCurvePoints – tgc curve points to set (gain [dB])
applyCharacteristic – set it to true if you want to compensate response characteristic (pre-computed by us4us). If true, LNA and PGA gains should be set to 24 an 30 dB, respectively, otherwise an arrus::IllegalArgumentException will be thrown.
clip – set it true if you would like to get TGC clipped to the min/max possible gain value; otherwise, an IllegalArgumentException will be raised with message that the maximum possible gain value (resulting from amplifier settings such as LNA and PGA) is exceeded.
-
virtual void
setPgaGain(uint16 value) = 0¶ Sets PGA gain.
See docs of arrus::devices::RxSettings for more information.
-
virtual uint16
getPgaGain() = 0¶ Returns the current PGA gain value.
See docs of arrus::devices::RxSettings for more information.
-
virtual void
setLnaGain(uint16 value) = 0¶ Sets LNA gain.
See docs of arrus::devices::RxSettings for more information.
-
virtual uint16
getLnaGain() = 0¶ Returns the current LNA gain value.
See docs of arrus::devices::RxSettings for more information.
-
virtual void
setLpfCutoff(uint32 value) = 0¶ Sets LPF cutoff.
See docs of arrus::devices::RxSettings for more information.
-
virtual void
setDtgcAttenuation(std::optional<uint16> value) = 0¶ Sets DTGC attenuation.
See docs of arrus::devices::RxSettings for more information.
-
virtual void
setActiveTermination(std::optional<uint16> value) = 0¶ Sets active termination.
See docs of arrus::devices::RxSettings for more information.
-
virtual void
setRxSettings(const RxSettings &settings) = 0¶ Sets a complete list of RxSettings on all Us4R components.
- Parameters
settings – settings to apply
-
virtual void
setTestPattern(Us4OEM::RxTestPattern pattern) = 0¶ If active is true, turns off probe’s RX data acquisition and turns on test patterns generation. Otherwise turns off test patterns generation and turns on probe’s RX data acquisition.
-
virtual void
trigger(bool sync, std::optional<long long> timeout) override = 0¶ Trigger a single run of the current work mode (TX/RX in case of workMode=MANUAL_OP, sequence of TX/RXs in other cases).
- Parameters
sync – whether this method should work in a synchronous or asynchronous; true means synchronous, i.e. the caller will wait until the triggered TX/RX or sequence of TX/RXs has been done.
timeout – timeout [ms]; std::nullopt means to wait infinitely. This parameter is only relevant when sync = true.
-
virtual void
sync(std::optional<long long> timeout) override = 0¶ Synchronization point with us4R system. After returning from this method, the last “TX/RX” (triggered by the trigger method will be fully executed by the system.
Sync with “SEQ_IRQ” interrupt (i.e. wait until the SEQ IRQ will occur).
- Parameters
timeout – timeout in number of milliseconds
-
virtual uint8_t
getNumberOfUs4OEMs() = 0¶ Returns the number of us4OEM modules that are used in this us4R system.
-
virtual int
getNumberOfProbes() const override = 0¶ Returns the number of probes that are connected to the system.
-
virtual float
getSamplingFrequency() const override = 0¶ Returns NOMINAL us4R device sampling frequency.
-
virtual float
getCurrentSamplingFrequency() const override = 0¶ Returns the sampling frequency with which data from us4R will be acquired. The returned value depends on the result of sequence upload (e.g. DDC decimation factor).
-
virtual void
checkState() const = 0¶ Checks state of the Us4R device. Currently checks if each us4OEM module is in the correct state.
- Throws
arrus::IllegalStateException – when some inconsistent state was detected
-
virtual void
setStopOnOverflow(bool isStopOnOverflow) = 0¶ Set the system to stop when (RX or host) buffer overflow is detected.
This property is set by default to true.
- Parameters
isStopOnOverflow – whether the system should stop when buffer overflow is detected.
-
virtual bool
isStopOnOverflow() const = 0¶ Returns true if the system will be stopped when (RX of host) buffer overflow is detected.
This property is set by default to true.
- Parameters
isStopOnOverflow – whether the system should stop when buffer overflow is detected.
-
virtual void
setLnaHpfCornerFrequency(uint32_t frequency) = 0¶ Enables LNA analog high-pass filter and sets a given corner frequency.
- Parameters
frequency – LNA high-pass filter corner frequency to set
-
virtual void
setHpfCornerFrequency(uint32_t frequency) = 0¶ Enables ADC high-pass filter and sets a given corner frequency.
Note: this method is just an alias for setAdcHpfCornerFrequency.
- Parameters
frequency – high-pass filter corner frequency to set
-
virtual void
disableLnaHpf() = 0¶ Disables LNA analog high-pass filter.
-
virtual void
disableHpf() = 0¶ Disables ADC high-pass filter.
Note: this method is just an alias for setAdcHpfCornerFrequency.
-
virtual void
setAdcHpfCornerFrequency(uint32_t frequency) = 0¶ Enables ADC digital high-pass filter and sets a given corner frequency.
- Parameters
frequency – ADC high-pass filter corner frequency to set
-
virtual void
disableAdcHpf() = 0¶ Disables ADC digital high-pass filter.
-
virtual uint16_t
getAfe(uint8_t reg) = 0¶ Reads AFE register
- Parameters
reg – register address
-
virtual void
setAfe(uint8_t reg, uint16_t val) = 0¶ Writes AFE register
- Parameters
reg – register address
val – register value
-
virtual const char *
getBackplaneSerialNumber() = 0¶ Returns serial number of the backplane (if available).
-
virtual const char *
getBackplaneRevision() = 0¶ Returns serial number of the backplane (if available).
-
virtual const char *
getBackplaneFirmwareVersion() = 0¶ Returns firmware version number of the backplane (if available).
-
virtual std::pair<std::shared_ptr<framework::Buffer>, std::vector<std::shared_ptr<session::Metadata>>>
setSubsequences(const std::vector<Slice> &slices, const std::vector<std::optional<float>> &sris) = 0¶ Selects [start, end) slices for each sub-sequence.
The
slicesarray should have exactly n elements, where n is the number of currently uploaded sequences. The element slice[i] sets the [start, end) range for the i-th sequence.The
srisshould have eactly n elements, or should be empty (which means that no additional sri should be applied).To turn off the given sequence, just set start equal to end (e.g. Slice(0, 0)). For such sequences, the metadata will describe only empty data (dummy metadata).
- Parameters
slices – slices to set to each Scheme sub-sequence
sris – sris to apply to each Scheme sub-sequence
- Returns
returns the buffer and metadata for the modified Scheme. The metadata array size is always equal to the number of seqeuences in the original Scheme
-
virtual Probe *
getProbe(Ordinal ordinal) override = 0¶ Returns probe identified by given ordinal number.
- Parameters
ordinal – ordinal number of the probe to get
- Returns
probe handle
-
virtual void
setMaximumPulseLength(std::optional<float> maxLength) = 0¶ Sets maximum pulse length that can be set during the TX/RX sequence programming FOR THE AMPLITUDE 2 / RAIL HV 0.
NOTE this method is intended to be used only for the probe health check! DO NOT USE THIS METHOD TO SET THE MAXIMUM TX PULSE LENGTH e.g. FOR THE IMAGING PURPOSES.
std::nullopt means to use up to 32 TX cycles.
- Parameters
maxLength – maximum pulse length (s) nullopt means to use 32 TX cycles (legacy OEM constraint)
-
virtual float
getActualTxFrequency(float frequency) = 0¶ Return the system TX frequency that would be actually set for the given TX frequency. The output frequency depends on the frequency discretization performed by the driver.
- Parameters
frequency – input frequency
- Returns
the actual frequency that will be set
-
virtual float
getMinimumTGCValue() const = 0¶ Returns minimum available TGC value, according to the currently set parameters.
-
virtual float
getMaximumTGCValue() const = 0¶ Returns maximum available TGC value, according to the currently set parameters.
-
virtual void
disableAllHpf() = 0¶ Disables all high-pass filters on the device.
-
virtual std::vector<int64_t>
getHVPSTuningInfo() = 0¶ Returns HVPS tuning info (unix format timestamps (number of seconds) for each OEM if previously tuned)
-
virtual Us4OEM *
-
class
arrus::devices::Us4RSettings¶ Us4R device settings.
- Parameters
probeAdapterSettings – Probe adapter settings. Optional - when not set, at least one Us4OEMSettings must be set. When is set, the list of Us4OEM settings should be empty.
probeSettings – List of ProbeSettings to set. Optional - when is set, ProbeAdapterSettings also
rxSettings – initial RX (AFE) settings
hvSettings – high-voltage supplier settings, Optional (us4r devices may have externally controlled hv suppliers).
channelsMask – A set of channels that should be turned off in the us4r system. This is list of lists; each list represents what channels of the ultrasound interface (probe) should be turned off. channelsMask[i] is a channels mask for the i-th probe (Probe:i). Note that the **channel numbers start from 0
reprogrammingMode – reprogramming mode applied to all us4OEMs. See Us4OEMSettings::ReprogrammingMode docs for more information.
nUs4OEMs – number of us4OEMs in the us4R system. Optional, if is std::nullopt, the number of us4oems is determined based on the probe adapter mapping (equal to the maximum ordinal number of us4OEM). Optional, if set to std::nullopt, the number of us4OEMs will be determined based on the probe adapter mapping (as the maximum of us4OEM module ordinal numbers).
adapterToUs4RModuleNumber – The mapping from the us4OEM ordinal number in the probe adapter mapping and the actual ordinal number of us4OEM. Optional, empty vector means that no mapping should be applied (identity mapping).
externalTrigger – whether the external trigger (TRIG INPUT) should be enabled
txFrequencyRange – Transmit frequency range to set on us4OEM devices. Actually, TX frequency divider.
digitalBackplaneSettings – digital backplane (“DBAR”) settings. If not provided, the software will try to determine DBAR model based on select HV supplier.
bitstreams – us4OEM I/O bitstream definitions
limits – TX/RX constraints to apply on the system (e.g. minimum/maximum voltage, etc.).
watchdogSettings – us4OEM+ watchdog settings.
allowDuplicateOEMIds – whether we should allow to run system with duplicate OEM ids (e.g. due to connectivity issues).
hvpsFuseSettings – HVPS fuse settings to use; nullopt means that the default settings should be used
Public Functions
-
inline std::optional<ProbeSettings>
getProbeSettings() const¶ Returns probe settings for probe 0.
-
inline const std::unordered_set<ChannelIdx> &
getChannelsMask() const¶ Returns channels mask to be applied for Probe:0 TX/RX apertures.
DEPRECATED (since v0.11.0): please use getChannelsMask(probeNr).
-
class
arrus::devices::ProbeAdapterSettings¶ These settings let you define a custom probe adapter.
The probe adapter settings let you specify the us4OEM - probe adapter channel mapping, adapter IO capabilities, etc.
Public Functions
-
inline
ProbeAdapterSettings(ProbeAdapterModelId modelId, ChannelIdx nChannels, const ChannelMapping &mapping, us4r::IOSettings ioSettings = us4r::IOSettings())¶ Probe adapter settings.
- Parameters
modelId – probe adapter model Id
nChannels – how many output channels this adapter has
mapping – us4OEM - adapter channel mapping. The i-th element of mapping determines which us4OEM and us4OEM channel is connected to the i-th adapter channel
ioSettings – adapter IO capabilities (default: no I/O in use)
-
inline
-
class
arrus::devices::ProbeSettings¶ Public Functions
-
inline
ProbeSettings(ProbeModel model, std::vector<ChannelIdx> channelMapping)¶ Probe settings.
- Parameters
model – probe model specification
channelMapping – flattened channel mappings. For 2-D array channel mapping is row major order.
-
inline
-
class
IOSettings¶ Us4R IO settings (capabilities, etc.).
This class specifies the mapping from IO address (IO ordinal number) to IO capability.
Please use IOSettingsBuilder to create an instance of this class.
-
class
arrus::devices::us4r::IOSettingsBuilder¶ IO Settings builder.
Public Functions
-
inline IOSettingsBuilder &
setProbeConnectedCheckCapability(const IOAddressSet &addresses)¶ Assigns probe-connected check capability to the given (us4OEM, IO number).
-
inline IOSettingsBuilder &
setFrameMetadataCapability(const IOAddressSet &addresses)¶ Assigns frame-metadata capability to the given (us4OEM, IO number).
NOTE: frame-metadata capability (e.g. external encoder metadata) requires us4OEM custom firmware.
-
inline IOSettings
build()¶ Builds the IOSettings for the selected IO - capability mappings.
-
inline IOSettingsBuilder &
-
enum class
arrus::devices::us4r::IOCapability¶ Us4R IO capability.
Values:
-
enumerator
PROBE_CONNECTED_CHECK¶ Probe-connected check capability. This capability configures us4OEMs to react (stop the system, turn off HV) when there is no connection between the us4R system and the dedicated probe pin (“the probe is not connected”).
-
enumerator
FRAME_METADATA¶ Frame metadata capability (e.g. external signal encoder in frame metadata). NOTE: this capability requires a custom firmware development, dedicated to the target application.
-
enumerator
-
class
Us4RTxRxLimits¶ Custom TX/RX limits to be applied on the TX/RX sequence validation. NOTE: all the values are optional; nullopt means that the default value for a given us4OEM revision will be used.
-
class
us4us::us4r::RxSettings¶ AFE (RX) settings.
NOTE: to create the instance of this object please use the RxSettingsBuilder.
Us4R AFE settings currently includes: AFE 58JD18:
DTGC attenuation, available: 0, 6, 12, 18, 24, 30, 36, 42 [dB] or std::nullopt; nullopt turns off DTGC.
LNA gain, available: 12, 18, 24 [dB].
PGA gain, available: 24, 30 [dB].
TGC samples: analog TGC curve samples [dB]. Up to 1022 samples. TGC samples should be in range [min, max](closed interval) where min = (lna gain + pga gain)-36, and max = (lna gain, pga gain). Empty list turns off analog TGC.
Active termination, available: 50, 100, 200, 400 [Ohm] or std::nullopt. null opt turns off active termination
LPF cutoff, available: 10000000, 15000000, 20000000, 30000000, 35000000, 50000000 [Hz].
applyTgcCharacteristic: whether to apply pre-computed (by us4us) TGC response characteristic, so that the observed gain better corresponds to the applied one.
Constraints:
only one of the following can be turned on: DTGC or analog TGC.
when applyTgcCharacteristic == true, LNA and PGA gain has to be (current limitation of the selected TGC characteristic).
Public Functions
-
inline
RxSettings(const std::optional<uint16_t> &dtgcAttenuation, uint16_t pgaGain, uint16_t lnaGain, std::vector<float> tgcSamples, uint32_t lpfCutoff, const std::optional<uint16_t> &activeTermination, bool applyTgcCharacteristic = true)¶ Creates RX settings for the given parameters.
- Deprecated:
will be removed in ARRUS 0.15.0, please use RxSettingsBuilder instead.
Public Static Functions
-
static inline std::pair<float, float>
getTgcMinMax(uint16_t pgaGain, uint16_t lnaGain, float attenuationRange = RxSettings::AFE58JD18_TGC_ATTENUATION_RANGE)¶ A helper function that computes a pair of (min, max) acceptable analog TGC gain for given PGA and LNA gain values.
NOTE: this method assumes that AFE58JD18 device is used (65 MHz sampling frequency). For OEM+HF (120 MHz), please use AFE58JD48_TGC_ATTENUATION_RANGE.
- Parameters
pgaGain – PGA gain value to consider
lnaGain – LNA gain value to consider
attenuationRange – AFE attenuation range, by default 65 MHz OEM attenuation range is assumed (AFE58JD18).
- Returns
a pair (min, max) acceptable sample value.
-
class
RxSettingsBuilder¶ RxSettings builder.
-
class
WatchdogSettings¶ us4OEM+ watchdog settings.
You can disable us4OEM watchdog settings using WatchdogSettings::disabled().
- Parameters
oemThreshold0 – How long can the host remain unresponsive before the OEM sends a warning interrupt [s]
oemThreshold1 – How long can the host remain unresponsive before the OEM turns off [s]
hostThreshold – How long can the OEM can remain unresponsive before the host stops the current TX/RX sequence [s]
-
class
arrus::devices::Us4OEMSettings¶ Us4OEM settings.
Contains all raw parameters used to configure module.
Public Types
-
enum class
ReprogrammingMode¶ Determines when the us4OEM FPGA reprogramming starts.
SEQUENTIAL: Us4OEM FPGA reprogramming starts after signal data acquisition is ended. Total TX/RX time: rx time + reprogramming time. Total TX/RX time determines possible maximum PRF. This mode minimizes signal noise at the expense of additional reprogramming time (which decreases available PRF).
PARALLEL: Us4OEM FPGA reprogramming for the next TX starts when the the current TX is triggered; both processes (reprogramming for the next TX/RX and current TX/RX) are done in parallel. Total TX/RX time: max(rx time, reprogramming time). Total TX/RX time determines possible maximum PRF. This mode maximizes the possible PRF at the expense of additional noise that may appear at the beginning of the data (emitted during the FPGA reprogramming).
Values:
-
enumerator
SEQUENTIAL¶
-
enumerator
PARALLEL¶
-
enumerator
Public Functions
-
inline
Us4OEMSettings(ChannelMapping channelMapping, RxSettings rxSettings, ReprogrammingMode reprogrammingMode = ReprogrammingMode::SEQUENTIAL, int txFrequencyRange = 1)¶ Us4OEM Settings constructor.
- Parameters
channelMapping – channel permutation to apply on a given Us4OEM. channelMapping[i] = j, where
iis the virtual(logical) channel number,jis the physical channel number.rxSettings – initial rx settings to apply
reprogrammingMode – us4OEM reprogramming mode
txFrequencyRange – tx frequency range, actually: tx frequency divider, by default 1 is used.
-
enum class
-
class
arrus::devices::Us4OEM: public arrus::devices::Device, public arrus::devices::TriggerGenerator¶ Public Types
Public Functions
-
virtual float
getSamplingFrequency() = 0¶ Returns nominal sampling frequency on the us4OEM device.
-
virtual float
getCurrentSamplingFrequency() const = 0¶ Returns current sampling frequency of the us4OEM device.
-
virtual float
getUCDExternalTemperature() = 0¶ Returns external temperature measured by Us4OEM’s UCD [Celsius]
-
virtual float
getUCDMeasuredVoltage(uint8_t rail) = 0¶ Returns rail voltage measured by Us4OEM’s UCD [V].
- Parameters
rail – UCD rail number
-
virtual float
getMeasuredHVPVoltage() = 0¶ Returns rail voltage measured by Us4OEM’s UCD [V].
- Parameters
rail – UCD rail number
-
virtual float
getMeasuredHVMVoltage() = 0¶ Returns rail voltage measured by Us4OEM’s UCD [V].
- Parameters
rail – UCD rail number
-
virtual uint16_t
getAfe(uint8_t address) = 0¶ Reads AFE register
- Parameters
address – register address
- Throws
arrus::IllegalStateException – when invalid input parameters detected
- Returns
: register value
-
virtual void
setAfe(uint8_t address, uint16_t value) = 0¶ Writes AFE register
- Parameters
address – register address
value – register value
- Throws
arrus::IllegalStateException – when invalid input parameters detected
-
virtual void
setAfeDemod(float demodulationFrequency, float decimationFactor, const float *firCoefficients, size_t nCoefficients, float gain = 12) = 0¶ Enables and configures AFE built-in demodulator
- Parameters
demodulationFrequency – Demodulation frequency
decimationFactor – Decimation factor
firCoefficients – Pointer to Low pass filter coefficients buffer
nCoefficients – Number of FIR coefficients
gain – an extra digital gain to apply (after decimation filter), by default set to 12 dB. Currently only 0 and 12 dB are supported [dB]
- Throws
arrus::IllegalStateException – when invalid input parameters detected
-
virtual void
disableAfeDemod() = 0¶ Disables AFE built-in demodulator
-
virtual void
checkFirmwareVersion() = 0¶ Checks if the firmware version on the Us4OEM module is correct.
- Throws
arrus::IllegalStateException – when the incorrect version was detected.
-
virtual void
checkState() = 0¶ Checks if the us4OEM is in the correct state (as seen by host PC).
Note: currently only the firmware version is checked (to verify if the us4OEM module memory space is still available for the us4OEM module).
- Throws
arrus::IllegalStateException – when the incorrect version was detected.
-
virtual uint32
getFirmwareVersion() = 0¶ Returns firmware version installed on the us4OEM module.
-
virtual uint32
getTxFirmwareVersion() = 0¶ Returns Tx component firmware version installed on this us4OEM module.
-
virtual uint32_t
getOemVersion() = 0¶ Returns OEM version (OEM/OEM+)
-
virtual uint64_t
getFPGAWallclock() = 0¶ Returns current FPGA wall clock (time passed since Init function was called).
- Returns
FPGA wall clock (clock ticks)
-
virtual void
setLnaHpfCornerFrequency(uint32_t frequency) = 0¶ Enables LNA analog high-pass filter and sets a given corner frequency.
- Parameters
frequency – LNA high-pass filter corner frequency to set
-
virtual void
disableLnaHpf() = 0¶ Disables LNA analog high-pass filter.
-
virtual void
setAdcHpfCornerFrequency(uint32_t frequency) = 0¶ Enables ADC digital high-pass filter and sets a given corner frequency.
- Parameters
frequency – ADC high-pass filter corner frequency to set
-
virtual void
disableAdcHpf() = 0¶ Disables ADC digital high-pass filter.
-
virtual const char *
getSerialNumber() = 0¶ Returns serial number of this us4OEM (a null-terminated string).
-
virtual const char *
getRevision() = 0¶ Returns revision number of this us4OEM (a null-terminated string).
-
virtual HVPSMeasurement
getHVPSMeasurement() = 0¶ Returns HVPS ADC measurements
-
virtual float
setHVPSSyncMeasurement(uint16_t nSamples, float frequency) = 0¶ Configures HVPS voltage/current measurement in Sync mode.
:param nSamples: number of ADC samples to acquire. :param frequency: Requested sampling frequency. :return: Actual sampling frequency
-
virtual void
setWaitForHVPSMeasurementDone() = 0¶ Configures the system to sync with the HVPS Measurement done irq. This method is intended to be used in the probe_check implementation.
-
virtual void
waitForHVPSMeasurementDone(std::optional<long long> timeout) = 0¶ Waits for the HVPS Measurement done irq. This method is intended to be used in the probe_check implementation.
-
virtual float
getActualTxFrequency(float frequency) = 0¶ Return the system TX frequency that would be actually set for the given TX frequency. The output frequency depends on the frequency discretization performed by the driver.
- Parameters
frequency – input frequency
- Returns
the actual frequency that will be set
-
virtual int64_t
getHVPSTuningInfo() = 0¶ Returns HVPS tuning info (timestamp if previously tuned)
-
virtual Variant
getVariant() = 0¶ Returns the variant of OEM.
-
virtual float
-
class
arrus::devices::HVVoltage¶ HV voltage curve description. Can be specified only by voltage negative and positive amplitude values.
Public Functions
-
inline
HVVoltage(const Voltage voltageMinus, const Voltage voltagePlus)¶ HV Voltage constructor.
- Parameters
voltageMinus – negative voltage to set [V]
voltagePlus – positive voltage to set [V]
-
inline
Output data¶
An instance of the following class is returned by the sesion.upload function:
-
class
arrus::session::UploadResult¶ Scheme upload result.
Public Functions
-
inline const std::shared_ptr<framework::Buffer> &
getBuffer() const¶ Returns a pointer to the ouptput data buffer.
-
inline const std::shared_ptr<framework::Buffer> &
Upload result can include some additional information (metadata) about the acquired data:
-
class
arrus::session::Metadata¶ A container for all information related to the acquired data.
Currently it is assumed, that the values stored in this class won’t change during system run (is constant).
Public Functions
Returns metadata for the given key.
- Template Parameters
T – output type
- Parameters
key – metadata key
- Returns
metadata value for given key
Currently uploading scheme for the Us4R device returns a metadata with a
key frameChannelMapping; the metadata value type is:
-
class
arrus::devices::FrameChannelMapping¶ Frame channel mapping: logical (frame, channel) -> physical (frame, channel)
Public Functions
-
virtual FrameChannelMappingAddress
getLogical(FrameNumber frame, ChannelIdx channel) const = 0¶ Returns us4oem module number, physical frame number and channel number for a given, logical, frame number and an rx aperture channel.
- Parameters
frame – logical frame number
channel – logical channel number
- Returns
a tuple: us4oem module number, frame number (within a single sequence), channel number
-
virtual arrus::uint32
getFirstFrame(arrus::uint8 us4oem) const = 0¶ Returns the number of frame where the given us4OEM data starts. The frame number is computed taking into account the batch size and the number of frames in the sequence of data produced by preceding us4OEM modules. That is, assuming the same number of samples is acquired in each RF frame, you can get the address where us4oem data starts using the following formula: the frame number * number of samples * 32 (number of us4OEM RX channels).
- Parameters
us4oem – us4oem ordinal number (0, 1, …)
- Returns
the number of frame, which starts portion of data acquired by the given us4OEM.
-
virtual const std::vector<uint32> &
getFrameOffsets() const = 0¶ Returns the list of frame offsets (‘position of first us4oem frame’). See
getFirstFramefor more information.
-
virtual uint32
getNumberOfFrames(uint8 us4oem) const = 0¶ Returns the number of frames that this us4OEM will transfer to the host device.
- Parameters
us4oem – us4OEM ordinal number.
Public Static Functions
Returns true if the given PHYSICAL channel number is unavailable.
- Parameters
channelNumber – physical channel number to verify.
- Returns
true if given channel is unavailable, false otherwise
-
virtual FrameChannelMappingAddress
Upload result contains also a handle to the output data buffer.
-
class
arrus::framework::DataBuffer: public arrus::framework::Buffer¶ A data buffer. This interface allows to register callback function to be called when new data arrives.
Public Functions
-
virtual void
registerOnNewDataCallback(OnNewDataCallback &callback) = 0¶ Registers callback, that should be called once new data arrives at the buffer head. The callback has an access to the latest data.
Free the provided buffer element using
releasefunction when the data is no longer needed.The callback is required.
-
virtual void
registerOnOverflowCallback(OnOverflowCallback &callback) = 0¶ Registers callback, that will be called once buffer overflow happens.
The callback function is optional, by default nop is performed.
-
virtual void
registerShutdownCallback(OnShutdownCallback &callback) = 0¶ Registers callback, that will be called once buffer is shutdown.
Buffer shutdown is preformed when the device is stopped. The callback function is optional, by default nop is set.
-
virtual void
Data buffers consists of multiple elements.
-
class
arrus::framework::BufferElement¶ A buffer element.
Public Functions
-
virtual NdArray &
getData(ArrayId id) = 0¶ Returns output data, with the given id (ordinal).
In some cases (e.g. when running a sequence of TX/RX sequences) the system/process can produce a tuple of arrays. This method is kept for backward compatibility, and always gives the access to the first element of the tuple.
- Returns
NdArray with data
-
virtual NdArray &
getData() = 0¶ Returns output data, with the ordinal 0.
See also getData(ArrayId ordinal).
- Returns
NdArray with data
-
virtual size_t
getSize() = 0¶ Returns the size of this buffer element.
NOTE: the size is equal to the sum of the sizes of all subelements (e.g. in case of an element that stores a tuple of NdArrays, this method will return the sum of all NdArrays in that tuple).
- Returns
size of the whole element in bytes
-
virtual size_t
getPosition() = 0¶ Returns position of the element in the data buffer.
-
virtual uint16
getNumberOfArrays() const = 0¶ Returns the number of arrays each element of this buffer contains.
-
virtual NdArray &
-
class
arrus::framework::NdArray¶ N-dimensional array.
The data order in memory is C-contiguous (last axis varies the fastest).
The address returned by
getDatafunction is located on a device determined by placement property. CPU:0 placement means that the data is located in host computer’s RAM.Public Types
-
using
DataType= NdArrayDef::DataType¶ A list of currently supported data types of the output buffer.
Public Functions
-
template<typename
T>
inline T *get()¶ Returns a pointer to data.
- Template Parameters
T – data type
- Returns
a pointer to data
-
template<typename
T>
inline const T *get() const¶ Returns a pointer to data.
- Template Parameters
T – data type
- Returns
a pointer to data
-
inline short *
getInt16()¶ Returns a pointer to the memory data (assuming the data type is int16).
- Returns
-
using
-
template<typename
T>
classarrus::Tuple¶ A tuple of values.
Note: this class is immutable.
Logging¶
-
class
arrus::Logging: public arrus::LoggerFactory¶ Default ARRUS logging mechanism.
Public Functions
-
ARRUS_CPP_EXPORT void
addClog(::arrus::LogSeverity level)¶ Adds std::cout logging output stream to the default logging mechanism (console log output).
- Parameters
level – minimum level severity level to set for clog output
Adds a custom stream implementation to the default logging mechanism.
- Parameters
stream – output stream to use in logging
level – minimum level severity level to set for the output stream logging
-
ARRUS_CPP_EXPORT void
addLogFile(const std::string &filepath, LogSeverity level)¶ Adds a log file to the default logging mechanism. If the file has already been added, the call is ignored.
NOTE:
This method does not allow to change the logging level of already added log file. This method willy simply ignore the level parameter for any sub-sequent calls of this method for the given file.
This method intentionally DOES NOT EXPAND the ‘~’ (home) directory, as it is currently not explicitly supported by ARRUS logging. This may, however, be supported in the future.
- Parameters
filepath – path to the log file
level – minimum severity level to set for the log file
-
ARRUS_CPP_EXPORT void
removeAllStreams()¶ Remove all registered output streams from the logging mechanism.
-
ARRUS_CPP_EXPORT void
Sets a logger factory in arrus package.
The provided logger factory will be used to generate default and component specific loggers. The logger factory should be available through the life-time of the application.
- Parameters
factory – logger factory to set
-
ARRUS_CPP_EXPORT Logging *
arrus::useDefaultLoggerFactory()¶ Sets default logger factory to arrus::Logging.
- Returns
raw pointer to the default logging factory.