<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: Regarding Homogenous B-mode image simulation</title>
		<link>http://www.k-wave.org/forum/topic/regarding-homogenous-b-mode-image-simulation</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 22:54:07 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/regarding-homogenous-b-mode-image-simulation" rel="self" type="application/rss+xml" />

		<item>
			<title>Mekdes Bezabh on "Regarding Homogenous B-mode image simulation"</title>
			<link>http://www.k-wave.org/forum/topic/regarding-homogenous-b-mode-image-simulation#post-9217</link>
			<pubDate>Mon, 26 May 2025 21:37:15 +0000</pubDate>
			<dc:creator>Mekdes Bezabh</dc:creator>
			<guid isPermaLink="false">9217@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Please, I wonder if anyone can suggest any solution.&#60;/p&#62;
&#60;p&#62;Thank you in advance.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Mekdes Bezabh on "Regarding Homogenous B-mode image simulation"</title>
			<link>http://www.k-wave.org/forum/topic/regarding-homogenous-b-mode-image-simulation#post-9215</link>
			<pubDate>Wed, 21 May 2025 18:15:24 +0000</pubDate>
			<dc:creator>Mekdes Bezabh</dc:creator>
			<guid isPermaLink="false">9215@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear All,&#60;/p&#62;
&#60;p&#62;I have some questions regarding the code &#34;example_us_bmode_linear_transducer.&#34; I am trying to create a homogeneous B-mode image without any artifacts. I have tested different values for the tone burst frequency—3.47 MHz, 7.8 MHz, and 15.62 MHz—along with varying values for the medium's alpha coefficient and alpha power, while keeping the sound speed and density uniform. I am using a plane wave setup with the focus set to infinity.&#60;/p&#62;
&#60;p&#62;However, I encountered some unexpected results: &#60;/p&#62;
&#60;p&#62;1. At a frequency of 3.47 MHz, the resulting B-mode image was not as expected.&#60;br /&#62;
2. At 7.8 MHz, I observed a bright line in the middle of the final B-mode image.&#60;br /&#62;
3. The same issue occurred at 15.62 MHz.&#60;/p&#62;
&#60;p&#62;I would appreciate your assistance in determining whether my code is correct, as this simulation software is crucial for my project. I would also like to share my code for your review if you have some time to look at it and provide your valuable suggestions.&#60;/p&#62;
&#60;p&#62;Thank you for your attention.&#60;/p&#62;
&#60;p&#62;The code:&#60;/p&#62;
&#60;p&#62;RUN_SIMULATION  = true;    &#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE K-WAVE GRID&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% set the size of the perfectly matched layer (PML)&#60;br /&#62;
pml_x_size = 20;                % [grid points]&#60;br /&#62;
pml_y_size = 10;                % [grid points]&#60;br /&#62;
pml_z_size = 1;                 % [grid points]&#60;br /&#62;
% set total number of grid points not including the PML&#60;br /&#62;
Nx = 256*2 - 2 * pml_x_size;      % [grid points]&#60;br /&#62;
Ny = 128*2 - 2 * pml_y_size;      % [grid points]&#60;br /&#62;
Nz = 2;                       % [grid points]                 %128 - 2 * pml_z_size;&#60;br /&#62;
x= 40e-3;&#60;br /&#62;
dx = x / Nx;&#60;br /&#62;
dy = dx;&#60;br /&#62;
dz = dx;                    % [m]&#60;br /&#62;
% create the k-space grid&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PARAMETERS&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% define the properties of the propagation medium&#60;br /&#62;
c0 = 1540;                      % [m/s]&#60;br /&#62;
rho0 = 1000;                    % [kg/m^3]&#60;br /&#62;
% medium.alpha_mode = 'no_dispersion';&#60;br /&#62;
medium.alpha_coeff = 0.5;      % [dB/(MHz^y cm)]&#60;br /&#62;
medium.alpha_power = 1.0;&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
t_end = (Nx * dx) * 2.2 / c0;   % [s]&#60;br /&#62;
kgrid.makeTime(c0, [], t_end);&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% DEFINE THE INPUT SIGNAL&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% define properties of the input signal&#60;br /&#62;
source_strength = 1e6;          % [Pa]&#60;br /&#62;
tone_burst_freq = 15.62e6;        % [Hz]   7.8 MHz, 3.47 MHz&#60;br /&#62;
tone_burst_cycles = 4;&#60;br /&#62;
% create the input signal using toneBurst&#60;br /&#62;
input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);&#60;br /&#62;
% scale the source magnitude by the source_strength divided by the&#60;br /&#62;
% impedance (the source is assigned to the particle velocity)&#60;br /&#62;
input_signal = (source_strength ./ (c0 * rho0)) .* input_signal;&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% DEFINE THE ULTRASOUND TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% physical properties of the transducer&#60;br /&#62;
transducer.number_elements = 32;  	% total number of transducer elements&#60;br /&#62;
transducer.element_width = 2;       % width of each element [grid points]&#60;br /&#62;
transducer.element_length = 1;     %24;  	% length of each element [grid points]&#60;br /&#62;
transducer.element_spacing = 0;  	% spacing (kerf  width) between the elements [grid points]&#60;br /&#62;
transducer.radius = inf;            % radius of curvature of the transducer [m]&#60;br /&#62;
% calculate the width of the transducer in grid points&#60;br /&#62;
transducer_width = transducer.number_elements * transducer.element_width ...&#60;br /&#62;
    + (transducer.number_elements - 1) * transducer.element_spacing;&#60;br /&#62;
% use this to position the transducer in the middle of the computational grid&#60;br /&#62;
transducer.position = round([1, Ny/2 - transducer_width/2, Nz/2 - transducer.element_length/2]);&#60;br /&#62;
% properties used to derive the beamforming delays&#60;br /&#62;
transducer.sound_speed = c0;                    % sound speed [m/s]&#60;br /&#62;
% transducer.focus_distance = Inf;  %40e-3;              % focus distance [m]&#60;br /&#62;
% transducer.elevation_focus_distance = Inf;  %19e-3;    % focus distance in the elevation plane [m]&#60;br /&#62;
transducer.steering_angle = 0;                  % steering angle [degrees]&#60;br /&#62;
% apodization&#60;br /&#62;
transducer.transmit_apodization = 'Hanning';&#60;br /&#62;
transducer.receive_apodization = 'Rectangular';&#60;br /&#62;
% define the transducer elements that are currently active&#60;br /&#62;
number_active_elements = 32;&#60;br /&#62;
transducer.active_elements = ones(transducer.number_elements, 1);&#60;br /&#62;
% append input signal used to drive the transducer&#60;br /&#62;
transducer.input_signal = input_signal;&#60;br /&#62;
% create the transducer using the defined settings&#60;br /&#62;
transducer = kWaveTransducer(kgrid, transducer);&#60;br /&#62;
% print out transducer properties&#60;br /&#62;
transducer.properties;&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PROPERTIES&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% define a large image size to move across&#60;br /&#62;
number_scan_lines = 96;&#60;br /&#62;
Nx_tot = Nx;&#60;br /&#62;
Ny_tot = Ny + number_scan_lines * transducer.element_width;&#60;br /&#62;
Nz_tot = Nz;&#60;br /&#62;
% define a random distribution of scatterers for the medium&#60;br /&#62;
background_map_mean = 1;&#60;br /&#62;
background_map_std = 0.008;&#60;br /&#62;
background_map = background_map_mean + background_map_std * randn([Nx_tot, Ny_tot, Nz_tot]);&#60;br /&#62;
sound_speed_map = c0 * ones(Nx_tot, Ny_tot, Nz_tot) .* background_map;&#60;br /&#62;
density_map = rho0 * ones(Nx_tot, Ny_tot, Nz_tot) .* background_map;  &#60;/p&#62;
&#60;p&#62;% RUN THE SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% preallocate the storage&#60;br /&#62;
scan_lines = zeros(number_scan_lines, kgrid.Nt);&#60;/p&#62;
&#60;p&#62;% set the input settings&#60;br /&#62;
input_args = {...&#60;br /&#62;
    'PMLInside', false, 'PMLSize', [pml_x_size, pml_y_size, pml_z_size], ...&#60;br /&#62;
    'DataCast', DATA_CAST, 'DataRecast', true, 'PlotSim', false};&#60;br /&#62;
% run the simulation if set to true, otherwise, load previous results from&#60;br /&#62;
% disk&#60;br /&#62;
h = waitbar(0,'Please wait...');&#60;br /&#62;
if RUN_SIMULATION&#60;br /&#62;
    % set medium position&#60;br /&#62;
    medium_position = 1;&#60;br /&#62;
    % loop through the scan lines&#60;br /&#62;
    for scan_line_index = 1:number_scan_lines&#60;br /&#62;
        scan_line_index&#60;br /&#62;
        waitbar(scan_line_index/number_scan_lines,h)&#60;br /&#62;
        % update the command line status&#60;br /&#62;
        disp('');&#60;br /&#62;
        disp(['Computing scan line ' num2str(scan_line_index) ' of ' num2str(number_scan_lines)]);&#60;/p&#62;
&#60;p&#62;        % load the current section of the medium&#60;br /&#62;
        medium.sound_speed = sound_speed_map(:, medium_position:medium_position + Ny - 1, :);&#60;br /&#62;
        medium.density = density_map(:, medium_position:medium_position + Ny - 1, :);&#60;/p&#62;
&#60;p&#62;        % run the simulation&#60;br /&#62;
        sensor_data = kspaceFirstOrder3D(kgrid, medium, transducer, transducer, input_args{:});&#60;br /&#62;
        % extract the scan line from the sensor data&#60;br /&#62;
        scan_lines(scan_line_index, :) = transducer.scan_line(sensor_data);&#60;/p&#62;
&#60;p&#62;        % update medium position&#60;br /&#62;
        medium_position = medium_position + transducer.element_width;&#60;br /&#62;
    end&#60;br /&#62;
    % save the scan lines to disk&#60;br /&#62;
    save HomogeneousTriaNew_scan_lines.mat;&#60;/p&#62;
&#60;p&#62;else&#60;/p&#62;
&#60;p&#62;    % load the scan lines from disk&#60;br /&#62;
    load ('HomogeneousReferenceNew_scan_lines.mat');&#60;/p&#62;
&#60;p&#62;end&#60;br /&#62;
scan_lines_saved = scan_lines;&#60;br /&#62;
scan_lines = scan_lines_saved;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
