You are on page 1of 22

Table of Contents

1 Texo....................................................................................................................................................................................................................................1
1.1 Overview..........................................................................................................................................................................................................1
1.2 History and Versions.......................................................................................................................................................................................1
1.3 PDF Download................................................................................................................................................................................................1
1.4 Main Topics.....................................................................................................................................................................................................1
2 Texo Sequencing...............................................................................................................................................................................................................2
2.1 Sequencing Overview......................................................................................................................................................................................2
2.2 Sequencing Examples.....................................................................................................................................................................................2
3 Texo Parameters................................................................................................................................................................................................................4
3.1 Global Parameters...........................................................................................................................................................................................4
3.2 Generic Parameters........................................................................................................................................................................................4
3.3 Transmit Parameters.......................................................................................................................................................................................4
3.4 Analog Front End (AFE)..................................................................................................................................................................................5
3.5 Receive Parameters........................................................................................................................................................................................5
4 Texo Data Processing Prior to 6.0.x................................................................................................................................................................................8
4.1 Data representation.........................................................................................................................................................................................8
4.2 MATLAB method to read data-file...................................................................................................................................................................8
4.3 A Short Introduction to Imaging.......................................................................................................................................................................9
5 Texo Parameter Effects...................................................................................................................................................................................................11
5.1 Introduction....................................................................................................................................................................................................11
5.2 Transmit Frequency Effects...........................................................................................................................................................................11
5.3 Burst Cycle Effects........................................................................................................................................................................................12
5.4 Varying Power Level......................................................................................................................................................................................13
5.5 Varying TGC Setting......................................................................................................................................................................................14
5.6 Varying Transmit Aperture Size.....................................................................................................................................................................15
5.7 Varying Receive Aperture Size......................................................................................................................................................................16
5.8 Masking Mechanism Characterization...........................................................................................................................................................17
5.9 Dynamic Focus..............................................................................................................................................................................................18
6 Texo GUI Demo................................................................................................................................................................................................................20
6.1 Interface (6.0)................................................................................................................................................................................................20
6.2 Setup.............................................................................................................................................................................................................20
6.3 Interface (6.1)................................................................................................................................................................................................21

1 Texo
1.1 Overview
Texo is a development toolkit that allows for lower level control of the ultrasound system for functions such custom beam sequencing, RF data
acquisition, and better transmit and receive control. Custom sequences can be created by setting both transmit and receive parameters for a single
scanline. The ability to set per-scanline parameters make Texo a unique tool to develop with. Texo acquires the corresponding RF data that can be used
for further processing.

1.2 History and Versions


Texo was developed in 2006 for the Sonix RP system, and was initially going to be a graphical program called Sequence Builder. It made more sense to
build a full SDK, and Texo was thus born. Though there have been numerous updates to Texo over the years, the updates have been relatively minor,
and the same functionality that was available upon initial release has not changed much. Version 2.0 will be on a different codebase to have better
support on the SonixTOUCH, whereas version 1.x was focused on the Sonix RP. The latest version also implements the DAQ SDK for interfacing to the
SonixDAQ device.

1.3 PDF Download


Download all Texo SDK documentation as a PDF

1.4 Main Topics


Texo Sequencing
Texo Parameters
Texo Data Processing
Texo Parameter Effects
Texo GUI Demo

2 Texo Sequencing
2.1 Sequencing Overview
Sequencing can be defined as the ordering and arrangement of transmit and receive pulses for a given ultrasound frame. An ultrasound frame can be
made up of any sort of data, for instance envelope detected B mode data, or RF data. A typical sequence in ultrasound runs across the transducer from
one end to the other, such as in B mode. Other sequences for M mode and Pulsed Doppler will stay in a single position on the transducer, and modes
like Color Doppler will have complex sequences used to time the PRF of an ensemble of scanlines used as input into an autocorrelation algorithm. Texo
allows for all these types of sequences to be built, plus whatever other ideas can be creatively implemented. The SDK allows for a transmit to occur at
one location of the transducer, and for the receive to occur at a completely different one, which can be useful for angular beams and/or picking up
weaker signals from the backscatter.
Each sequence programmed will result in single frame of ultrasound data being collected. Frames will continue to be collected into a cyclic cine buffer,
where they can be read in real-time or once the imaging has been frozen.

Sequencing Flow

2.2 Sequencing Examples


Simple pseudo-code for creating a linear sequence would look as follows:
void main()
{
elem = texoGetProbeNumElements()
for (i = 0; i < elem; i++)

{
tx.center = rx.center = i
texoAddLine(tx, rx)
}
}

A simple M mode sequence could look as follows:


void main()
{
tx.center = rx.center = X
rx.lineduration = PRF_setting
texoAddLine(tx, rx)
}

It is important to note the setting of the line duration for a single line sequence. If the acquisition PRF is based purely on the acquisition depth that was
set, then it may be too high for the power settings used. Always use caution when creating high PRF sequences.
Finally, a more complex sequence may look like:
void main()
{
for (i = 0; i < numBlocks; i++)
{
for (j = 0; j < ensemble; j++)
{
for (k = 0; k < linesPerBlock; k++)
{
tx.center = rx.center = (i * linesPerBlock) + k
tx.pulseShape = getPulseBasedOnEnsemble(j)
texAddLine(tx, rx)
}
}
}
}

3 Texo Parameters
Texo has three types of parameters, transmit, receive, and data control. The API listing documents these parameters briefly, however this page will offer
more insights on how to use them and some of their nuances.

3.1 Global Parameters


texoSetPower(int overallPower, int MaxPositivePower, int maxNegativePower)
Sets the power values for the sequence. All values ranges from 0 to 15.

3.2 Generic Parameters


The following parameters are generic to both transmit and receive and deserve some detailed information:
centerElement
The center element parameter determines where the firing and/or receive will occur on the transducer. Most probes have 64 or 128
elements, and centerElement can be any value in between. Element interpolation is a feature that is automatically programmed into
Ultrasonix software, so that element centers can be specified in 1/10th of an element. Interpolation is done through moderate
alterations to the time delays to steer the transmit beams and receive delays by small increments. Because the aperture of the
transmit or receive must be an even number, most centerElement specifications should interpolate to a half element. For instance if
element 64 is desired as the center, 63.5 (parameter set as 635) should be specified.

Elements Specification

aperture
The aperture parameter specified how many elements are in either the transmit firing and/or receive beamforming. For transmit, up
to 128 elements can be in the aperture, where more elements means greater energy output. A single element can be setup to
transmit if the aperture is set equal to 0. Setting to 1 would be logical, however because of the even aperture requirement, 1 is
handled differently internally. For receive, the Sonix RP can have up to 32 receive elements, and the SonixTOUCH, up to 64. The
channel masking parameter, as discussed below, also plays an important role in acquiring data with specific aperture sizes and
elements.
angle
The angle is in 1/1000th of a degree, and steers the transmit beam by altering the time delays on the transmit firings, and for
receive will alter the time delays in the beamforming process. Steering is useful for phased array transducers, for steering and
compounding applications, and for aligning transmit and receive beams when the center elements are different for a single scanline.
speedOfSound
The speed of sound can be defined so that the time delays are altered to reflect the material or tissue that the wave is propagating
through. This can be useful to try and optimize results when analyzing a received signal.
Additional Notes:
When the centerElement is near an edge, and the aperture goes beyond the transducer element boundary, the aperture will be automatically
cut off, however focusing will still occur with just part of the aperture missing.

3.3 Transmit Parameters


The transmit parameters are set for each scanline that is programmed in Texo, there is the flexibility to create different parameters for each line, or they
can all use the same properties.
focusDistance
The focus distance specifies at what point to focus the transmit beam at. This is accomplished by the software calculating the
proper time delays based on the aperture requested. A focus distance of large distance, for example 30cm can be set in order to
create a plane, or near-plane wave. Its value is specified in microns.
4

frequency
Specified in Hz, the frequency will emit a pulse at a specific frequency. More information regarding transmit pulses can be found
here. Note that each transducer will have a specific bandwidth that it operates best at, as well as a central resonating frequency,
however with Texo, one has the ability to try any frequency value.
pulseShape
The pulse shape alters the transmit pulse as a function of time at the frequency specified. Three values can be set in the string for
defining a pulse: '0' for off, '+' for positive excitation, and '-' for negative excitation. By combining strings of '+' and '-', and using the
proper transmit frequency, one can embed frequencies within a single transmission.
useManualDelays
If set to false, then the focusDistance parameter shall be used to calculate the time delays, if set to true, then it is up to the user to
provide an array of time delay values as described in the following parameter.
manualDelays
This array can be populated to set a delay for each element in 25ns values if useManualDelays is set to true. The number of delay
values (maximum of 128), should reflect the aperture setting, and is always 0 based (i.e. for an aperture of 64, populate array
indicies 0 to 63).
tableIndex
In order to gain the ability to add more scanlines to a custom sequence, transmit definitions can be re-used when calling
addTransmit(). The order in which these are added determines the index to reference, where the first call to addTransmit() refers to
index of 0. If set to -1, then a new transmit definition is automatically added.
useDeadElements
If set to false, then every element is deemed to be working within the aperture, if set to false, then the following parameter can be
populated to emulate dead elements within the transducer, and they will not be part of the firing sequence.
deadElements
When useDeadElements is set to true, this array can be populated with 1's and 0's, where 1 specifies a working element and 0
specifies a dead element. To be implemented properly, the entire array should be populated with valid values.
sync
Enables 1 or disables 0 the trigger output for each scan line. This parameter combined with line trigger allows the user to selectively
turn the trigger on/off for each individual transmit independently.

3.4 Analog Front End (AFE)


Analog front end parameters are set in the VCA
VCAInfo vcaInfo;
vcaInfo.amplification = 10;
vcaInfo.activetermination = 4;
vcaInfo.inclamp = 1600;
vcaInfo.LPF = 3;
vcaInfo.lnaIntegratorEnable = 0;
vcaInfo.pgaIntegratorEnable = 0;
vcaInfo.hpfDigitalEnable = 1;
vcaInfo.hpfDigitalValue = 2;

where
PGA is Programmable gain amplifier
LNA is low noise amplifier
AAF/LPF is Antialiasing filter
Digital HPF is there to avoid RF saturation
These parameter affect the gain and frequency response of your RF signal. Depending on your hardware and transducer, you need to optimize these
parameters to get the best range for your RF signal. To see the default values used for each probe in the Exam, look at the "Gen-general(probe
name).xml" file in the Imaging\ folder, under hardware optimizations.

3.5 Receive Parameters


The receive parameters are set for each scanline that is programmed in Texo, there is the flexibility to create different parameters for each line, or they
can all use the same properties.
acquisitionDepth
Specified in microns, how deep to acquire data. This will also determine the line duration for the scanline, unless overridden by the
custom line duration.
saveDelay
Data can stored after a certain amount of time. The delay is in microns, and will not delay the acquisition past the depth specified.
For example, if delay is 1cm and depth is 4cm, only 1cm to 4cm will be acquired for a total of 3cm, the first cm will be discarded.
channelMask
An important parameter for acquiring pre-beamformed data or shutting off elements during receive. The mask is split into two 32 bit
words, where on the Sonix RP, only the first word is used since it has only 32 channels, and the SonixTOUCH will use all 64 bits.
Setting all bits to 0, except for one specific index to 1, will result in a pre-beamformed data capture. The mask is centered around
the centerElement that is set in the receive parameters.

Masking Channels

applyFocus
If set to true, then dynamic receive beamforming is implemented. If set to false, then all channels specified in the aperture will have
no delay applied.
useManualDelays
If set to false, then dynamic beamforming time delays will be calculated internally based on the applyFocus setting. If set to true,
then it is up to the user to provide an array of time delay values as described in the following parameter. For now, only one delay
can be programmed, however to make dynamic receive beamforming, a very large set of arrays (perhaps a pointer) should be
passable in the future.
manualDelays
This array can be populated to set a delay for each element in 25ns values if useManualDelays is set to true. The number of delay
values (maximum of 64 on SonixTOUCH and 32 on Sonix RP), should reflect the aperture setting, and is always 0 based (i.e. for
an aperture of 16, populate array indicies 0 to 16).
customLineDuration
Programmed in ns, and if set to 0 no effect on the receive, however if non-zero then the line duration will be extended to program a
custom PRF that is different from the pre-calculated duration when the acquisition depth is set. Note that this duration should be
longer than the depth of acquisition duration, otherwise no effect will take place.

Clock Diagram with Custom Line Duration

lgcValue
A digital gain value that can be applied to the entire scanline.
tgcSel
The index into the table in which TGC curves are stored. Up to 10 curves can be stored when calling an addTGC() function.
tableIndex
In order to gain the ability to add more scanlines to a custom sequence, receive definitions can be re-used when calling
addReceive(). The order in which these are added determines the index to reference, where the first call to addReceive() refers to
index of 0. If set to -1, then a new receive definition is automatically added.
6

decimation
The decimation applied to the RF or B data being captured. Since the sampling is at 40MHz, setting to 0 will have effect, where 1
will result in 20MHz sampled data, 2 will result in 10MHz, etc. Note that for most cases the Sonix RP can only transfer back 20MHz
sampled data, due to PCI card restrictions, and the SonixTOUCH can typically handle up to 15cm of 40MHz sampled data.
numChannels
Since the SonixTOUCH can technically have a variable number of channels (32 or 64), this should be set to properly reflect the
hardware configuration.
rxAprCrv
Programming this curvature allows you to have control over the number of element in the RX aperture as a function of depth. Using
this parameter a fixed F-number can be used for RX beamforming. This curvature can be programmed as follows
rxPrms.rxAprCrv.top = 10; // top point (e.g. 10% of the aperture) rxPrms.rxAprCrv.mid = 50; // mid point (e.g. 50% of the aperture) rxPrms.rxAprCrv.btm
= 100; // bottom point (e.g. 100% of the aperture) rxPrms.rxAprCrv.vmid = 50; // location of the mid point (e.g. in the center)
This is the same as adjusting your Rx Apr curve in the Exam software.

4 Texo Data Processing Prior to 6.0.x


4.1 Data representation
The data in the CINE-Buffer and respectively in the output files of the console example program is stored in the following manner:

DATA structure

Each block represents one byte. The number of samples in one line can be derived by:
Pseudocode: (Texo::getFrameSize()-4)/(numberOfScanlinesPerFrame*sizeof(short))

4.2 MATLAB method to read data-file


To display the results of Texo data capture, the MATLAB code below provides a simple example. It is a function that will take in raw RF values outputted
from Texo, and create a large matrix that will hold all RF lines organized into frames.
filename: Name of the raw RF data file, including all the directory information.
eg. \\D:\Data\Texo\RF\output.raw
w: Number of scanlines per frame. This information is determined by counting the times the function texo::addLine() was called for the
sequence
h: Size of each line in bytes. This value can be calculated by dividing the frame size in bytes by the number of scanlines per frame (w).
However, the header of each file takes up 4 bytes, so it is necessary to get rid of first 4 bytes header which is used as a time-stamp for each
frame collected from the cine buffer. The value of frame size is obtained by the function texo::getFrameSize().
frame_no: Number of frames acquired. This information is obtained by calling texo::getCollectedFrameCount().
A known error on the Sonix hardware is the fact that the first RF line on the first frame captured will be distorted. The easiest way to deal with this
problem is to ignore the very first frame. Therefore it is advised to acquire one extra frame than actually necessary and discard the first frame.
fid = fopen(filename,'r');
frame_no*(w*h/2+2);
[v,count] = fread(fid,inf,'short');
count;
images = [];
BigMatrix=[];
for frame_count = 1:frame_no,
BigMatrix(frame_count,:) = v(((frame_count-1)*(h/2*w+2)+3) : ((frame_count)*(h/2*w+2)))';
end;
for i=1:frame_no,
A = reshape(BigMatrix(i,:),h/2,w);
images(:,:,i) = A;
plot(A);%,axis([0 xmax ymin ymax ]);%imagesc(A);colormap gray;
end;
fclose(fid);

The following MATLAB code provides an alternative method to read RF-data from a file. It will create a 3d-matrix containing the single scanlines sorted
by frames.
clear;
%Constants
filename = 'frames.rf'; %Filename of the RF-file
headerSize = 4;
%Size of frame header in bytes (constant if not changed by a new version of Texo)
frameSize = 124676;
%Size of a single frame in bytes

numberOfFrames = 10;
linesPerFrame = 4;

%Number of scanlines per frame

%Read RF-file
fid = fopen(filename,'r');
[dataFromFile] = fread(fid,inf,'short');
fclose(fid);
%Close the file, we have what we needed
%Sort frames
numberOfFrames = numberOfFrames-1;
%drop first frame as invalid, as described in forum
frames = zeros(frameSize/2,numberOfFrames); %create empty matrix (speeds up copying)
for i = 1:numberOfFrames,
%copy whole frames in matrix
frames(:,i) = dataFromFile(i*frameSize/2+1:(i+1)*frameSize/2);
end;
clear dataFromFile;
%Delete data to free memory
%Split up frames into scanlines
samplesPerLine = ((frameSize-headerSize)/2)/linesPerFrame;
frames(1:2,:) = [];
%delete frame headers
linesByFrame = zeros(samplesPerLine,linesPerFrame,numberOfFrames); %empty 3d-matrix to hold lines
for i = 1:numberOfFrames,
for j = 1:linesPerFrame,
linesByFrame(:,j,i) = frames((j-1)*samplesPerLine+1:j*samplesPerLine,i);
end;
end;
clear frames;
%Delete data to free memory
%Example of how to extract a single frame (frame 2 in this case)
frame1(:,:) = linesByFrame(:,:,2);

4.3 A Short Introduction to Imaging


To create an image from scanlines a, the ultrasound data have to be envelope detected. Using Texo, the easiest way to achieve this, is to order
envelope detected data from the machine:
tex->addLine(envData, tx, rx))

The enevelope detected samples have to be allocated to grayvalues. Note that more than 8bit resolution are not neccessary or useful, since the human
eye can only resolve less, than a hundred grayvalues. One single frame of Texo's envelope detected RF data has to be split into the single scanlines it
consists of and these scanlines have to be arranged next to each other. In the following image, the process is simplified and broken down for laymen, so
there are only two grayvalues, black and white.

Creating Images

Here is an pseudocode example of a thread's function, that constructs an image out of the raw data. The sequence that goes hand in hand with this
image generation method, is a simple linear sequence:
9

for(int i=0;i<tex->getProbeNumElements();i++) {
rx.centerElement = i*10+5;
tx.centerElement = i*10+5;
tex->addLine(envData, tx, rx);
}

Since the process of generating an image can be quite time consuming, it should be delegated to a thread, in order to not make the program
unresponsive. Note, that the geometrical dimensions of the wavelength and the dimension of the probe are not respected in this simple example. Also it
is not an ideal representation of the grayvalues, since the human eye has a higher sensitivity for green colors, depending on the method to display the
image a weighting function should be used.

i=0
for(x=0, x<numberOfLines, x++) {
for(y=0, y<samplesPerLine, y++) {
brightness = data[i]
setColorRGB(brightness, brightness, brightness)
drawPoint(x,y)
i++
}
}

//iterate through the scanlines along the transducer


//iterate through the samples perpendiculat to the transducer
//a RGB-color with identical values in every channel is always a shade of gray

10

5 Texo Parameter Effects


5.1 Introduction
In order to characterize the Sonix RP machine in terms of the relationship between its image and TEXO parameters, several experiments were
conducted. To minimize variables, a default setting is applied to all parameters except for the variable in question. The default setting is as follows:

System

SonixRP

Target

Multipurpose ATS Phantom Model 539

Transducer

L14-5/38

Imaging Depth

50 mm

Transmit Aperture

64 elements

Receive Aperture

32 elements

Transmit Frequency 9.5 MHz


Transmit Cycles

4 Cycles

Transmit Power

15

TGC

0.80 (80%)

Transmit Focus

25 mm (Depth/2)

Dynamic Focus

ON

Mask

0xFFFFFFFF

In all the experiment, to avoid imaging artifacts, the first frame was ignored and the second frame was used in the study.

5.2 Transmit Frequency Effects


The first experiment will determine the effects of pulse frequency on the return echo pulse shape. In this experiment, the frequency was varied from 4
MHz ~ 10 MHz.

11

Results

5.3 Burst Cycle Effects


The second experiment will determine the effects of pulse length on the return echo pulse shape. In this experiment, the length of the transmitted burst
was set at 2, 4, and 8 cycles.
12

Results

5.4 Varying Power Level


This experiment will determine the effects of varying power level on the return echo pulse shape. In this experiment, the power level was varied from 5
to 15.
13

Results

5.5 Varying TGC Setting


This experiment will determine the effects of varying TGC setting on the return echo pulse shape. In this experiment, the TGC was varied from 0% to
100% in 10% increments.
14

Results

5.6 Varying Transmit Aperture Size


A series of scans were taken at different transmit to receive aperture ratios: Tx/Rx: 64/32, 32/32, 16/32, 8/32

15

Results

5.7 Varying Receive Aperture Size


A series of scans were taken at different transmit to receive aperture ratios: Tx/Rx: 16/32, 16/16, 16/8, 16/4

16

Results

5.8 Masking Mechanism Characterization


In order to depict the masking mechanism, a series of scans were taken using different masks.

17

Results

5.9 Dynamic Focus


Finally, to display the effect of dynamic focus it is turned on and off for two scans.

18

Results

19

6 Texo GUI Demo


SDK 6.X comes with executable Texo demo file located at \sdk\bin\texo_demo_qt.exe
Alternately, Qt Creator can be used to compile the GUI demo using the steps provided at the Qt Creator page.

6.1 Interface (6.0)


The Texo interface includes the individual channel information (RF signal), the beamformed image, some parameters to change and the option to save
the data.

Texo Qt GUI
1) Initialize, run and stop buttons.
2) RF signal from each channel.
3) Constructed image out of the raw data.
4) Parameters option.
5) Probe selection.
6) Frequency of the image (frames per second FPS).

6.2 Setup
Run the Texo_demo_qt.exe on Ultrasonix machine and make sure that Sonix Exam program is turned off.
Click on the Initialize tab on the top and make sure the Mian Board and PCI Card are set correctly based on your system.
Press the Power button and wait for the Texo to initialize.
Select the probe (if more than one connected).
Click on the Run button (imaging will start).
Click on the Stop button (imaging will stop).
If you change any image parameter, press the "Apply Changes" button every time. Guide for the function of each parameter can be found in Texo
Parameters.

20

6.3 Interface (6.1)


The following figure shows the main user interface of the Texo Demo Qt software (6.1):

With this version:


The user can display the RF image both horizontally and vertically using Transpose RF check box.
The user can scroll through different frames when the imaging is stopped using thecine scroll.
Sliders on the left can be used to help with visualization of different channels. Slider on the bottom plus the span ratio can also be used to
control the axial zoom for different channel display in real-time.
The software also allows the user to store the RF data into .rf files with proper header information when the imaging is stopped. This stored .rf
file can then be processed by the Amplio Demo Program for generating B-mode images off-line. The save button will save all the frames in the
buffer into TexoData.rf file in the same folder as the executable file.

21