Vous êtes sur la page 1sur 20

Velez-Colon | EE 454

Jose J. Velez-Colon

Dr. Won

EE 454

Tuesday, September 1, 2009

*There are 2 documents: (1) Transformations on B-Mode 2-D Images and (2) Doppler.

Page 1 of 20
Velez-Colon | EE 454

TRANSFORMATIONS ON B-MODE 2-D IMAGES


Questions.

1. What variables are stored in the file?

The following variables are stored in the file ‘carotid1’:

Name Size Bytes Class Attributes


bmode_rf 1816x312 4532736 double
fc 1x1 8 double
posx_bmode 312x1 2496 double

2. Which variable is most likely to be the image data itself? Why?

The ‘bcmode_rf ' variable should be the image because it is the only variable that is 2
dimensional.

3. View the image by typing image(bmode_rf). How well are you able to make out any
structures?

200

400

600

800

1000

1200

1400

1600

1800
50 100 150 200 250 300

It is nearly impossible to see the structures. Perhaps, a trained eye could see them.

Page 2 of 20
Velez-Colon | EE 454

4. Obtain the envelope of the raw image data by constructing the analytic signal img. Remember,
this signal contains the Hilbert transform of the raw data. Use the command hilbert, and pay
attention to what the output of this function is.

After using Hilbert and taking the magnitude of the result we get:
Hilbert without normalization

200

400

600

800

1000

1200

1400

1600

1800
50 100 150 200 250 300

Two examples of the envelope of the image are below:

200

400

600

800

1000

1200

1400

1600

1800
50 100 150 200 250 300

Page 3 of 20
Velez-Colon | EE 454

Envelope of the image

200

400

600

800

1000

1200

1400

1600

1800
50 100 150 200 250 300

Plot the histogram


Histogram
1800

1600

1400

1200
Pixel Values

1000

800

600

400

200

0
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5
Gaussian Distribution without logarithmic compression.

Page 4 of 20
Velez-Colon | EE 454

Plot the histogram after logarithmic compression.

Histogram after Logarithmic Compression


1800

1600

1400

1200

1000

800

600

400

200

0
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5

Compute the axial distance and plot spatial map.

The axial distance = 3.9500e-005

Page 5 of 20
Velez-Colon | EE 454

spatial map

10

15

20

25

30

35

40
0.0376 0.0378 0.038 0.0382 0.0384 0.0386 0.0388

Spatial Map usign logarithmic compression

10

15

20

25

30

35

40
1.125 1.13 1.135 1.14 1.145 1.15 1.155 1.16 1.165 1.17
-4
x 10

Page 6 of 20
Velez-Colon | EE 454

Plot of the image using small range.


range .5 to 15 without logarithmic compression
0.5

0.6

0.7

0.8

0.9

1.1

1.2

1.3

1.4

1.5
20 40 60 80 100 120 140

range .5 to 15 with logarithmic compression


0.5

0.6

0.7

0.8

0.9

1.1

1.2

1.3

1.4

1.5
20 40 60 80 100 120 140

Page 7 of 20
Velez-Colon | EE 454

Now we will repeat the exercise for carotid5.mat:

200

400

600

800

1000

1200

1400

1600

1800
50 100 150 200 250 300

Hilbert without normalization

200

400

600

800

1000

1200

1400

1600

1800
50 100 150 200 250 300

Page 8 of 20
Velez-Colon | EE 454

Envelope of the image

200

400

600

800

1000

1200

1400

1600

1800
50 100 150 200 250 300

Histogram
1800

1600

1400

1200
Pixel Values

1000

800

600

400

200

0
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5
Gaussian Distribution without logarithmic compression.

Page 9 of 20
Velez-Colon | EE 454

Compute the axial distance and plot:

The axial distance = 3.9500e-005


spatial map

10

15

20

25

30

35

40
0.04 0.041 0.042 0.043 0.044 0.045 0.046 0.047

Page 10 of 20
Velez-Colon | EE 454

Spatial Map usign logarithmic compression

10

15

20

25

30

35

40
2 2.05 2.1 2.15 2.2 2.25 2.3 2.35 2.4
-4
x 10

Histogram after Logarithmic Compression


1800

1600

1400

1200

1000

800

600

400

200

0
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5

Page 11 of 20
Velez-Colon | EE 454

range .5 to 15 without logarithmic compression


0.5

0.6

0.7

0.8

0.9

1.1

1.2

1.3

1.4

1.5
20 40 60 80 100 120 140

range .5 to 15 with logarithmic compression


0.5

0.6

0.7

0.8

0.9

1.1

1.2

1.3

1.4

1.5
20 40 60 80 100 120 140

Page 12 of 20
Velez-Colon | EE 454

MATLAB CODE
clc; clear; close all;
load('carotid5') % just change this to carotid9 to get the other results for
% part 2 Didn’t want to waste paper
figure(1)
image(bmode_rf);

%Obtain the envelope of the raw image data by constructing the analytic
signal img. Remember,
%this signal contains the Hilbert transform of the raw data. Use the command
hilbert, and
%pay attention to what the output of this function is.
x = hilbert(bmode_rf);
figure(2)
a=abs(x);
imagesc(a)
title('Hilbert without normalization')

% normalization
amax = max(max(a));
amin = min(min(a));

normalizeImage= (a / (amax-amin)) - amin;


figure(3)
imagesc(normalizeImage)
colormap bone
title('Envelope of the image');

%plot the histogram of normalizeImage


bins= linspace(0,50,50);% 50 equally spaced

figure(4)
hist(normalizeImage, bins)
axis([-.5 .5 0 1850]);
xlabel('Gaussian Distribution without logarithmic compression.');
ylabel('Pixel Values');
title('Histogram');

k=20; % scaling constant


c=.5;% compresion constant
logcompression = k * exp( log(normalizeImage) );% what I think is logarithmic
compression...

figure(5)
hist(logcompression, bins)
axis([-.5 .5 0 1850]);
title('Histogram after Logarithmic Compression');
% Axial Distance
% lambda = c/f where c is velocity and f is frequency and lambda is axial
% distance.
c= 1580;%m/s

f=40e6;

Page 13 of 20
Velez-Colon | EE 454

lambda=c/f

% spatial map
c=c*100;%cm/s
T=1/f;%sampling period
spatialMap = a(1,:) * c*T/2;
figure(6)
imagesc(spatialMap,posx_bmode,a)
title('spatial map')

figure(7)
spatialMap2 = logcompression(1,:) * c*T/2;
imagesc(spatialMap2,posx_bmode,a)
title('Spatial Map usign logarithmic compression')

figure(8)
imagesc(a(.5:.1:15));
title('range .5 to 15 without logarithmic compression')

figure(9)
imagesc(logcompression(.5:.1:15))
title('range .5 to 15 with logarithmic compression')

Page 14 of 20
Velez-Colon | EE 454

DOPLER EFFECT

Questions.

1. What variables are contained in this file?

Name Size Bytes Class Attributes


bmode_rf 1816x188 2731264 double
doppler_rf 1816x90x15 19612800 double
fc 1x1 8 double
fc_dop 1x1 8 double
posx_bmode 188x1 1504 double
posx_dop 90x1 720 double
prf 1x1 8 double

2. Envelope Detection:

Image after taking the hilbert and magnitude

200

400

600

800

1000

1200

1400

1600

1800
20 40 60 80 100 120 140 160 180

Page 15 of 20
Velez-Colon | EE 454

200

400

600

800

1000

1200

1400

1600

1800
20 40 60 80 100 120 140 160 180

Logarithmic Compression from .5 to 15

0.5

0.6

0.7

0.8

0.9

1.1

1.2

1.3

1.4

1.5
2 4 6 8 10 12 14

Doppler Images:

3. Look through the images over time. Do you see any difference?

I look at it at a glance and all the images look alike.

Page 16 of 20
Velez-Colon | EE 454

From left to right, images with respect to time:

1 2 3
200 200 200

400 400 400

600 600 600

800 800 800

1000 1000 1000

1200 1200 1200

1400 1400 1400

1600 1600 1600

1800 1800 1800


10 20 30 40 50 60 70 80 90 10 20 30 40 50 60 70 80 90 10 20 30 40 50 60 70 80 90

4 5 6
200 200 200

400 400 400

600 600 600

800 800 800

1000 1000 1000

1200 1200
1200

1400 1400
1400

1600 1600
1600

1800 1800
10 20 30 40 50 60 70 80 90 10 20 30 40 50 60 70 80 90 1800
10 20 30 40 50 60 70 80 90

You can notice small movements in the images.

After the filter was applied I looked though the image to get:

image after filtering


0.5

0.6

0.7

0.8

0.9

1.1

1.2

1.3

1.4

1.5
2 4 6 8 10 12 14

Page 17 of 20
Velez-Colon | EE 454

The sum of all doppler powers together:

dopplerPower 2.3325e+007

8
x 10 Doppler Power
3

2.5

1.5

0.5

0
0 20 40 60 80 100 120 140 160 180 200

Doppler Power Spatial Map

-30

-20

-10

10

20

30

40

50

60

70

4.5 5 5.5 6 6.5 7 7.5


4
x 10

Page 18 of 20
Velez-Colon | EE 454

MATLAB CODE
clc;clear; close all;
load('carotid9.mat');
x = hilbert(bmode_rf);
x = abs(x);
figure(1)
imagesc(x)
title('Image after taking the hilbert and magnitude');

% envelope detection
xmax = max(max(x));
xmin = min(min(x));
normalizeImage = abs(( x / (xmax - xmin) ) - xmin);

figure(2)
imagesc(normalizeImage)
title('envelope detector')
colormap bone;

% Logarithmic Compression
figure(3)
k = 20;
c = .1;
logCompression = k * exp( log (normalizeImage ) );
imagesc((logCompression))

figure(4)
imagesc(logCompression(.5:15))

%I only used this code to view the images of the doppler once, then I
%commented it out.
% for j=3:15
% figure(j)
% copyDopler=[];
% copy1Dopler=doppler_rf(:,:,j);
% imagesc(copy1Dopler)
%
% end

% filtering with butterworh


doppler_rf = doppler_rf (.5:15) ;
ORDER = 2;% by recomendation of the m file.
FCUTOFF = .5;
output=URIIIRfilter(doppler_rf,ORDER,FCUTOFF);
output= real(output);
% filtering ends

% looking througth the volume after filtering


figure(5)
imagesc(output)
title('image after filtering')

% analytical signal of each image (hilbert)

Page 19 of 20
Velez-Colon | EE 454

%calculating all analytical signals


result=[];
for i=1:187,
analyticalSignal1=[];% erase the data
analyticalSignal2=[];% erase the data

analyticalSignal1=hilbert(bmode_rf(:,i));
analyticalSignal2=conj(hilbert(bmode_rf(:,i+1)));
computation = analyticalSignal1 .* analyticalSignal2;
result=[result computation];% store all the computations to calculate
the phase later.

end
% angle returns the phase angle in radians

imaginary = imag(result);
realPart = real(result);
phaseSum = sum(atan(imaginary/realPart));

% doppler velocity
v = (c * fc / (4*pi*fc_dop)) .* phaseSum;

% doppler power
result2=[];
for i=1:187,
analyticalSignal1=[];% erase the data
analyticalSignal2=[];% erase the data

analyticalSignal1=hilbert(bmode_rf(:,i));
analyticalSignal2=conj(hilbert(bmode_rf(:,i)));
computation = analyticalSignal1 .* analyticalSignal2;
result2=[result2 computation];% store all the computations to calculate
the phase later.

end
% doppler power addition
dopplerPower2 =cumsum(result2);
dopplerPower2 =dopplerPower2(end);

% doppler power for spatial map


dopplerPower = sum(result2);
figure(6)
bar(dopplerPower)
title('Doppler Power')
%spatial map
c = 1540*100;
fs = 40e6;
T = 1/fs;
spatialMap = dopplerPower(1,:)*c*T/2;
figure(7)
imagesc(spatialMap,posx_bmode,dopplerPower)
title('Doppler Power Spatial Map')

Thank you Dr Won. I have learned more in the past quarters with you than in the past 5 years!
I hope you have a good “vacation.”

Page 20 of 20

Vous aimerez peut-être aussi