Hi,
I'm trying to run the B-mode ultrasound images example with different parameters. I wanted to see how the ultrasound would look for a 100x100x100 voxel grid with 1 voxel = 1mm.
I also modified the transducer to have 25 active elements instead of 32 and updated the position/radius of the balls.
Here's my modified lines:
% 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 = 256 - 2 * pml_x_size; % [grid points]
%Ny = 128 - 2 * pml_y_size; % [grid points]
%Nz = 128 - 2 * pml_z_size; % [grid points]
Nx = 140 - 2 * pml_x_size; % [grid points]
Ny = 120 - 2 * pml_y_size; % [grid points]
Nz = 120 - 2 * pml_z_size; % [grid points]
% set desired grid size in the x-direction not including the PML
%x = 40e-3; % [m]
x = 100e-3; % [m]
% calculate the spacing between the grid points
dx = x / Nx; % [m]
dy = dx; % [m]
dz = dx; % [m]
.
.
.
% physical properties of the transducer
%transducer.number_elements = 32; % total number of transducer elements
transducer.number_elements = 25; % total number of transducer elements
transducer.element_width = 2; % width of each element [grid points]
%transducer.element_length = 24; % length of each element [grid points]
transducer.element_length = 25; % length of each element [grid points]
transducer.element_spacing = 0; % spacing (kerf width) between the elements [grid points]
transducer.radius = inf; % radius of curvature of the transducer [m]
.
.
.
% define the transducer elements that are currently active
%number_active_elements = 32;
number_active_elements = 25;
transducer.active_elements = ones(transducer.number_elements, 1);
.
.
.
% define a large image size to move across
number_scan_lines = 100;
.
.
.
zPos = 50;
% define a sphere for a highly scattering region
%radius = 6e-3; % [m]
%x_pos = 27.5e-3; % [m]
%y_pos = 20.5e-3; % [m]
radius = 10; % [mm]
x_pos = 75; % [mm]
y_pos = 20.5; % [mm]
%scattering_region1 = makeBall(Nx_tot, Ny_tot, Nz_tot, round(x_pos/dx), round(y_pos/dx), zPos, round(radius/dx));
scattering_region1 = makeBall(Nx_tot, Ny_tot, Nz_tot, x_pos, y_pos, zPos, radius);
% assign region
sound_speed_map(scattering_region1 == 1) = scattering_c0(scattering_region1 == 1);
density_map(scattering_region1 == 1) = scattering_rho0(scattering_region1 == 1);
% define a sphere for a highly scattering region
%radius = 5e-3; % [m]
%x_pos = 30.5e-3; % [m]
%y_pos = 37e-3; % [m]
radius = 15; % [mm]
x_pos = 30.5; % [mm]
y_pos = 37; % [mm]
%scattering_region2 = makeBall(Nx_tot, Ny_tot, Nz_tot, round(x_pos/dx), round(y_pos/dx), zPos, round(radius/dx));
scattering_region2 = makeBall(Nx_tot, Ny_tot, Nz_tot, x_pos, y_pos, zPos, radius);
% assign region
sound_speed_map(scattering_region2 == 1) = scattering_c0(scattering_region2 == 1);
density_map(scattering_region2 == 1) = scattering_rho0(scattering_region2 == 1);
% define a sphere for a highly scattering region
%radius = 4.5e-3; % [m]
%x_pos = 15.5e-3; % [m]
%y_pos = 30.5e-3; % [m]
radius = 10; %[mm]
x_pos = 50; %[mm]
y_pos = 30.5; %[mm]
%scattering_region3 = makeBall(Nx_tot, Ny_tot, Nz_tot, round(x_pos/dx), round(y_pos/dx), zPos, round(radius/dx));
scattering_region3 = makeBall(Nx_tot, Ny_tot, Nz_tot, x_pos, y_pos, zPos, radius);
But when I run it, I get nearly a pure black image for the b-mode image.
It also looks like the original signal is also shifted.
Does my spacing for the grid (dx, dy,dz) effect the signal? If so, how should I determine how to adjust for it?