Hi,
In K-wave, is it possible to use finite size sensor (for example circular sensor of 10 mm diameter) instead of using a point sensor?
Hi,
In K-wave, is it possible to use finite size sensor (for example circular sensor of 10 mm diameter) instead of using a point sensor?
Hi deblina,
Probably the easiest thing to do in this case is to make a sensor mask covering the region you want your (single) sensor, then sum the time series together afterwards. That will model the effect of the finite size of the detector.
Hope that helps,
Ben
Hi Ben,
Thanks for your reply. In the post you have mentioned about 'time series'. Is it refer to the time domain signal (sensor_data)? If that is so, then the acquired signal from all the sensor point within that region should be summed or averaged?
Thanks and regards,
Deblina
Hi Deblina,
Yes, that's right. Sum the sensor_data so you only have one time series.
Best wishes,
Ben
Hello Ben,
I understand your point but I am bit confused between sum and average because in one of the K-wave examples given as follows:
clear all;
% =========================================================================
% SETUP THE GRID
% =========================================================================
% create the computational grid
Nx = 180; % number of grid points in the x (row) direction
Ny = 180; % number of grid points in the y (column) direction
dx = 0.1e-3; % grid point spacing in the x direction [m]
dy = 0.1e-3; % grid point spacing in the y direction [m]
kgrid = makeGrid(Nx, dx, Ny, dy);
% define the properties of the propagation medium
medium.sound_speed = 1500; % [m/s]
% define the array of time points [s]
[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed);
Nt = round(0.75*length(kgrid.t_array));
kgrid.t_array = (0:Nt-1)*dt;
% =========================================================================
% DEFINE A FOCUSSED ARRAY OF DIRECTIONAL ELEMENTS
% =========================================================================
% define a semicircular sensor centered on the grid
semicircle_radius = 65; % [grid points]
arc = makeCircle(Nx, Ny, Nx/2, Ny/2, semicircle_radius, pi);
% find total number and indices of the grid points constituting the
% semicircle
arc_indices = find(arc == 1);
Nv = length(arc_indices);
% calculate angles between grid points in the arc and the centre of the
% grid
arc_angles = atan((kgrid.y(arc_indices))./kgrid.x(arc_indices));
% sort the angles into ascending order, and adjust the indices accordingly
[sorted_arc_angles,sorted_index] = sort(arc_angles);
sorted_arc_indices = arc_indices(sorted_index);
% divide the semicircle into Ne separate sensor elements
Ne = 19;
sensor.mask = zeros(Nx,Ny);
for loop = 1:Ne
% the indices of the grid points belonging to one element.
% (There is a two grid point gap between the elements.)
voxel_indices = sorted_arc_indices(floor((loop-1)*Nv/Ne)+2:floor(loop*Nv/Ne)-1);
% add the element to the sensor.mask
sensor.mask(voxel_indices) = 1;
end
% =========================================================================
% SIMULATION
% =========================================================================
% Define an infinitely wide plane wave source. (This is achieved by turning
% off the PML.)
source.p_mask = zeros(Nx,Ny);
source.p_mask(140,:) = 1;
% set the display mask for the simulation
display_mask = source.p_mask + sensor.mask;
% define a time varying sinusoidal source
source_freq = 1e6;
source_mag = 0.5;
source.p = source_mag*sin(2*pi*source_freq*kgrid.t_array);
source.p = filterTimeSeries(kgrid, medium, source.p);
% run the simulation with the PML switched off on the sides, so that the
% source continues up to the edge of the domain (and from there infinitely,
% because of the periodic assumption implicit in pseudospectral methods).
input_args = {'PMLAlpha', [2 0], 'DisplayMask', display_mask, 'PlotScale', [-0.75 0.75]};
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});
% split up the data, recorded on all the grid points, between the elements
element_data = zeros(Ne,Nt);
for loop = 1:Ne
% the indices of the sensor grid points in the sensor mask
sensor_indices = find(sensor.mask==1);
% the indices of the grid points belonging to one element.
voxel_indices = sorted_arc_indices(floor((loop-1)*Nv/Ne)+2:floor(loop*Nv/Ne)-1);
% indices of sensor_data that refer to the data for this element
data_indices = zeros(length(voxel_indices),1);
for loop2 = 1:length(voxel_indices)
data_indices(loop2) = find(sensor_indices == voxel_indices(loop2));
end
% for one element per loop, average the time series from each of the
% element's grid points to give one time series for the whole element
element_data(loop,:) = mean(sensor_data(data_indices,:),1);
end
take the mean of sensor_data (last line of the code) to get the time series of one element(combination of multiple sensor points).
So I wonder which one will be suitable among sum and average (of sensor_data of multiple sensor points)to mimic a finite size sensor?
Regards,
Deblina
Dear all,
I want to use a finite size sensor (for example circular sensor of 10 mm diameter) instead of using a point sensor? According to Ben's suggestion:make a sensor mask covering the region you want your (single) sensor, then sum the time series together afterwards. I wonder whether the following code could achieve this goal?
% run the simulation
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});
%---model the effect of the finite size of the detector
%--sum the time series together afterwards
Num_point = 5 ; % Test points that need to be accumulated for a detector
interval = 2 ; % interval between the two detectors
N_elements = floor(num_sensor_points/(Num_point+interval)); %the total detectors
New_sensor_data = zeros(N_elements,kgrid.Nt);
for i=1:N_elements
loop_point = (N_elements-1)*(Num_point+interval);
New_sensor_data(i,:)=sum(sensor_data((loop_point+1):(loop_point+5),:),1);
end
Regards,
Zeng
Hi Zeng,
If you want the signal amplitude to match the pressure amplitude (at least when the interaction is coherent), I would take the average instead of the sum.
You could use the new kWaveArray
class to define a finite-sized sensor and use the inbuilt methods to do the averaging for you (karray.combineSensorData(kgrid, sensor_data)
).
Brad.
You must log in to post.