<?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: kspaceFirstOrder3D function and inactive elements in the middle of transducer</title>
		<link>http://www.k-wave.org/forum/topic/kspacefirstorder3d-function-and-inactive-elements-in-the-middle-of-transducer</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 02:31:36 +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/kspacefirstorder3d-function-and-inactive-elements-in-the-middle-of-transducer" rel="self" type="application/rss+xml" />

		<item>
			<title>Pavelshir on "kspaceFirstOrder3D function and inactive elements in the middle of transducer"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder3d-function-and-inactive-elements-in-the-middle-of-transducer#post-8224</link>
			<pubDate>Wed, 23 Jun 2021 16:39:46 +0000</pubDate>
			<dc:creator>Pavelshir</dc:creator>
			<guid isPermaLink="false">8224@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello Brad, issue resolved!&#60;br /&#62;
Thank you again for the comments.&#60;br /&#62;
We are waiting for new convex transducer class :-)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Pavelshir on "kspaceFirstOrder3D function and inactive elements in the middle of transducer"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder3d-function-and-inactive-elements-in-the-middle-of-transducer#post-8217</link>
			<pubDate>Tue, 15 Jun 2021 15:54:32 +0000</pubDate>
			<dc:creator>Pavelshir</dc:creator>
			<guid isPermaLink="false">8217@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Brad! Thank you for your comments and k-Wave updating efforts! &#60;/p&#62;
&#60;p&#62;Maybe my questions will seem naive but:&#60;br /&#62;
1.&#60;br /&#62;
I looked at an example with kWaveArray class 'ex07_linear_array_3D.m' and I don't understand the link between dimensions of 'source.p_mask' [80 40 80] and assigned source signals 'source.p' [18256 49]. 80 40 80 - our grid , 49 - dimension for time signal, and what is 18256? How to relate this dimension to our grid?&#60;br /&#62;
2.&#60;br /&#62;
Your second proposition seems to be very useful for me! I think this is exactly what you describe in your article 'Modelling Nonlinear Ultrasound Propagation in Absorbing Media using the k-Wave Toolbox: Experimental Validation'. Can you share some code examples/or parts of code in 3D describing how to assign rectangular array of different delayed signals (corresponding a plane next to the transducer) with 'source.p' for further propagation? &#60;/p&#62;
&#60;p&#62;Thank you one more time,&#60;br /&#62;
BR&#60;br /&#62;
Pavel
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "kspaceFirstOrder3D function and inactive elements in the middle of transducer"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder3d-function-and-inactive-elements-in-the-middle-of-transducer#post-8194</link>
			<pubDate>Tue, 08 Jun 2021 17:35:17 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8194@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Pavel,&#60;/p&#62;
&#60;p&#62;I don't think I've tested trying to turn off central elements with &#60;code&#62;kWaveTransducer&#60;/code&#62;, so it's likely that it's not supported.&#60;/p&#62;
&#60;p&#62;You could switch to using the &#60;a href=&#34;http://www.k-wave.org/forum/topic/alpha-version-of-kwavearray-off-grid-sources&#34;&#62;kWaveArray class&#60;/a&#62;, or alternatively, you could calculate the field over a plane next to the transducer, e.g., using Field II, and then propagate this using k-Wave (using &#60;code&#62;source.p_mode = &#38;#39;dirichlet&#38;#39;&#60;/code&#62;).&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Pavelshir on "kspaceFirstOrder3D function and inactive elements in the middle of transducer"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder3d-function-and-inactive-elements-in-the-middle-of-transducer#post-8140</link>
			<pubDate>Mon, 26 Apr 2021 18:01:11 +0000</pubDate>
			<dc:creator>Pavelshir</dc:creator>
			<guid isPermaLink="false">8140@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Just an example of the matlab error with kWaveTransducer/delay_mask making inactive elements in the middle of the array:&#60;/p&#62;
&#60;p&#62;clear all;&#60;br /&#62;
% close all;&#60;br /&#62;
clearvars;&#60;br /&#62;
% ========================================================================&#60;br /&#62;
% simulation settings&#60;br /&#62;
% ========================================================================&#60;br /&#62;
DATA_CAST = 'single';                                                      % set to 'single' or 'gpuArray-single' to speed up computations&#60;br /&#62;
MASK_PLANE = 'xy';                                                         % set to 'xy' or 'xz' to generate the beam pattern in different planes&#60;br /&#62;
% MASK_PLANE = 'xz';&#60;br /&#62;
filename = strcat('k-Wave-Log-',strrep(strrep(char(datetime),':','-'),' ','-'));&#60;br /&#62;
nfig=0;&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% parameters&#60;br /&#62;
% =========================================================================&#60;br /&#62;
f0 = 5.2e6;                                                                % transducer center frequency [Hz]&#60;br /&#62;
c0 = 1480;                                                                 % sound speed in medium [m/s]&#60;br /&#62;
rho0 = 1000;                                                               % density of medium [kg/m^3]&#60;br /&#62;
p0 = 0.25e6;                                                               % pressure at front face [Pa]&#60;br /&#62;
nelmt = 192;                                                                % number of elements&#60;br /&#62;
kerf = 0.0230/1000;                                                             % kerf of element [m]&#60;br /&#62;
width = 0.2/1000; 								% width of element [m]&#60;br /&#62;
lengt = 6/1000;                                                              % length of element [m]&#60;br /&#62;
focus_ele = 40e-3;%20e-3; %1e12/1000;%80e-3;                                                         % focus distance in elevation [m]&#60;br /&#62;
focus_azy = 20e-3;%20e-3; %1e12/1000;%300e-3;                                                         % focus distance in azymuth [m]&#60;br /&#62;
steer_ang = 0;                                                             % steering angle [°]&#60;br /&#62;
depth = 40e-3;                                                            % depth of field [m]&#60;br /&#62;
nper = 2;%4;%10;                                                                 % number of periods for excitation&#60;br /&#62;
param.dx = 1e-4;%c0/f0/6;% 1*kerf; %width/4; %1*kerf;                            % cell size of grid [m]&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% DEFINE THE ULTRASOUND TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;br /&#62;
transducer.number_elements = nelmt;&#60;br /&#62;
transducer.element_width = round(width/param.dx);                          % [grid points]&#60;br /&#62;
transducer.element_length = round(lengt/param.dx);                         % [grid points]&#60;br /&#62;
transducer.element_spacing = round(kerf/param.dx);                         % [grid points]&#60;br /&#62;
transducer.radius = Inf;                                                   % [m] -&#38;gt; currently only Inf is supported&#60;br /&#62;
transducer.sound_speed = c0;&#60;br /&#62;
transducer.focus_distance = focus_azy;&#60;br /&#62;
transducer.steering_angle = steer_ang;&#60;br /&#62;
transducer.elevation_focus_distance = focus_ele;&#60;br /&#62;
transducer.transmit_apodization = 'Rectangular';&#60;br /&#62;
transducer.receive_apodization = 'Rectangular';&#60;br /&#62;
% transducer.active_elements = ones(transducer.number_elements,1);&#60;br /&#62;
transducer_width = transducer.number_elements * transducer.element_width ...&#60;br /&#62;
    + (transducer.number_elements - 1) * transducer.element_spacing;       % calculate the width of the transducer in grid points&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% DEFINE THE K-WAVE GRID&#60;br /&#62;
% =========================================================================&#60;br /&#62;
%create the grid&#60;br /&#62;
NX = ceil(depth/param.dx)+2;&#60;br /&#62;
NY = transducer.number_elements*(transducer.element_width+transducer.element_spacing)+2;&#60;br /&#62;
NZ = transducer.element_length+2;&#60;br /&#62;
% set the size of the perfectly matched layer (PML)&#60;br /&#62;
PML_X_SIZE = 10;                                                           % [grid points]&#60;br /&#62;
PML_Y_SIZE = 10;                                                           % [grid points]&#60;br /&#62;
PML_Z_SIZE = 10;                                                           % [grid points]&#60;br /&#62;
% set total number of grid points not including the PML&#60;br /&#62;
% Nx = NX;&#60;br /&#62;
Nx = NX;&#60;br /&#62;
Ny = NY;&#60;br /&#62;
Nz = NZ;&#60;br /&#62;
% set desired grid size in the x-direction not including the PML&#60;br /&#62;
x = depth;                                                                 % [m]&#60;br /&#62;
% spacing between the grid points&#60;br /&#62;
dx = param.dx;                                                             % [m]&#60;br /&#62;
dy = dx;                                                                   % [m]&#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;
disp(['grid size = [',num2str(Nx),',',num2str(Ny),',',num2str(Nz),'] = ',num2str(Nx*Ny*Nz),' cells']);&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PARAMETERS&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% define the properties of the propagation medium&#60;br /&#62;
%&#60;br /&#62;
% If the nonlinearity parameter medium.BonA is not set, the simulation is assumed to be linear,&#60;br /&#62;
% and linear governing equations are solved. Similarly, if the absorption parameters medium.alpha_coeff&#60;br /&#62;
% and medium.alpha_power are not set, the simulation is assumed to be lossless&#60;/p&#62;
&#60;p&#62;%% water&#60;br /&#62;
medium.sound_speed = c0;&#60;br /&#62;
medium.density = rho0;&#60;br /&#62;
% medium.BonA = 4.96;                                                         % non-linearity parameter&#60;br /&#62;
% medium.alpha_coeff = 2.17e-3;                                                  % power law absorption coefficient [dB/MHz^y/cm]&#60;br /&#62;
% medium.alpha_power = 2; &#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
t_end = 1.0*Nx*dx/c0+(nper+1)/f0;                                          % [s]&#60;br /&#62;
kgrid.t_array = makeTime(kgrid,medium.sound_speed,[], t_end);&#60;br /&#62;
disp(['Fs = ',num2str(round(1/kgrid.dt)/1e6),' MHz']);&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% DEFINE THE INPUT SIGNAL&#60;br /&#62;
% =========================================================================&#60;br /&#62;
source_strength = p0;&#60;br /&#62;
signal = p0/rho0/c0*sin(2*pi*f0*kgrid.t_array);&#60;br /&#62;
gate = find(kgrid.t_array &#38;lt;= nper/f0);&#60;br /&#62;
if (mod(length(gate),2) ~= 0)&#60;br /&#62;
    gate = gate(1:end-1);&#60;br /&#62;
end&#60;br /&#62;
window = zeros(size(kgrid.t_array));&#60;br /&#62;
window(gate) = tukeywin(length(gate),0.5); %hanning(length(gate));&#60;br /&#62;
signal = signal.*window;&#60;br /&#62;
input_signal = signal;&#60;br /&#62;
figure&#60;br /&#62;
tps = (0:length(input_signal)-1)*kgrid.dt;&#60;br /&#62;
plot(tps*1e6,input_signal);&#60;br /&#62;
grid&#60;br /&#62;
title('front face');&#60;br /&#62;
xlabel('time (µs)');&#60;br /&#62;
ylabel('normal velocity (m/s)');&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% SET THE ULTRASOUND TRANSDUCER&#60;br /&#62;
% =========================================================================&#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;
% define the transducer elements that are currently active&#60;br /&#62;
% transducer.active_elements = ones(transducer.number_elements, 1);&#60;/p&#62;
&#60;p&#62;% Inactive center of the array&#60;/p&#62;
&#60;p&#62; transducer.active_elements = zeros(transducer.number_elements, 1);&#60;br /&#62;
 transducer.active_elements(1:64) = 1;&#60;br /&#62;
 transducer.active_elements(129:192) = 1;&#60;/p&#62;
&#60;p&#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;
%display the transducer using a 3D voxel plot&#60;br /&#62;
transducer.plot;&#60;/p&#62;
&#60;p&#62;%% =========================================================================&#60;br /&#62;
% DEFINE SENSOR MASK&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% define a sensor mask through the central plane&#60;br /&#62;
sensor.mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
switch MASK_PLANE&#60;/p&#62;
&#60;p&#62;    case 'xy'&#60;br /&#62;
        % define mask&#60;br /&#62;
        sensor.mask(:, :, (Nz)/2) = 1;&#60;br /&#62;
        % store y axis properties&#60;br /&#62;
        Nj = Ny;&#60;br /&#62;
        j_vec = kgrid.y_vec;&#60;br /&#62;
        j_label = 'y';&#60;br /&#62;
    case 'xz'&#60;br /&#62;
        % define mask&#60;br /&#62;
        sensor.mask(:, (Ny)/2, :) = 1;&#60;br /&#62;
        % store z axis properties&#60;br /&#62;
        Nj = Nz;&#60;br /&#62;
        j_vec = kgrid.z_vec;&#60;br /&#62;
        j_label = 'z';&#60;br /&#62;
end &#60;/p&#62;
&#60;p&#62;% set the record mode such that only the peak values are stored&#60;br /&#62;
sensor.record = {'p_min', 'p_max'};&#60;/p&#62;
&#60;p&#62;%% ========================================================================&#60;br /&#62;
% RUN THE SIMULATION&#60;br /&#62;
% =========================================================================&#60;br /&#62;
source = transducer;&#60;br /&#62;
% set the input settings&#60;br /&#62;
input_args = {'DisplayMask', transducer.all_elements_mask, ...&#60;br /&#62;
    'PMLInside', false, 'PlotPML', false, 'PMLSize', [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE], ...&#60;br /&#62;
    'DataCast', DATA_CAST, 'DataRecast', true, 'PlotScale', [-1, 1] * source_strength};&#60;br /&#62;
% run the simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder3D(kgrid, medium, transducer, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;At this phase a have matlab error: &#60;/p&#62;
&#60;p&#62;Index exceeds the number of array elements (128).&#60;/p&#62;
&#60;p&#62;Error in kWaveTransducer/delay_mask (line 985)&#60;br /&#62;
                mask(active_elements_index) = delay_times(indexed_active_elements_mask_copy(active_elements_index));&#60;/p&#62;
&#60;p&#62;Error in kWaveTransducer/get.input_signal (line 578)&#60;br /&#62;
                delay_mask = obj.delay_mask;&#60;/p&#62;
&#60;p&#62;Error in kspaceFirstOrder_inputChecking (line 1166)&#60;br /&#62;
    transducer_input_signal = source.input_signal;&#60;/p&#62;
&#60;p&#62;Error in kspaceFirstOrder3D (line 574)&#60;br /&#62;
kspaceFirstOrder_inputChecking;&#60;/p&#62;
&#60;p&#62;Error in kWave_GE9LD_2_test (line 251)&#60;br /&#62;
sensor_data = kspaceFirstOrder3D(kgrid, medium, transducer, sensor, input_args{:});
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Pavelshir on "kspaceFirstOrder3D function and inactive elements in the middle of transducer"</title>
			<link>http://www.k-wave.org/forum/topic/kspacefirstorder3d-function-and-inactive-elements-in-the-middle-of-transducer#post-8139</link>
			<pubDate>Mon, 26 Apr 2021 17:26:59 +0000</pubDate>
			<dc:creator>Pavelshir</dc:creator>
			<guid isPermaLink="false">8139@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, &#60;/p&#62;
&#60;p&#62;I am trying to simulate transducer consisted of two separate active apertures, like 1D transducer with inactive center. It seems to me that the kspaceFirstOrder3D function doesn’t accept transducer described by transducer class with active_elements = 0 in the middle of the transducer aperture? &#60;/p&#62;
&#60;p&#62;My question: what is the better way in my case to simulate complex transducer geometry? I want to simulate 1D transducer focused in azimuth axis, having toric lens that focalize in elevation, and with inactive center in elevation axis. &#60;/p&#62;
&#60;p&#62;I made it in FieldII with number of elements in 2D plane (1D transducer array with mathematical sub elements in elevation) applying for all elements arbitrary delays and apodization. But I want to pass to k-Wave in order to do non-linear simulations.&#60;/p&#62;
&#60;p&#62;I don’t find a good examples explaining what type of class is better to use, how to apply various delays and apodization laws for transducer elements (or subelements, or points of the grid) in both azimuth and elevation direction. Can you help me with the ideas or good examples?&#60;/p&#62;
&#60;p&#62;Thanks for future comments),&#60;br /&#62;
Best regards,&#60;br /&#62;
Pavel
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
