Gain Engine

From WikiSonix
Jump to: navigation, search

Exam 6.0.x[edit]

Construction of Analog and Digital TGC[edit]

The gain is constructed from two main components which are the Hardware Analog TGC & Digital TGC and the Software Digital Gain.

Hardware Analog & Digital TGC[edit]

The 'b-tgc' four point curve now gets applied to both the analog and digital hardware TGC.

For analog tgc, this four point curve represents a percentage of the total maximum analog. The same applies to the hardware digital tgc, where the four point curve represents a percentage of the total maximum digital tgc along the 'b-gn curve depth'. The resulting hardware digital gain value acts as a multiplier to the signal. The maximum analog tgc and maximum digital tgc is a fixed value depending on the hardware:

  • MaxTGCAnalogTGC for HW2 = 3000 mV
  • MaxTGCAnalogTGC for HW3 = 1638 mV
  • MaxTGCAnalogTGC for HW4 = 1228 mV


  • MaxDigitalTGC for HW2 = 4095
  • MaxDigitalTGC for HW3 = 1024
  • MaxDigitalTGC for HW4 = 1024

Software Digital Gain[edit]

The software digital gain applied to the image is determined by the gain offset and user tgc. The digital gain gets applied to the signal after IQ demodulation so that

  • valI = I * Digital Gain;
  • valQ = Q * Digital Gain


The software digital gain is calculated as:

  • Percent TGC = User TGC + GainOffset;
  • dTGC_dB = (Percent TGC / 100.0f * Max Digital Range in dB);
  • Digital Gain = (pow(10.0, dTGC_dB / 20.0)) - 1.0f )* Digital Minimum;


User TGC

  • Is defined as a gain curve from the 7 adjustable sliders.
  • The amount of contribution (in %) that the User TGC curve has in the final tgc depends on the 'usergaincurvesensitivity' parameter in the preset. For example, if this value is set to 25, than the user tgc gets mapped in the following manner.

User TGC = 25 + slider value * (25 – (-25)) / 255.0,


Gain Offset

  • The gain offset parameter is the 'b-gain' variable found in presets. The range of this variable is from -3000 to 3000. This value gets remapped to 0 to 100% .


Max Digital Range

  • The max digital gain range in dB is determined by the variable ‘b-gain-digirange’.


Max Min Amplification

  • This parameter in dB is determined by the variable ‘b-gain-digimin’.
  • Digital Minimum = pow(10.0, (‘b-gain-digimin’) / 20.0));


The block diagram for the gain engine is as follows:

GainEngine.jpg

Exam 5.0.x to 5.7.x[edit]

Parameters[edit]

The parameters affecting tgc calculations are as follows:

  • b-tgc
  • b-gn curve depth
  • gain curve
  • b-gain
  • tgcMaxDigitalValue
  • tgcDigitalGainMinAmp
  • tgcDigitalGainRange
  • b-tgc lateral

Construction of Analog and Digital TGC[edit]

A combination of analog and digital tgc is applied internally on the image.

  • The % of analog and digital tgc depends on three settings: the analog tgc curve, overall gain offset, and user tgc.
  • The analog tgc is mapped to the range of analog input. The maximum analog input is hardware dependent (see section on Final Analog TGC below).
  • The Digital TGC has the same shape as the analog TGC but mapped to the preferred digital range.

TGC = analog tgc curve + gain Offset + user tgc

TGC

Analog TGC Curve

  • Is defined as the parameter 'b-tgc' (which is a curve as part of the imaging parameters in preset files).
  • This curve uses the b-gn curve depth parameter and if b-gn curve depth < number of samples, the last value gets applied up to the number of samples.
  • The four values in this curve parameter (eg. "[C] 1, 51, 51, 30") represents the positions along the curve x1, x2, x3, and y2 respectively (refer to the image below)
b-tgc curve

Gain Offset

  • The gain offset parameter is the 'b-gain' variable found in presets. The range of this variable is from -3000 to 3000. This value gets remapped to -100% to 100% in the tgc equation.

User TGC

  • Is defined as a gain curve from the 7 adjustable sliders.
  • The amount of contribution (in %) that the User TGC curve has in the final tgc depends on the 'usergaincurvesensitivity' parameter in the preset. For example, if this value is set to 25, than the user tgc gets mapped to -25% to 25%.


Final Analog TGC[edit]

  • Va = TGC % x TGCAnalogRange

The TGCAnalogRange is hardware dependant where:

  • TGCAnalogRange for HW2 = 3000 mV
  • TGCAnalogRange for HW3 = 1638 mV
  • TGCAnalogRange for HW4 = 1228 mV

Final Digital TGC[edit]

  • tgcdb = TGC% x TGCDigitalGainRange
  • Vd = 10^(tgcdb/20) x 10^(tgcDigitalGainMinAmp/20)
  • Vd = min(Vd, tgcMaxDigitalValue)

Where tgcMaxDigitalValue, tgcDigitalGainMinAmp, tgcDigitalGainRange are values specified in the preset or imaging.set.xml file

Lateral TGC[edit]

  • Set with the parameter 'b-tgc' lateral
  • This parameter is used for phased array probes only. If the curve is defined in the preset, it gets applied laterally to compensate for the bright middle region.


Early Software (2.x - 3.x)[edit]

This page gives a brief overview of the gain systems within the Ultrasonix engine.

Analog TGC[edit]

There are 4 parameters that adjust the TGC in the Ultrasonix engine.

  • TGC Analog (B)
    • This is the system gain curve that is used, assuming the parameters below are not applied.
  • TGC Max
    • This is a curve that ensures that the analog gain does not go beyond a certain limit. This is useful in removing saturations that can occur by overgaining, especially in the near-field.
  • User TGC
    • This is the slider control on the console that can also be programmed through software.
  • Gain (B)
    • This parameter is the overall offset that adjusts the TGC curve.
  • Gn Curve Depth (B)
    • This is the maximum depth that the gain curve is applied to. At greater depths the image is adjusted to the last point in the curve.

Internally, the gain range is from 0 to 3000. The parameters described above work together to create a table of a certain length, where each point is within the gain range. The TGC Analog (B) parameter is the starting point, this is a UTX_CURVE variable, and its values are interpolated to be within the gain range. The number of vertical values depends on the Gn Curve Depth (B) parameter. The User TGC sliders range from 0 to 255, with an output range from -500 to 500 (programmable internally), this parameter, along with the Gain (B) general offset parameter get applied to the gain table created from the TGC Analog (B) parameter.

Here is some pseudo code for programming the gainTable:

numpoints = calculate from Gn Curve Depth (B)
tgcA = Interpolate TGC Analog (B) curve to gain range within numpoints
tgcU = Interpolate User TGC to user range within numpoints

for(i = 0 to numpoints)
{
    gainTable[i] = tgcA[i] + tgcU[i] + genOffset
    check min and max on gainTable[i]
}

load gainTable to hardware

Lateral Gain Curve[edit]

The lateral gain curve is applied across the image in a digital manner. It does not program the analog components, but rather applies an offset to an entire line of data once it arrives on the FPGA. The range of this parameter is 0 to 2000 (programmable internally), and on-screen, is represented as the curve for half of the image, the other half is mirrored symmetrically in the computations. The name of the parameter is TGC Lateral, and it is a UTX_CURVE variable.

TGC Response[edit]

On the Sonix RP, the TGC is implemented by the VCA2612 component, a variable gain amplifier by Texas Instruments. The gain is interpolated into values ranging from 0 to 3000, which corresponds linearly to 24dB to 45 dB gain. An example in Texo SDK would be to call addTGC(0.5) to get a linear curve, which implies that the TGC curve is flat at 50% of the gain range, which would correspond to a value of 1500. This in turn results in about 34.5dB gain.

Experimentally, the following curve was obtained while scanning a aluminum block at 5 MHz and power level 10.

TGC Energy Curve

The exact energy level may differ from measurement to measurement, but the curve shows a non linear relationship in the energy content as TGC is increased, though the software does not compensate for this. This may be something to keep in mind while designing experiments.