You are on page 1of 12

BIOEN 420 - Exercise 3 Instructions/Questions

Due: 11:59 PM on Monday, April 27, 2020 – 30 points

QUESTION 1: Why does the signal strength from the wire targets decrease with depth/time?
This is in water, so there is no significant attenuation.

The signal strength from the wire targets


decreases with depth and time because of
conservation of energy. When the same
amount of initial energy is spread over a
larger area, the energy is less
concentrated, and the amplitude is lower.
An example of this is in rippling water
when the energy in each ripple decreases
as the radius increases. With wire targets,
the same principle applies, thus affecting
the value of the diffraction integral. The
signal amplitude decreases with time
because each point will not come back to
the focal point at the same time.

1
QUESTION 2: Why do the spectra in Figures 4/5 (above) have two spectral peaks?
The spectra in Figures 4 and 5 have two spectral peaks because the peak on the left represents
that positive frequencies of the signal and the peak on the right represents the negative
frequencies of the signal. Both peaks range over 10 Hz and have an amplitude of 40 Hz. Images
4 and 5 are centered at 50 MHz because the range is from 0 to sampling frequency (100 MHz).
QUESTION 3: Explain the results in these two figures (below). How do you know when you
have the right answer?
The results of Figures 6 and 7 both consist of a signal encompassed by an envelope. The carrier
has the cosine term and the envelope (A(t)) which determines the axial resolution. As discussed
in concept in Question 1, a larger envelope gives a lower resolution because it smears the energy
over a longer time/distance. You know you have the right answer when the envelope (blue)
surrounds the entirety of the carrier signal (red) since the envelope must capture the whole signal
as the term that determines bandwidth.

2
QUESTION 4: Is this target at an angle different than 0? How can you tell?
The target angle is different than 0. You can tell because if the target were at an angle of 0, the
resulting wavefield would look like a symmetric parabola. Because the wavefield in Figure 8 and
zoomed in more clearly in Figure 9 is not centered and symmetrical, you can tell that the target is
at an angle that was not oriented perpendicularly to the beam.

QUESTION 5: How different are these curves? Are the differences significant?
The curves of the exact distance calculation
and the parabolic approximation are similar/
The approximation overestimates the delay
from channels 0-60, underestimates very
slightly from 60-110, then overestimates
again from channels 110-120. Because of the
-6° angle, the parabolas are both centered
near channel 60. Thus, the differences are
very minimal around channels 60-110, but
are more apparent farther away from those
channels. Overall, the differences are not
extremely significant.

3
QUESTION 6: Choose the proper sign of the delay. How do you know when you are right?
The delay should be positive. This is because the sign of the transmitted parabola is negative, and
the sign of the delay is the opposite of the transmitted pattern. You know that you have the right
answer because the wavefield plot looks like the correct parabola instead of a series of straight
lines. You also know because Figure 11 is the same shape but opposite sign as Figure 10 which
also confirms that the time delay should have positive sign.

QUESTION 7: You will view images made with curvilinear/convex and linear arrays. What are
the primary differences in the scans for these two arrays?
With a linear sequential array, the image will be rectangular and will be the length of the face of
the transducer. A simple linear transducer does not have steering and the beams are fired so that
they run parallel to each other. The benefit is that you do not end up with gaps since the distance
between the beams is the same as the distance between the crystals. The face is large, and the
image is rectangular
In a curved sequential array since the crystals are arranged in an arc, the image created is in a
wedge shape. No beam steering is needed because the crystals are already in the shape of the
wedge. The drawback is that there are more spaces between the beams at the back of the image
than at the front of the image, and this results in gaps that will miss structures that the beams do
not touch

QUESTION 8: What clinical applications do you think would be best for a curvilinear/convex
array versus a linear array?
The linear array probe is designed for superficial imaging since it provides high resolution (no
gaps) and less penetration. Examples of applications are using ultrasound guided vascular access
and evaluating structures on top of the skin like abscesses and foreign bodies.
A curvilinear/convex array uses lower frequency ultrasound that allows for deep penetration and
a wide depth of field. This is useful for viewing intra-abdominal structures like pregnancy
ultrasounds to obtain fetal images.

Appendix
close all;
clear all;

% Define Signal Parameters

freq_sample=100.0;% Sampling frequency in MHz


freq_cutoff=10.0;% Maximum frequency (MHz) to preserve in the complex signal

4
%
% Read In Measured and Simulated data
%
% Measured waveform is in array 'signal'
% Simulated waveform is in array 'signal_simulated'
%

load ('testdata.mat');
load ('simulated_data');

signal=y;
length=size(y);
n_points=length(1);

signal_simulated=pulse_signal';
length2=size(signal_simulated);
n_points2=length2(1);

%
% Plot RF A-Scan - Echo train from a collection of wire targets
%

XMIN=0;
XMAX=n_points;

signal_max=max(abs(signal));

scale=1.5;
YMAX=scale*signal_max;
YMIN=-YMAX;

figure(1); plot(signal);
axis([XMIN XMAX YMIN YMAX]);
title('Measured RF A-Scan');

%
% Define Analysis Window for Measured Data
%

n_window=n_points2;
n_start=420;

%
% Window out single impulse response and Plot
%

signal_window=signal(n_start:n_start+n_window-1);

%
% Remove offset from measured signal
%

5
test=mean(signal_window);
signal_window=signal_window-test;

time=(0:n_window-1)/freq_sample; %Define time samples in usec


time=time';

signal_max=max(abs(signal_window));
signal_window=signal_window/signal_max;

scale=1.25;
YMIN=-scale;
YMAX=scale;

XMIN=0;
XMAX=n_window/freq_sample;

%
% Plot Windowed Signal
%

figure(2); plot(time,signal_window);
axis([XMIN XMAX YMIN YMAX]);
xlabel('Time (usec)');
ylabel('Signal (Normalized)');
title('Windowed and Normalized RF A-Scan');

%
% Plot Simulated Signal
%

max_signal=max(abs(signal_simulated));
signal_simulated=signal_simulated/max_signal;

figure(3);plot(time,signal_simulated);
axis([XMIN XMAX YMIN YMAX]);
xlabel('Time (usec)');
ylabel('Signal (Normalized)');
title('Simulated RF A-Scan');

%
% Perform FFT of Measured Waveform - first remove DC level
%

spectrum=fft(signal_window);

%
% Perform FFT of Simulated Waveform
%

spectrum_simulated=fft(signal_simulated);

%
% Display Spectra over 40 dB log scale
%

6
dyn_range=40.0;

YMAX=0.0;
YMIN=-dyn_range;

max_spectrum=max(abs(spectrum));
spectrum_display=20.0*log10(abs(spectrum)/max_spectrum);

max_spectrum2=max(abs(spectrum_simulated));
spectrum_display2=20.0*log10(abs(spectrum_simulated)/max_spectrum);

frequency=(0:n_window-1)/n_window;
frequency=frequency*freq_sample; % Frequencies in Fourier Transform

figure(4);plot(frequency,spectrum_display);
axis([0 freq_sample -dyn_range 0]);
xlabel('Frequency (MHz)');
ylabel('Amplitude (dB)');
title('Magnitude of Spectrum of Measured Signal');

figure(5);plot(frequency,spectrum_display2);
axis([0 freq_sample -dyn_range 0]);
xlabel('Frequency (MHz)');
ylabel('Amplitude (dB)');
title('Magnitude of Spectrum of Simulated Signal');

%
% Filter Spectrum and Compute Analytic Signal Over Allowed Spectral Range
%

filter_cutoff=round((freq_cutoff*n_window)/freq_sample);

spectrum_analytic=zeros(n_window,1);

spectrum_analytic2=zeros(n_window,1);

%this is the measured signal's analytic spectrum computation


spectrum_analytic(1:filter_cutoff)= spectrum(1:filter_cutoff,1);

%this is the simulated signal's analytic spectrum computation


spectrum_analytic2(1:filter_cutoff)= spectrum_simulated(1:filter_cutoff,1);

%
% Compute spectral mean
%

freq=(0:n_window-1)';
freq=freq_sample*freq/n_window;

moment0=sum(abs(spectrum_analytic));

7
moment1=sum(abs(spectrum_analytic).*freq);

mean_frequency_measured_MHz=moment1/moment0

moment0=sum(abs(spectrum_analytic2));
moment1=sum(abs(spectrum_analytic2).*freq);

mean_frequency_simulated_MHz=moment1/moment0

%
% Compute Normalized Envelope
%

envelope=zeros(1,n_window);

%
% Produce the Signal Envelope (envelope) from the Measured Signal
% Analytic Spectrum (spectrum_analytic)
%

envelope = 2*abs(ifft(spectrum_analytic));

%normalizing envelope*
num = 0.00001
maxenvelope=max(abs(envelope))+num;
envelope=envelope/maxenvelope;

%
% Produce the Signal Envelope (envelope2) from the Simulated Signal
% Analytic Spectrum (spectrum_analytic2)
%

envelope2=zeros(1,n_window);

envelope2 = 2*abs(ifft(spectrum_analytic2));

%normalizing envelope*
maxenvelope2=max(abs(envelope2))+num;
envelope2=envelope2/maxenvelope2;

scale=1.25;
YMIN=-scale;
YMAX=scale;

XMIN=0;
XMAX=n_window/freq_sample;

figure(6);plot(time,envelope);
hold on;plot(time,signal_window,'r');hold off
axis([XMIN XMAX YMIN YMAX]);
xlabel('Time (usec)');
ylabel('Signal (Normalized)');
title('Measured A-Scan DETECTED');

8
legend('envelope', 'signal');

figure(7);plot(time,envelope2);
hold on;plot(time,signal_simulated,'r');hold off
axis([XMIN XMAX YMIN YMAX]);
xlabel('Time (usec)');
ylabel('Signal (Normalized)');
title('Simulated A-Scan DETECTED');
legend('envelope', 'signal');

%
% Clear Data and Setup for 2nd part of the homeowork on beam forming
%

clear all;

load ('RFdata.mat')

%
% Define Signal Parameters
%

freq_sample=40.0;% Sampling frequency in MHz


demod_frequency=7.0;% Demodulation frequency in MHz
freq_cutoff=12.0;% Frequency cutoff in MHz for filtering
sound_speed=1.5; % sound speed in mm/usec
aperture_dimension=38.0; % array dimension in mm
scale1=0.25; % scaling parameter for full RF display
scale2=0.5; % scaling parameter for zoomed RF display

%
% Define a single target at a specified range (in sample clocks) and angle (in
degrees)
% NOTE - this target is at a very short range - this is where the
% simple parabolic approximation is at its worst
%
% Based on target range, pick zoom factors for display
%

range=1150; % Define Range for focusing


angle=-6.0; % Define Beam Angle in degrees for steering

angle=angle*pi/180;

range_offset=1250;
zoom_range=300;

range_start=range_offset-(zoom_range/2);
range_stop=range_start+zoom_range-1;

scan_size=size(RF);
n_points=scan_size(1);
n_elements=scan_size(2);

9
element_pitch=aperture_dimension/n_elements;

%
% Define Array Spatial Positions
%

x_position=-n_elements/2:n_elements/2-1;
x_position=(x_position+0.5)*element_pitch;

%
% Display Full RF frame
%

signal_max1=max(max(abs(RF)));
YMAX1=scale1*signal_max1;
YMIN1=-YMAX1;

clim=[YMIN1 YMAX1];

figure(8); imagesc(RF,clim);colormap('gray');
xlabel('Channel Number');
ylabel('Time Samples');
title('Full Wavefield Plot');

%
% Display Zoomed Region
%

zoomed_rf=zeros(zoom_range,n_elements);

zoomed_rf=RF(range_start:range_stop,:);

signal_max2=max(max(abs(zoomed_rf)));
YMAX2=scale2*signal_max2;
YMIN2=-YMAX2;

clim=[YMIN2 YMAX2];

figure(9); imagesc(zoomed_rf,clim);colormap('gray');
xlabel('Channel Number');
ylabel('Time Samples');
title('Zoomed Wavefield Plot in Primary Target Region');

%
% Compute delays based on parabolic approximation and exact delays
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Compute parabolic delays - you have to do this using the following variables
%
% delay = delay from parabolic delay in clock ticks

10
% delay = delay_focus+delay_steer;
%
% x_position = x_position along the aperture in mm
% ramge = range in clock ticks
% freq_sample = sample clock frequency in MHz
% sound_speed = sound speed in mm/usec
% angle = beam angle in radians
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

delay=zeros(1,n_elements);% Replace this with parabloic approximation

%calculation of range_mm
range_mm = (range/freq_sample)*(sound_speed/2);

%calculations of focusing and steering components


delay_focus = ((x_position.^2).*(cos(angle))^2)/(2*range_mm);
delay_steer = (-x_position*(sin(angle)))/sound_speed;

% delay = delay from parabolic delay in clock ticks


%this calculates total delay
delay = delay_focus+delay_steer;
%need to make sure delay has correct units (unitless)
delay = delay*(freq_sample/sound_speed);

range_mm=(range/freq_sample)*(sound_speed/2);
delay_exact=(x_position-range_mm*sin(angle)).^2+range_mm^2*cos(angle)^2;
delay_exact=(sqrt(delay_exact)-range_mm)*(freq_sample/sound_speed);

%
% Plot Approximate Delays and Compare to Exact Delays
%

max_delay=max(abs(delay_exact));

XMIN=1;
XMAX=n_elements;
YMAX=max_delay*1.25;
YMIN=0;

figure(10); plot(delay,'b');
axis([XMIN XMAX YMIN YMAX]);hold on;
plot(delay_exact,'r'); hold off
xlabel('Channel Number');
ylabel('Delay (Samples)');
title('Comparison of Exact and Approximate (Parabolic) Time Delays');
legend('approximate', 'exact')

%
% Use Exact Delays and Create Integer Delays per channel
%

11
delay_integer=round(delay_exact);

%
% Apply Integer Delays to zoomed RF data using circshift
%

zoomed_rf_delay=zeros(zoom_range,n_elements);
for i=1:n_elements

delay_choice=0; % must respecify this - see question

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% QUESTION #6 - COMPLETE THE EQUATION BELOW
% YOU MUST SPECIFY THE SIGN OF THE DELAY FOR EACH ELEMENT
%
% delay choice = -delay_integer(i);
% OR
% delay choice = delay_integer(i);
%
% Choose the proper sign of the delay. How do you know when you are right?
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%delay should be positive


delay_choice = delay_integer(i);
zoomed_rf_delay(:,i)=circshift(zoomed_rf(:,i),delay_choice);
end

clim=[YMIN2 YMAX2];

figure(11); imagesc(zoomed_rf_delay,clim);colormap('gray');
xlabel('Channel Number');
ylabel('Time Samples');
title('Zoomed Wavefield Plot - Integer Delay Signals');

12

You might also like