Dear All,
I am trying to do a simple US image simulation using K-wave [Transducer as source and sensor]. Quite new to it. I created a medium and then a ball in the middle with different speed of sound and density. I expected only the reflection from the ball. Instead I am seeing a very high signal in the beginning of time trace (May be input signal?, How to get rid?) and different reverberations at almost all depths. What may be the reason for this? I put my transducer below PML. I am pasting my script below. Can anyone please throw your views on it? It would be of great help for me to move forward.
clear all;
clc
% simulation settings
DATA_CAST = 'single';
% =========================================================================
% DEFINE THE K-WAVE GRID
% =========================================================================
% set the size of the perfectly matched layer (PML)
PML_X_SIZE = 20; % [grid points]
PML_Y_SIZE = 10; % [grid points]
PML_Z_SIZE = 10; % [grid points]
% set total number of grid points not including the PML
Nx = 512 - 2*PML_X_SIZE; % [grid points]
Ny = 512 - 2*PML_Y_SIZE; % [grid points]
Nz = 128 - 2*PML_Z_SIZE; % [grid points]
% set desired grid size in the x-direction not including the PML
x = 30e-3; % [m]
% calculate the spacing between the grid points
dx = x/Nx; % [m]
dy = dx; % [m]
dz = dx; % [m]
% create the k-space grid
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);
% Total time, 2 times for US
t_end = (x/1500)*2; % [s]
[kgrid.t_array,dt] = makeTime(kgrid, 1500, [], t_end);
% =========================================================================
% DEFINE THE INPUT SIGNAL
% =========================================================================
% define properties of the input signal
source_strength = 5e6; % [Pa]
tone_burst_freq = 1.5e6; % [Hz]
tone_burst_cycles = 2;
% create the input signal using toneBurst
input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);
% scale the source magnitude by the source_strength divided by the
% impedance (the source is assigned to the particle velocity)
input_signal = (source_strength./(1500*1000)).*input_signal;
medium.sound_speed =1500; % [m/s]
medium.density = 1000; % [kg/m^3]
% medium.alpha_coeff = 0.0022; % [dB/(MHz^y cm)]
% medium.alpha_power = 2;
% medium.BonA = 6;
% define properties
density_map = 1000*ones(Nx_tot, Ny_tot, Nz_tot);
medium.density = density_map (:,:,:);
ball_radius = round(.1e-3/dx); % [mm]
p1 = 962*makeBall(Nx, Ny, Nz,PML_X_SIZE + round(16e-3/dx),PML_Y_SIZE + round(15e-3/dx), PML_Z_SIZE + Nz/2, ball_radius);
medium.density = medium.density + p1;
% DEFINE THE ULTRASOUND TRANSDUCER
% =========================================================================
% physical properties of the transducer
transducer.number_elements = 64; % total number of transducer elements
transducer.element_width = 2; % width of each element [grid points/voxels]
transducer.element_length = 24; % length of each element [grid points/voxels]
transducer.element_spacing = 0; % spacing (kerf width) between the elements [grid points/voxels]
transducer.radius = inf; % radius of curvature of the transducer [m]
% calculate the width of the transducer in grid points
transducer_width = transducer.number_elements*transducer.element_width ...
+ (transducer.number_elements - 1)*transducer.element_spacing;
% use this to position the transducer in the middle of the computational grid
transducer.position = round([PML_X_SIZE+1, Ny/2 - transducer_width/2, Nz/2 - transducer.element_length/2]);
% properties used to derive the beamforming delays
transducer.sound_speed = 1500; % sound speed [m/s]
transducer.focus_distance = 15e-3; % focus distance [m]
transducer.elevation_focus_distance = 16e-3 + PML_X_SIZE; % focus distance in the elevation plane [m]
transducer.steering_angle = 0; % steering angle [degrees]
% apodization
transducer.transmit_apodization = 'Hanning';
transducer.receive_apodization = 'Rectangular';
% define the transducer elements that are currently active
transducer.active_elements = zeros(transducer.number_elements, 1);
transducer.active_elements(1:transducer.number_elements) = 1;
transducer.input_signal = input_signal;
% create the transducer using the defined settings
transducer = makeTransducer(kgrid, transducer);
% print out transducer properties
transducer.properties;
% =========================================================================
% RUN THE SIMULATION
% =========================================================================
sensor.mask=transducer.all_elements_mask;
% set the input settings
input_args = {...
'PMLInside', false, 'PlotSim', false, 'PMLSize', [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE], ...
'DataCast', DATA_CAST};
% run the simulation
sensor_data = kspaceFirstOrder3DC(kgrid, medium, transducer, transducer, input_args{:});
% extract a single scan line from the sensor data using the current
% beamforming settings
scan_line = transducer.scan_line(sensor_data);
% reshape sensor data to y, z, t
sensor_data_rs = reshape(sensor_data, transducer.number_elements*transducer.element_width, transducer.element_length, length(kgrid.t_array));
Thank You
Kind Regards,
Mithun