<?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: Simulating B-mode image of Lung Ultrasonography</title>
		<link>http://www.k-wave.org/forum/topic/simulating-b-mode-image-of-lung-ultrasonography</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:11:09 +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/simulating-b-mode-image-of-lung-ultrasonography" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Simulating B-mode image of Lung Ultrasonography"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-b-mode-image-of-lung-ultrasonography#post-7548</link>
			<pubDate>Sat, 06 Jun 2020 13:04:28 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7548@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Cyrill,&#60;/p&#62;
&#60;p&#62;Unfortunately your image links don't seem to work. One general point, you may need to add small-scale diffusive scatters to the different tissue regions to allow the speckle pattern to be visualised (similar to what is done in the B-mode imaging examples).&#60;/p&#62;
&#60;p&#62;Brad
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Cyrill on "Simulating B-mode image of Lung Ultrasonography"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-b-mode-image-of-lung-ultrasonography#post-7483</link>
			<pubDate>Wed, 06 May 2020 08:46:40 +0000</pubDate>
			<dc:creator>Cyrill</dc:creator>
			<guid isPermaLink="false">7483@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thanks Brad for your feedback! I had already implemented most of the recommendations in adjusting the air impedance but I am still far away from what I am looking for. While the ultimate goal is to do this based on a CT scan I have for the time being worked on a phantom water-muscle-bone-air with some questionable results so far: &#60;a href=&#34;https://uvu.box.com/s/g3gvsn9hsqgkmgou5rrerw051dv0nxdu&#34; rel=&#34;nofollow&#34;&#62;https://uvu.box.com/s/g3gvsn9hsqgkmgou5rrerw051dv0nxdu&#60;/a&#62; and &#60;a href=&#34;https://uvu.box.com/s/ve6luvguugy12k2548w42u1jdw680cut&#34; rel=&#34;nofollow&#34;&#62;https://uvu.box.com/s/ve6luvguugy12k2548w42u1jdw680cut&#60;/a&#62;&#60;br /&#62;
The ultimate goal is to show the same b-line and comet tail artefacts as published elsewhere (&#60;a href=&#34;https://uvu.box.com/s/17dp9niwjip9auv0v351oxgjznxwrvf1&#34; rel=&#34;nofollow&#34;&#62;https://uvu.box.com/s/17dp9niwjip9auv0v351oxgjznxwrvf1&#60;/a&#62;) Their 30MHz results are obliviously a long reach but I am looking for a better place to start as I am afraid I'm still quite a way off and not quite sure where to start improving my results.&#60;/p&#62;
&#60;p&#62;Thanks!&#60;/p&#62;
&#60;p&#62;Cyrill
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Simulating B-mode image of Lung Ultrasonography"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-b-mode-image-of-lung-ultrasonography#post-7458</link>
			<pubDate>Fri, 01 May 2020 08:35:13 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">7458@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Cyrill,&#60;/p&#62;
&#60;p&#62;What is it that you're struggling with? You could try adding the structure of the lung to the medium properties, keeping in mind that k-Wave struggles a bit with contrast between soft tissue and air (a work around is discussed in &#60;a href=&#34;http://www.k-wave.org/forum/topic/simulation-of-ultrasonic-testing-borehole-in-solid#post-6473&#34;&#62;this post&#60;/a&#62;).&#60;/p&#62;
&#60;p&#62;Brad
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Cyrill on "Simulating B-mode image of Lung Ultrasonography"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-b-mode-image-of-lung-ultrasonography#post-7440</link>
			<pubDate>Mon, 27 Apr 2020 08:07:32 +0000</pubDate>
			<dc:creator>Cyrill</dc:creator>
			<guid isPermaLink="false">7440@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear All,&#60;/p&#62;
&#60;p&#62;while this thread appears to have been dormant for a while I wanted to see if anyone could share some experiences/ideas. In particular I am interested in recreating b-line artifacts in lung images but have so far been unsuccessful. &#60;/p&#62;
&#60;p&#62;Any guidance would be highly appreciated!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Simulating B-mode image of Lung Ultrasonography"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-b-mode-image-of-lung-ultrasonography#post-6835</link>
			<pubDate>Wed, 10 Apr 2019 12:55:47 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6835@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Fellipe,&#60;/p&#62;
&#60;p&#62;I can't run your code (the &#60;code&#62;gerar_matrix&#60;/code&#62; function or matrix is missing). Could you post a working example?&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fellipe.silva on "Simulating B-mode image of Lung Ultrasonography"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-b-mode-image-of-lung-ultrasonography#post-6801</link>
			<pubDate>Tue, 26 Mar 2019 16:19:38 +0000</pubDate>
			<dc:creator>fellipe.silva</dc:creator>
			<guid isPermaLink="false">6801@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello to everyone,&#60;/p&#62;
&#60;p&#62;I am a new user of k-Wave.&#60;/p&#62;
&#60;p&#62;I am trying to simulate a image acquisition of a muscle + pleura + lung phantom in a water medium. Lung ultrasonography is based in reverberations artifacts. Multiple horizontal lines can be seen after the pleural line as result of the big impedance difference between tissue and air inside the lung. Ultrasound signal reflects multiple times between pleura and transducer, and this artifact helps to do lung diagnosis.&#60;/p&#62;
&#60;p&#62;I tried to simulate that effect in a 2-D model. As lung air is much more abundant than tissue, I used air velocity and density as parameters of the lung. Although, result image is all black with only the pleura line visible. &#60;/p&#62;
&#60;p&#62;Is it possible to reproduce this reverberation with K-Wave?&#60;/p&#62;
&#60;p&#62;My code was that:&#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 = 20;            % [grid points]&#60;br /&#62;
% set total number of grid points not including the PML&#60;br /&#62;
Nx = 500+40-2*pml_x_size;   % [grid points]&#60;br /&#62;
Ny = 240+40-2*pml_y_size;   % [grid points]&#60;/p&#62;
&#60;p&#62;% set desired grid size in the x-direction not including the PML&#60;br /&#62;
x = 1e-2;                  % [m]&#60;br /&#62;
y = 48e-4;&#60;/p&#62;
&#60;p&#62;% calculate the spacing between the grid points&#60;br /&#62;
dx = x/Nx;                  % [m]&#60;br /&#62;
dy = dx;                    % [m]&#60;/p&#62;
&#60;p&#62;% create the k-space grid&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;% define a large image size to move across&#60;br /&#62;
number_scan_lines = 200;&#60;br /&#62;
Nx_tot = Nx;&#60;br /&#62;
Ny_tot = Ny + number_scan_lines;&#60;/p&#62;
&#60;p&#62;% scatter size&#60;br /&#62;
number_scatters1 = 32;&#60;br /&#62;
number_scatters5 = 512;&#60;/p&#62;
&#60;p&#62;area_total=x*y*1000000;&#60;br /&#62;
n_total1=area_total*number_scatters1;&#60;br /&#62;
n_total5=area_total*number_scatters5;&#60;/p&#62;
&#60;p&#62;matrix1 = gerar_matrix(Nx_tot,Ny_tot,n_total1);&#60;br /&#62;
matrix5 = gerar_matrix(Nx_tot,Ny_tot,n_total5);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PARAMETERS&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;    clearvars -except T pulse_freq pml_x_size pml_y_size Nx Ny ...&#60;br /&#62;
        x y dx dy kgrid resolution_x resolution_y area_total n_total ...&#60;br /&#62;
        matrix1 matrix2 matrix3 matrix4 matrix5 matrix6 number_scan_lines Nx_tot Ny_tot number_scatters...&#60;br /&#62;
        x_pos mapUp mapDown c0 rho0 medium.alpha_coeff medium.alpha_power...&#60;br /&#62;
        medium.BonA t_end kgrid.t_array&#60;/p&#62;
&#60;p&#62; T=37;&#60;br /&#62;
 pulse_freq = 5e6;&#60;/p&#62;
&#60;p&#62;vMuscle = 1471.4+3.9979*T-0.03513*T.^2&#60;br /&#62;
rhoMuscle = 1065&#60;br /&#62;
vPleura = 1613;&#60;br /&#62;
rhoPleura = 1120;&#60;br /&#62;
vAir = 331.45*((T+273.15)/273.15)^(1/2);&#60;br /&#62;
rhoAir = 101325/(287.058*(T+273.15));&#60;br /&#62;
vWater = speedSoundWater(T);&#60;br /&#62;
rhoWater = 1000;&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium1&#60;br /&#62;
c0 = vWater;                  % [m/s]&#60;br /&#62;
rho0 = rhoWater;                % [kg/m^3]&#60;br /&#62;
medium.alpha_coeff = 0.002; 	% [dB/(MHz^y cm)]&#60;br /&#62;
medium.alpha_power = 2;&#60;br /&#62;
medium.BonA = 5.2;&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
t_end = (Nx*dx)*2.2/c0;     % [s]&#60;br /&#62;
CFL = 0.05;&#60;br /&#62;
kgrid.t_array = makeTime(kgrid, c0, CFL, t_end);&#60;/p&#62;
&#60;p&#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 = 5e6;%*blackman(128);        % [Pa]&#60;br /&#62;
tone_burst_freq = pulse_freq;     % [Hz]&#60;br /&#62;
tone_burst_cycles = 4;&#60;/p&#62;
&#60;p&#62;% lambda&#60;br /&#62;
lambda=c0/tone_burst_freq;&#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;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE ULTRASOUND SOURCE&#60;br /&#62;
% =========================================================================&#60;br /&#62;
source_width = 128; % [grid points]&#60;br /&#62;
source.p_mask = zeros(Nx, Ny);&#60;br /&#62;
source.p_mask(1, Ny/2 - source_width/2+1:Ny/2 + source_width/2) = 1;&#60;/p&#62;
&#60;p&#62;sensor_focus = [45e-4,0]; %[m]&#60;/p&#62;
&#60;p&#62;input_signal = focus(kgrid,input_signal,source.p_mask,sensor_focus,vWater);&#60;/p&#62;
&#60;p&#62;source.p=input_signal;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE ULTRASOUND SENSOR&#60;br /&#62;
% =========================================================================&#60;br /&#62;
sensor_offset=1;&#60;br /&#62;
sensor.mask = zeros(Nx, Ny);&#60;br /&#62;
sensor.mask(sensor_offset, Ny/2 - source_width/2+1: Ny/2 + source_width/2) = 1;&#60;br /&#62;
sensor.record={'p'};&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PROPERTIES&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;density_map=ones(size(matrix1)).*rhoWater;&#60;br /&#62;
sound_speed_map=ones(size(matrix1)).*vWater;&#60;/p&#62;
&#60;p&#62;sound_speed_map(matrix1 == 0) = 0;&#60;br /&#62;
density_map(matrix1 == 0) = 0;&#60;/p&#62;
&#60;p&#62;% define a sphere for a highly scattering region&#60;br /&#62;
x_pos = 25e-5;    % [m]&#60;br /&#62;
y_pos = 44e-4;    % [m]&#60;/p&#62;
&#60;p&#62;%%%%%%%%%%%%%%%&#60;br /&#62;
Linha1=makeLine(Nx_tot, Ny_tot,[(round(x_pos/dx)),round((y_pos-18e-4)/dy)],[(round(x_pos/dx)),round((y_pos+18e-4)/dy)]);&#60;br /&#62;
for i=1:125&#60;br /&#62;
    Linha1=Linha1+makeLine(Nx_tot, Ny_tot,[(round(x_pos/dx)+i),round((y_pos-18e-4)/dy)],[(round(x_pos/dx)+i),round((y_pos+18e-4)/dy)]);&#60;br /&#62;
end&#60;br /&#62;
%%%%%%%%%%%%%%%%%%%%&#60;br /&#62;
Linha2=makeLine(Nx_tot, Ny_tot,[(round(x_pos/dx)+126),round((y_pos-18e-4)/dy)],[(round(x_pos/dx)+126),round((y_pos+18e-4)/dy)]);&#60;br /&#62;
for i=127:150&#60;br /&#62;
    Linha2=Linha2+makeLine(Nx_tot, Ny_tot,[(round(x_pos/dx)+i),round((y_pos-18e-4)/dy)],[(round(x_pos/dx)+i),round((y_pos+18e-4)/dy)]);&#60;br /&#62;
end&#60;br /&#62;
%%%%%%%%%%%%%%%%%&#60;br /&#62;
Linha3=makeLine(Nx_tot, Ny_tot,[(round(x_pos/dx)+151),round((y_pos-18e-4)/dy)],[(round(x_pos/dx)+151),round((y_pos+18e-4)/dy)]);&#60;br /&#62;
for i=152:450&#60;br /&#62;
   Linha3=Linha3+makeLine(Nx_tot, Ny_tot,[(round(x_pos/dx)+i),round((y_pos-18e-4)/dy)],[(round(x_pos/dx)+i),round((y_pos+18e-4)/dy)]);&#60;br /&#62;
end&#60;br /&#62;
%%%%%%%%%%%%%%%%%&#60;/p&#62;
&#60;p&#62;% assign region&#60;br /&#62;
sound_speed_map(Linha1 == 1 ) = matrix5(Linha1 == 1)*vMuscle;&#60;br /&#62;
density_map(Linha1 == 1) = matrix5(Linha1 == 1)*rhoMuscle;&#60;/p&#62;
&#60;p&#62;sound_speed_map(Linha2 == 1 ) = matrix5(Linha2 == 1)*vPleura;&#60;br /&#62;
density_map(Linha2 == 1) = matrix5(Linha2 == 1)*rhoPleura;&#60;/p&#62;
&#60;p&#62;sound_speed_map(Linha3 == 1 ) = matrix5(Linha3 == 1)*vAir;&#60;br /&#62;
density_map(Linha3 == 1) = matrix5(Linha3 == 1)*rhoAir;&#60;/p&#62;
&#60;p&#62;sound_speed_map(sound_speed_map==0)=vWater;&#60;br /&#62;
density_map(density_map==0)=rhoWater;&#60;/p&#62;
&#60;p&#62;% plot the medium, truncated to the field of view&#60;br /&#62;
figure;&#60;br /&#62;
imagesc((0:number_scan_lines-1)*dy*1e3, (0:Nx_tot-1)*dx*1e3, density_map(:, 1 + Ny/2:end - Ny/2));&#60;br /&#62;
axis image;&#60;br /&#62;
colormap(gray);&#60;br /&#62;
set(gca, 'YLim', [1, 10]);&#60;br /&#62;
title('Scattering Phantom');&#60;br /&#62;
xlabel('Horizontal Position [mm]');&#60;br /&#62;
ylabel('Depth [mm]');&#60;/p&#62;
&#60;p&#62;% ========================================================================&#60;br /&#62;
% RUN THE SIMULATION&#60;br /&#62;
% ========================================================================&#60;br /&#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;
DATA_CAST       = 'gpuArray-single';     % set to 'single' or 'gpuArray-single' to speed up computations&#60;br /&#62;
input_args = {...&#60;br /&#62;
    'PMLInside', false, 'PMLSize', [pml_x_size, pml_y_size], ...&#60;br /&#62;
    'DataCast', DATA_CAST, 'DataRecast', true, 'PlotSim', false};&#60;/p&#62;
&#60;p&#62;% set medium position&#60;br /&#62;
medium_position = 1;&#60;/p&#62;
&#60;p&#62;        for scan_line_index = 1:number_scan_lines&#60;/p&#62;
&#60;p&#62;            % update the command line status&#60;br /&#62;
            disp(['&#124;&#124; =============== T = ' num2str(T) ' =============== &#124;&#124;']);&#60;br /&#62;
            disp('');&#60;br /&#62;
            disp(['&#124;&#124; =============== Freq = ' num2str(pulse_freq) ' =============== &#124;&#124;']);&#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 = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;            % extract the scan line from the sensor data&#60;br /&#62;
            scan_lines(scan_line_index, :) = sum(bsxfun(@times, hanning(128),sensor_data.p)); %bsxfun(@times, tgc, scan_lines);&#60;/p&#62;
&#60;p&#62;            % update medium position&#60;br /&#62;
            medium_position = medium_position + 1;&#60;br /&#62;
            % save(['Sim_2_resultsWindow',num2str(number_scatters)])&#60;br /&#62;
        end&#60;/p&#62;
&#60;p&#62;    save(['sim_Rectangle_lus_CFL005'])&#60;/p&#62;
&#60;p&#62;%    end&#60;br /&#62;
% end
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
