<?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: US probe frequency</title>
		<link>http://www.k-wave.org/forum/topic/us-probe-frequency</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:38:08 +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/us-probe-frequency" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "US probe frequency"</title>
			<link>http://www.k-wave.org/forum/topic/us-probe-frequency#post-6233</link>
			<pubDate>Tue, 12 Dec 2017 22:39:57 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6233@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Amanda,&#60;/p&#62;
&#60;p&#62;Unfortunately, the geometry functions in k-Wave assume the grid is uniform. You could write your own function to get around this without too much effort by using the Cartesian coordinates of the grid points, rather than the grid coordinates.&#60;/p&#62;
&#60;p&#62;However, I would suggest keeping dx = dy = dz, otherwise the grid will support a different maximum frequency in each direction.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Amanda on "US probe frequency"</title>
			<link>http://www.k-wave.org/forum/topic/us-probe-frequency#post-6218</link>
			<pubDate>Thu, 16 Nov 2017 02:01:07 +0000</pubDate>
			<dc:creator>Amanda</dc:creator>
			<guid isPermaLink="false">6218@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello :)&#60;br /&#62;
I recently started studies related to reconstruction of ultrasound images and I am using kwave software (the example of the b-mode using linear transducer) to implement functions as spatial compound and pulse inversion harmonic image techniques. However, when I did the harmonic image simulations for a frequency of 3.5MHz, I got results that i think are wrong. Reading the comments in the forum and the user manual (which I'm still having difficulties to understand, because the content present there goes beyond my knowledge, and I'm still learning), I realized that there was a need to change the value of dx (mainly), but changing only dx the phantom was distorted (there were no more spheres but ellipses), even so, I could not increase the value of dy as much as I increased dx because otherwise the simulations would take too long, even using the GPU. I would like to confirm that what I understand so far is correct about the grid changes and if this distortion of the phantom really happens for different values of dx and dy?&#60;br /&#62;
Here's the part of my code for grid changes:&#60;/p&#62;
&#60;p&#62;'% set total number of grid points not including the PML&#60;br /&#62;
Nx = 512 - 2 * pml_x_size;      % [grid points]&#60;br /&#62;
Ny = 128 - 2 * pml_y_size;      % [grid points]&#60;br /&#62;
Nz = 128 - 2 * pml_z_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 = 40e-3;                      % [m]&#60;br /&#62;
dx_old = x/(256 - 2 * pml_x_size);      % [grid points]&#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_old;                        % [m]&#60;br /&#62;
dz = dx_old;                        % [m]&#60;br /&#62;
'&#60;br /&#62;
and about the part of the code to make the scattering region:&#60;/p&#62;
&#60;p&#62;% define a sphere for a highly scattering region&#60;br /&#62;
 radius = 6e-3;      % [m]&#60;br /&#62;
 x_pos = 27.5e-3;    % [m]&#60;br /&#62;
 y_pos = 20.5e-3;    % [m]&#60;br /&#62;
 scattering_region1 = makeBall(Nx_tot, Ny_tot, Nz_tot, round(x_pos/dx), round(y_pos/dx_old), Nz_tot/2, round(radius/dx_old));&#60;/p&#62;
&#60;p&#62; % assign region&#60;br /&#62;
 sound_speed_map(scattering_region1 == 1) = scattering_c0(scattering_region1 == 1);&#60;br /&#62;
 density_map(scattering_region1 == 1) = scattering_rho0(scattering_region1 == 1);&#60;/p&#62;
&#60;p&#62; % define a sphere for a highly scattering region&#60;br /&#62;
 radius = 5e-3;      % [m]&#60;br /&#62;
 x_pos = 30.5e-3;    % [m]&#60;br /&#62;
 y_pos = 37e-3;      % [m]&#60;br /&#62;
 scattering_region2 = makeBall(Nx_tot, Ny_tot, Nz_tot, round(x_pos/dx), round(y_pos/dx_old), Nz_tot/2, round(radius/dx_old));&#60;/p&#62;
&#60;p&#62; % assign region&#60;br /&#62;
 sound_speed_map(scattering_region2 == 1) = scattering_c0(scattering_region2 == 1);&#60;br /&#62;
 density_map(scattering_region2 == 1) = scattering_rho0(scattering_region2 == 1);&#60;/p&#62;
&#60;p&#62; % define a sphere for a highly scattering region&#60;br /&#62;
 radius = 4.5e-3;    % [m]&#60;br /&#62;
 x_pos = 15.5e-3;    % [m]&#60;br /&#62;
 y_pos = 30.5e-3;    % [m]&#60;br /&#62;
 scattering_region3 = makeBall(Nx_tot, Ny_tot, Nz_tot, round(x_pos/dx), round(y_pos/dx_old), Nz_tot/2, round(radius/dx_old));&#60;/p&#62;
&#60;p&#62;'&#60;br /&#62;
thank you!&#60;/p&#62;
&#60;p&#62;Amanda
&#60;/p&#62;</description>
		</item>
		<item>
			<title>marlenep on "US probe frequency"</title>
			<link>http://www.k-wave.org/forum/topic/us-probe-frequency#post-5576</link>
			<pubDate>Tue, 05 Jul 2016 15:20:28 +0000</pubDate>
			<dc:creator>marlenep</dc:creator>
			<guid isPermaLink="false">5576@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Bradley,&#60;br /&#62;
thank you very much for your advice&#60;br /&#62;
I share my code and the resulting scan lines matrix with you at this link:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://imperialcollegelondon.box.com/s/vu0obiih6kn1watkojfcc8x2sheezy1o&#34; rel=&#34;nofollow&#34;&#62;https://imperialcollegelondon.box.com/s/vu0obiih6kn1watkojfcc8x2sheezy1o&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I would like to obtain a simulated ultrasound image similar to real ultrasound image (&#34;real_us.bmp&#34;). I already tried playing with different parameters and the best result I obtained is the one you can find in the folder. Do you think there is a way to improve it or the limitation depends only on the mri segmentation which of course approximates the real brain tissues differentiation?&#60;/p&#62;
&#60;p&#62;thank you very much for your time
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "US probe frequency"</title>
			<link>http://www.k-wave.org/forum/topic/us-probe-frequency#post-5557</link>
			<pubDate>Mon, 04 Jul 2016 12:50:06 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">5557@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi marlenep,&#60;/p&#62;
&#60;p&#62;You should set the total simulation time to be long enough to capture the reflections of interest. The line &#60;code&#62;t_end = (Nx*dx)*2.2/c0;&#60;/code&#62; will set the time long enough for a single round trip the length of the domain. &#60;/p&#62;
&#60;p&#62;Regarding the time step, I would refer to Section 2.7 in the k-Wave manual, where this is discussed in detail. In particular, the sound speed you pass to &#60;code&#62;makeTime&#60;/code&#62; (which sets &#60;code&#62;dt&#60;/code&#62;) and the value of &#60;code&#62;medium.sound_speed_ref&#60;/code&#62; (which sets the value of sound speed in the k-space operator; this defaults to &#60;code&#62;max(medium.sound_speed(:))&#60;/code&#62;) will both affect the simulation. &#60;/p&#62;
&#60;p&#62;&#38;gt;&#38;gt; I don't have such a good result from my simulation&#60;/p&#62;
&#60;p&#62;Can you say a bit more about what the problem is?&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>marlenep on "US probe frequency"</title>
			<link>http://www.k-wave.org/forum/topic/us-probe-frequency#post-5529</link>
			<pubDate>Thu, 09 Jun 2016 10:53:08 +0000</pubDate>
			<dc:creator>marlenep</dc:creator>
			<guid isPermaLink="false">5529@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;thank you Brad, I  increased the PPW because and seems to be better. How can i set a proper  time step and  total simulation time? Is still ok if I use this command?&#60;/p&#62;
&#60;p&#62;t_end = (Nx*dx)*2.2/c0;  &#60;/p&#62;
&#60;p&#62;[kgrid.t_array delta] = makeTime(kgrid, c0, [], t_end);&#60;/p&#62;
&#60;p&#62;I am trying to simulate an ultrasound image from a phantom with similar properties to those of the soft tissues and with two holes in the middle fill with water. I have acquired real ultrasound images using a linear transducer probe, in particular is the ultrasonic L14-5/38.&#60;br /&#62;
I don't have such a good result from my simulation, can you give me some advice to improve it?  thank you very much for any help&#60;/p&#62;
&#60;p&#62;This is my code ( in this code I am still using 2 PPW)&#60;/p&#62;
&#60;p&#62;clear all&#60;br /&#62;
clc&#60;br /&#62;
close all&#60;/p&#62;
&#60;p&#62;% simulation settings&#60;br /&#62;
DATA_CAST = 'gpuArray-single';&#60;/p&#62;
&#60;p&#62;%DATA_CAST='single';&#60;br /&#62;
RUN_SIMULATION  =true; &#60;/p&#62;
&#60;p&#62;points_per_wavelength =2;&#60;br /&#62;
freq=5e6;&#60;br /&#62;
dx = 1482.3/(points_per_wavelength*freq);&#60;br /&#62;
dy=dx;&#60;br /&#62;
dz=dy;&#60;/p&#62;
&#60;p&#62;Nx = round((46e-3)/dx);    % phantom dimensions&#60;br /&#62;
Ny_tot=round((50.2e-3)/dy);&#60;br /&#62;
Ny=66;&#60;br /&#62;
Nz=round((50.2e-3)/dz);&#60;/p&#62;
&#60;p&#62;% set the size of the perfectly matched layer (PML)&#60;br /&#62;
pml_x_size = 30;          % [grid points]&#60;br /&#62;
pml_y_size = 10;        % [grid points]&#60;br /&#62;
pml_z_size = 30;          % [grid points]&#60;/p&#62;
&#60;p&#62;% % set total number of grid points not including the PML&#60;br /&#62;
sc = 1;&#60;/p&#62;
&#60;p&#62;% % create the k-space grid&#60;br /&#62;
kgrid = makeGrid(Nx, dx,Ny, dy, Nz, dz);&#60;/p&#62;
&#60;p&#62;o=round(36.5e-03/dx);&#60;br /&#62;
p=round(36.9e-03/dx);&#60;br /&#62;
q=round(12.9e-03/dx);&#60;br /&#62;
r=round(7.5e-03/dx);&#60;br /&#62;
circle =makeDisc(Nx,Ny_tot,o,q,r,false)+(makeDisc(Nx,Ny_tot,o,p,r,false)); %3.65,1.29,0.75//36.5e-03 36.9e-03 7.5e-03&#60;br /&#62;
rect=[];&#60;/p&#62;
&#60;p&#62;for z=1:Nz&#60;br /&#62;
    for x=1:Nx&#60;br /&#62;
        for y=1:Ny_tot&#60;br /&#62;
        if (circle(x,y)==0)&#60;br /&#62;
        rect(x,y,z)=0;&#60;br /&#62;
        else&#60;br /&#62;
            rect(x,y,z)=1;&#60;br /&#62;
        end&#60;br /&#62;
        end&#60;br /&#62;
    end&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;figure,imshow(rect(:,:,20));   &#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium %first medium&#60;br /&#62;
c0 = 1540;                  % [m/s]water&#60;br /&#62;
rho0 = 1068;                % [kg/m^3]&#60;br /&#62;
medium.alpha_coeff = 0.75; 	% [dB/(MHz^y cm)]&#60;br /&#62;
medium.alpha_power = 1.5;&#60;br /&#62;
 medium.BonA = 6;&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
t_end = (Nx*dx)*2.2/c0;  &#60;/p&#62;
&#60;p&#62;[kgrid.t_array delta] = makeTime(kgrid, c0, [], t_end);&#60;/p&#62;
&#60;p&#62;%define properties of the input signal&#60;br /&#62;
source_strength = 0.25e3;%1e6;    	% [Pa]&#60;br /&#62;
tone_burst_freq = freq/sc;  	% [Hz]&#60;br /&#62;
tone_burst_cycles = 5;&#60;/p&#62;
&#60;p&#62;% create the input signal using toneBurst&#60;br /&#62;
input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);&#60;/p&#62;
&#60;p&#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;
transducer.input_signal = input_signal;&#60;/p&#62;
&#60;p&#62;% DEFINE THE ULTRASOUND TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;br /&#62;
uno=round((38e-03/128)/dx); % transducer size&#60;br /&#62;
len=round(10e-03/dx); %transducer heigth&#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 = uno;       % width of each element [grid points]&#60;br /&#62;
transducer.element_length = len;  	% 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;/p&#62;
&#60;p&#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;/p&#62;
&#60;p&#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;/p&#62;
&#60;p&#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 = 6e-3;          % focus distance [m]&#60;br /&#62;
transducer.elevation_focus_distance = 19e-3;% focus distance in the elevation plane [m]&#60;br /&#62;
transducer.steering_angle = 0;&#60;br /&#62;
% transducer,element_pitch=0.3e-03;% steering angle [degrees]&#60;br /&#62;
%transducer.steering_angle_max = 32;&#60;br /&#62;
% apodization&#60;br /&#62;
transducer.transmit_apodization = 'Hanning';&#60;br /&#62;
transducer.receive_apodization = 'Rectangular';&#60;/p&#62;
&#60;p&#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;/p&#62;
&#60;p&#62;% create the transducer using the defined settings&#60;br /&#62;
transducer = makeTransducer(kgrid, transducer);&#60;/p&#62;
&#60;p&#62;% print out transducer properties&#60;br /&#62;
transducer.properties;&#60;br /&#62;
transducer.plot;&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PROPERTIES&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#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;/p&#62;
&#60;p&#62;mu0_map = zeros(Nx, Ny_tot, Nz);&#60;br /&#62;
mu1_map = zeros(Nx, Ny_tot, Nz);&#60;br /&#62;
sigma0_map = zeros(Nx, Ny_tot, Nz);&#60;/p&#62;
&#60;p&#62;%background&#60;br /&#62;
sound_speed_map = 1482.3*ones(Nx, Ny_tot, Nz);%.*background_map_s;&#60;br /&#62;
density_map = 994*ones(Nx, Ny_tot, Nz);%.*background_map_s;&#60;br /&#62;
alpha_coeff_map= ones(Nx,Ny_tot,Nz);&#60;/p&#62;
&#60;p&#62;%water&#60;br /&#62;
sound_speed_map(rect==1)= 1482.3;%.*background_map(Vol==6);  %giusto??&#60;br /&#62;
            density_map(rect==1) = 994;%.*background_map(Vol==6);&#60;br /&#62;
            alpha_coeff_map(rect==1) =0.2;&#60;br /&#62;
            mu0_map(rect==1) = 0;%0.2;&#60;br /&#62;
            mu1_map(rect==1) = 0;%0.4;&#60;br /&#62;
            sigma0_map(rect==1) = 0;&#60;/p&#62;
&#60;p&#62; %soft tissue&#60;br /&#62;
sound_speed_map(rect==0)= 1540;%.*background_map(Vol==6);  %giusto??&#60;br /&#62;
            density_map(rect==0) = 1068;%.*background_map(Vol==6);&#60;br /&#62;
            alpha_coeff_map(rect==0) =0.54;&#60;br /&#62;
            mu0_map(rect==0) = 0.53;&#60;br /&#62;
            mu1_map(rect==0) = 0.5;&#60;br /&#62;
            sigma0_map(rect==0) = 0;&#60;/p&#62;
&#60;p&#62;%scattering&#60;/p&#62;
&#60;p&#62;%generate noise maps&#60;br /&#62;
T0 = randn(Nx, Ny_tot, Nz);&#60;br /&#62;
T1 = randn(Nx, Ny_tot, Nz);  &#60;/p&#62;
&#60;p&#62;% calc noise to add&#60;br /&#62;
S = T0.*sigma0_map + mu0_map;&#60;br /&#62;
rho_noise = zeros(Nx, Ny_tot, Nz);&#60;br /&#62;
rho_noise(T1 &#38;lt;= mu1_map) = S(T1 &#38;lt;= mu1_map);&#60;/p&#62;
&#60;p&#62; density_map = density_map.*(1+rho_noise);&#60;/p&#62;
&#60;p&#62; % assign to the medium inputs&#60;br /&#62;
medium.sound_speed = sound_speed_map;&#60;br /&#62;
medium.density = density_map;&#60;br /&#62;
medium.alpha_coeff=alpha_coeff_map;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#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;/p&#62;
&#60;p&#62;% run the simulation if set to true, otherwise, load previous results from&#60;br /&#62;
% disk&#60;br /&#62;
if RUN_SIMULATION&#60;/p&#62;
&#60;p&#62;    % set medium position&#60;br /&#62;
   medium_position= round((Ny_tot-(128*transducer.element_width))/2);&#60;br /&#62;
    %medium_position = 146; %%%%%%%%%%&#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('');&#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;br /&#62;
         medium.alpha_coeff = alpha_coeff_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,'DataCast','gpuArray-single', input_args{:});&#60;/p&#62;
&#60;p&#62;sensor_data = kspaceFirstOrder3DG(kgrid, medium, transducer, transducer,'DataCast','gpuArray-single', 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;/p&#62;
&#60;p&#62;    end&#60;/p&#62;
&#60;p&#62;    % save the scan lines to disk&#60;br /&#62;
    save example_us_bmode_scan_lines scan_lines;&#60;br /&#62;
else&#60;br /&#62;
    % load the scan lines from disk&#60;br /&#62;
    load example_us_bmode_scan_lines&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% PROCESS THE RESULTS&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% -----------------------------&#60;br /&#62;
% Remove Input Signal&#60;br /&#62;
% -----------------------------&#60;/p&#62;
&#60;p&#62;% create a window to set the first part of each scan line to zero to remove&#60;br /&#62;
% interference from the input signal&#60;br /&#62;
scan_line_win = getWin(kgrid.Nt*2, 'Tukey', 'Param', 0.05).';&#60;br /&#62;
scan_line_win = [zeros(1, length(input_signal)*2), scan_line_win(1:end/2 - length(input_signal)*2)];&#60;/p&#62;
&#60;p&#62;% apply the window to each of the scan lines&#60;br /&#62;
scan_lines = bsxfun(@times, scan_line_win, scan_lines);&#60;/p&#62;
&#60;p&#62;% store a copy of the middle scan line to illustrate the effects of each&#60;br /&#62;
% processing step&#60;br /&#62;
scan_line_example(1, :) = scan_lines(end/2, :);&#60;/p&#62;
&#60;p&#62;% -----------------------------&#60;br /&#62;
% Time Gain Compensation&#60;br /&#62;
% -----------------------------&#60;/p&#62;
&#60;p&#62;% create radius variable assuming that t0 corresponds to the middle of the&#60;br /&#62;
% input signal&#60;br /&#62;
t0 = length(input_signal)*kgrid.dt/2;&#60;br /&#62;
r = c0*( (1:length(kgrid.t_array))*kgrid.dt/2 - t0);    % [m]&#60;/p&#62;
&#60;p&#62;% create time gain compensation function based on attenuation value,&#60;br /&#62;
% transmit frequency, and round trip distance&#60;br /&#62;
tgc_alpha = 0.4;       % [dB/(MHz cm)]&#60;br /&#62;
tgc = exp(2*tgc_alpha*tone_burst_freq/1e6*r*100);&#60;/p&#62;
&#60;p&#62;% apply the time gain compensation to each of the scan lines&#60;br /&#62;
scan_lines = bsxfun(@times, tgc, scan_lines);&#60;/p&#62;
&#60;p&#62;% store a copy of the middle scan line to illustrate the effects of each&#60;br /&#62;
% processing step&#60;br /&#62;
scan_line_example(2, :) = scan_lines(end/2, :);&#60;/p&#62;
&#60;p&#62;% -----------------------------&#60;br /&#62;
% Frequency Filtering&#60;br /&#62;
% -----------------------------&#60;/p&#62;
&#60;p&#62;% filter the scan lines using both the transmit frequency and the second&#60;br /&#62;
% harmonic&#60;br /&#62;
scan_lines_fund = gaussianFilter(scan_lines, 1/kgrid.dt, tone_burst_freq, 100, true);&#60;br /&#62;
scan_lines_harm = gaussianFilter(scan_lines, 1/kgrid.dt, 2*tone_burst_freq, 30, true);&#60;/p&#62;
&#60;p&#62;% store a copy of the middle scan line to illustrate the effects of each&#60;br /&#62;
% processing step&#60;br /&#62;
scan_line_example(3, :) = scan_lines_fund(end/2, :);&#60;/p&#62;
&#60;p&#62;% -----------------------------&#60;br /&#62;
% Envelope Detection&#60;br /&#62;
% -----------------------------&#60;/p&#62;
&#60;p&#62;% envelope detection&#60;br /&#62;
scan_lines_fund = envelopeDetection(scan_lines_fund);&#60;br /&#62;
scan_lines_harm = envelopeDetection(scan_lines_harm);&#60;/p&#62;
&#60;p&#62;% store a copy of the middle scan line to illustrate the effects of each&#60;br /&#62;
% processing step&#60;br /&#62;
scan_line_example(4, :) = scan_lines_fund(end/2, :);&#60;/p&#62;
&#60;p&#62;% -----------------------------&#60;br /&#62;
% Log Compression&#60;br /&#62;
% -----------------------------&#60;/p&#62;
&#60;p&#62;% normalised log compression&#60;br /&#62;
compression_ratio = 3;&#60;br /&#62;
scan_lines_fund = logCompression(scan_lines_fund, compression_ratio, true);&#60;br /&#62;
scan_lines_harm = logCompression(scan_lines_harm, compression_ratio, true);&#60;/p&#62;
&#60;p&#62;% store a copy of the middle scan line to illustrate the effects of each&#60;br /&#62;
% processing step&#60;br /&#62;
scan_line_example(5, :) = scan_lines_fund(end/2, :);&#60;/p&#62;
&#60;p&#62;% -----------------------------&#60;br /&#62;
% Scan Conversion&#60;br /&#62;
% -----------------------------&#60;/p&#62;
&#60;p&#62;% upsample the image using linear interpolation&#60;br /&#62;
scale_factor = 2;&#60;br /&#62;
scan_lines_fund = interp2(1:kgrid.Nt, (1:number_scan_lines).', scan_lines_fund, 1:kgrid.Nt, (1:1/scale_factor:number_scan_lines).');&#60;br /&#62;
scan_lines_harm = interp2(1:kgrid.Nt, (1:number_scan_lines).', scan_lines_harm, 1:kgrid.Nt, (1:1/scale_factor:number_scan_lines).');&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% VISUALISATION&#60;br /&#62;
% =========================================================================&#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*transducer.element_width-1)*dy*1e3, (0:Nx_tot-1)*dx*1e3, sound_speed_map(:, 1 + Ny/2:end - Ny/2, Nz/2));&#60;br /&#62;
axis image;&#60;br /&#62;
colormap(gray);&#60;br /&#62;
set(gca, 'YLim', [0, 40]);&#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;% plot the processing steps&#60;br /&#62;
figure;&#60;br /&#62;
stackedPlot(kgrid.t_array*1e6, {'1. Beamformed Signal', '2. Time Gain Compensation', '3. Frequency Filtering', '4. Envelope Detection', '5. Log Compression'}, scan_line_example);&#60;br /&#62;
xlabel('Time [\mus]');&#60;br /&#62;
set(gca, 'XLim', [5 t_end*1e6]);&#60;/p&#62;
&#60;p&#62;% plot the processed b-mode ultrasound image&#60;br /&#62;
figure;&#60;br /&#62;
horz_axis = (0:length(scan_lines_fund(:, 1))-1)*transducer.element_width*dy/scale_factor*1e3;&#60;br /&#62;
imagesc(horz_axis, r*1e3, scan_lines_fund.');&#60;br /&#62;
axis image;&#60;br /&#62;
colormap(gray);&#60;br /&#62;
set(gca, 'YLim', [5, 40]);&#60;br /&#62;
title('B-mode Image');&#60;br /&#62;
xlabel('Horizontal Position [mm]');&#60;br /&#62;
ylabel('Depth [mm]');&#60;/p&#62;
&#60;p&#62;% plot the processed harmonic ultrasound image&#60;br /&#62;
figure;&#60;br /&#62;
imagesc(horz_axis, r*1e3, scan_lines_harm.');&#60;br /&#62;
axis image;&#60;br /&#62;
colormap(gray);&#60;br /&#62;
set(gca, 'YLim', [5, 40]);&#60;br /&#62;
title('Harmonic Image');&#60;br /&#62;
xlabel('Horizontal Position [mm]');&#60;br /&#62;
ylabel('Depth [mm]');
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "US probe frequency"</title>
			<link>http://www.k-wave.org/forum/topic/us-probe-frequency#post-5526</link>
			<pubDate>Wed, 08 Jun 2016 20:57:09 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">5526@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi marlenep,&#60;/p&#62;
&#60;p&#62;Possible things to check are whether the source frequency is still supported by the grid (I'd recommend using at least 3 PPW at the highest frequency contained in the tone burst), that you have also scaled the time step appropriately so the simulation is still stable, and that the total simulation time is still appropriate to capture the behaviour you are trying to model (e.g., scattering). The source strength or number of cycles don't need to be changed.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>marlenep on "US probe frequency"</title>
			<link>http://www.k-wave.org/forum/topic/us-probe-frequency#post-5523</link>
			<pubDate>Tue, 07 Jun 2016 10:33:23 +0000</pubDate>
			<dc:creator>marlenep</dc:creator>
			<guid isPermaLink="false">5523@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi! I would want to change the frequency of the US source  from 1.5 to 3MHz. When I change it, if i plot the signal it seems that I get a signal that is not correct. In my example I define the grid with respect to the frequency so I don't think the problem could be related to the grid size. Do you know if maybe some other parameters have to be changed when you change the frequency as for example the source strenght or the number of cycles ? &#60;/p&#62;
&#60;p&#62;thank you for any help
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
