Hi guys,
I am new to this k-Wave library. My aim is to create a sector scan image using scanConversion
method. I have the signal data for several plane wave angles with time. I have arranged the data into a matrix of sized nAngles vs Time
as required in the documentation. I have also specified what are the scan angles used in the data, the time difference between samples, and the image size. However, somehow the result is all zero matrix. I could not think of what potential issues that happens here. Looking forward for your insights!
Thanks!
Btw, here is the code:
function result = process()
load('data.mat');
% Compute the time delay
% Reference point: The left most element as the first element
dx = 10; % in mm
theta = [-10 -5 0 5 10]; % in degrees
na = 5; % no of steering angles
c = 6300; % speed of sound in m/s
thetaradian = theta * pi/180;
Fs = Receive(1).decimSampleRate * 1e6;
ts = 1/Fs;
tStart = 0;
N = Receive(1).endSample;
t = tStart + (0:N-1)*ts;
example = RcvData{1}(Receive(1).startSample:Receive(1).endSample, 1, 1);
sz = size(example);
scanLines = zeros([na sz(1)]);
for j = 1:5
accumulated = RcvData{1}(Receive(j).startSample:Receive(j).endSample, 1, 1);
accumulated = double(accumulated);
sz = size(accumulated);
dt = dx * 1e-3 * sin(thetaradian(j))/c; % time delay per elem, in s
for i = 2:3
curr = RcvData{1}(Receive(j).startSample:Receive(j).endSample, i, 1);
zipped = [t' double(curr)];
td = (i-1) * dt;
zipped(:,1) = zipped(:,1) - td;
zipped = zipped(zipped(:,1) >= t(1) & zipped(:,1) <= t(end),:);
filtered = zipped(:,2);
szFiltered = size(filtered);
if (td < 0)
padded = [zeros([sz(1) - szFiltered(1) 1]); filtered];
else
padded = [filtered; zeros([sz(1) - szFiltered(1) 1])];
end
accumulated = accumulated + padded;
end
% post processing
% 1. High pass filtering
accumulated = highpass(accumulated, 10000, Fs);
% 2. Rectification
accumulated = abs(accumulated);
% 3. Enveloping
[accumulated, dummy] = envelope(accumulated,300,'peak');
scanLines(j,:) = accumulated';
end
% k-Wave scanConversion part
image_size = [480 480];
b_mode = scanConversion(scanLines, theta, image_size, c, t(2)-t(1));
result = b_mode;
end