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

		<item>
			<title>sheun on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4298</link>
			<pubDate>Tue, 04 Feb 2014 02:10:53 +0000</pubDate>
			<dc:creator>sheun</dc:creator>
			<guid isPermaLink="false">4298@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Sorry to bother you. It was my mistake.&#60;/p&#62;
&#60;p&#62;Thanks for the help though!!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4296</link>
			<pubDate>Mon, 03 Feb 2014 09:49:11 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4296@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi sheun,&#60;/p&#62;
&#60;p&#62;If you use the option &#60;code&#62;&#38;#39;SaveToDisk&#60;/code&#62;' the simulation isn't actually run (it stops after the input data is saved to disk), so no output is returned, hence the error message.&#60;/p&#62;
&#60;p&#62;You should either use:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;kspaceFirstOrder3D(kgrid, medium, source, sensor, &#38;#39;SaveToDisk&#38;#39;, filetype, input_args{:});&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;and then call the C++ code yourself from the command line, or:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;sensor_data = kspaceFirstOrder3DC(kgrid, medium, source, sensor, input_args{:});&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;and let the wrapper function …3DC add the &#60;code&#62;&#38;#39;SaveToDisk&#60;/code&#62;' argument and call the C++ code for you.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sheun on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4295</link>
			<pubDate>Mon, 03 Feb 2014 00:54:36 +0000</pubDate>
			<dc:creator>sheun</dc:creator>
			<guid isPermaLink="false">4295@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Bradley,&#60;/p&#62;
&#60;p&#62;I get the same error with other 3D examples as well..&#60;br /&#62;
I get the following when I type &#34;clock&#34; in the cmd line,&#60;br /&#62;
&#34;ans =&#60;/p&#62;
&#60;p&#62;   1.0e+03 *&#60;/p&#62;
&#60;p&#62;    2.0140    0.0020    0.0030    0.0080    0.0470    0.0559&#34;&#60;/p&#62;
&#60;p&#62;The whole error message I get is,&#60;/p&#62;
&#60;p&#62;&#34;Error in kspaceFirstOrder3D (line 427)&#60;br /&#62;
start_time = clock;&#60;/p&#62;
&#60;p&#62;Output argument &#34;sensor_data&#34; (and maybe others) not assigned during&#60;br /&#62;
call to &#34;C:\Users\LS\Desktop\k-Wave&#60;br /&#62;
Toolbox\kspaceFirstOrder3D.m&#38;gt;kspaceFirstOrder3D&#34;.&#60;/p&#62;
&#60;p&#62;Error in example_pr_3D_TR_planar_sensor (line 76)&#60;br /&#62;
sensor_data = kspaceFirstOrder3D(kgrid, medium, source, sensor,&#60;br /&#62;
'SaveToDisk',filetype, input_args{:}); &#34;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4292</link>
			<pubDate>Thu, 30 Jan 2014 21:08:53 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4292@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi sheun,&#60;/p&#62;
&#60;p&#62;That's a puzzling message... Are you able to run any of the other 3D examples in the toolbox? What happens if you type &#60;code&#62;clock&#60;/code&#62; at the command line? Is there any more to the error message?&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sheun on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4286</link>
			<pubDate>Wed, 22 Jan 2014 00:31:23 +0000</pubDate>
			<dc:creator>sheun</dc:creator>
			<guid isPermaLink="false">4286@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Brad,&#60;/p&#62;
&#60;p&#62;Sorry I confused you but the real error message I get is (which was mentioned in the subsequent post)&#60;br /&#62;
&#34;Error in kspaceFirstOrder3D (line 427)&#60;br /&#62;
start_time = clock;&#60;br /&#62;
Output argument &#34;sensor_data&#34; (and maybe others) not assigned during call to&#60;br /&#62;
&#34;C:\Users\Desktop\k-Wave Toolbox\kspaceFirstOrder3D.m&#38;gt;kspaceFirstOrder3D&#34;.&#34;&#60;/p&#62;
&#60;p&#62;This happens even without the improper attempt to save the final pressure field.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4284</link>
			<pubDate>Tue, 21 Jan 2014 09:54:44 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4284@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi sheun,&#60;/p&#62;
&#60;p&#62;The answer is in the error message: &#34;The output field_data has been deprecated. Please use sensor.record = {'p_final'} (etc) to return the final pressure field&#34;. You need to replace &#60;/p&#62;
&#60;p&#62;&#60;code&#62;[sensor_data,p_final] = ...&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;with &#60;/p&#62;
&#60;p&#62;&#60;code&#62;sensor_data = ...&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;If you want to record the final pressure field in addition to the time varying pressure, after you define the sensor, add the line:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;sensor.record = {&#38;#39;p&#38;#39;, &#38;#39;p_final&#38;#39;};&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sheun on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4283</link>
			<pubDate>Tue, 21 Jan 2014 02:48:32 +0000</pubDate>
			<dc:creator>sheun</dc:creator>
			<guid isPermaLink="false">4283@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;modification to the post,&#60;/p&#62;
&#60;p&#62;the error message I get using &#34;[sensor_data] = kspaceFirstOrder3D(kgrid, medium, transducer, transducer,'SaveToDisk',filename, input_args{:})&#34; is that,&#60;br /&#62;
&#34;Error in kspaceFirstOrder3D (line 427)&#60;br /&#62;
start_time = clock;&#60;/p&#62;
&#60;p&#62;Output argument &#34;sensor_data&#34; (and maybe others) not assigned during call to&#60;br /&#62;
&#34;C:\Users\Desktop\k-Wave Toolbox\kspaceFirstOrder3D.m&#38;gt;kspaceFirstOrder3D&#34;.&#34;&#60;/p&#62;
&#60;p&#62;sorry for the confusion.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sheun on "problem saving .h5 for c++ simulation"</title>
			<link>http://www.k-wave.org/forum/topic/problem-saving-h5-for-c-simulation#post-4282</link>
			<pubDate>Tue, 21 Jan 2014 01:57:51 +0000</pubDate>
			<dc:creator>sheun</dc:creator>
			<guid isPermaLink="false">4282@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I am trying to save input file and run it on C++ (as suggested in the manual) in hope for reducing some calculation time. However, when I run kspaceFirstOrder3D with optional input 'savetodisk', I get a following message.&#60;br /&#62;
&#34;Error using kspaceFirstOrder_inputChecking (line 34)&#60;br /&#62;
The output field_data has been deprecated. Please use sensor.record = {'p_final'}&#60;br /&#62;
(etc) to return the final pressure field.&#34;&#60;br /&#62;
I am a little lost here as to how I should solve this issue. I really would appreciate if you could give me a guidance.&#60;br /&#62;
I am using multi element UT in a heterogeneous medium(with a ball in the medium using a makeBall function).&#60;/p&#62;
&#60;p&#62;Below is the code I used FYI,&#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 = 10;            % [grid points]&#60;/p&#62;
&#60;p&#62;% set total number of grid points not including the PML&#60;br /&#62;
Nx = 168 - 2*PML_X_SIZE;    % [grid points]&#60;br /&#62;
Ny = 84 - 2*PML_Y_SIZE;    % [grid points]&#60;br /&#62;
Nz = 84 - 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 = 0.75/2/1000;                  % [m]Nx&#60;/p&#62;
&#60;p&#62;% calculate the spacing between the grid points&#60;br /&#62;
dx = x;                     % [m]&#60;br /&#62;
dy = dx;                    % [m]&#60;br /&#62;
dz = dx;                    % [m]&#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;scalef = 1.0667;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PARAMETERS&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;if hetero&#60;br /&#62;
% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed = 2000*ones(Nx,Ny,Nz)     ;      % [m/s] 2nd&#60;br /&#62;
medium.sound_speed(1:round(Nx/scalef),:,:) = 1000 ;      % [m/s] 1st 101&#60;br /&#62;
medium.density = 5000*ones(Nx,Ny,Nz);               % [kg/m^3] 2nd&#60;br /&#62;
medium.density(1:round(Nx/scalef),:,:) = 1134 ;          % [kg/m^3] 1st&#60;/p&#62;
&#60;p&#62;medium.alpha_coeff = 0.001*ones(Nx,Ny,Nz);            % [dB/(MHz^y cm)] 2nd&#60;br /&#62;
medium.alpha_coeff(1:round(Nx/scalef),:,:)=0.011083   ;    % [dB/(MHz^y cm)] 1st&#60;br /&#62;
medium.alpha_power = 1.05;&#60;br /&#62;
medium.BonA = 6; %6 , 0 ussed&#60;br /&#62;
else&#60;br /&#62;
    % define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed = 1000*ones(Nx,Ny,Nz)     ;      % [m/s] 2nd&#60;br /&#62;
medium.density = 1134*ones(Nx,Ny,Nz);               % [kg/m^3] 2nd&#60;br /&#62;
medium.alpha_coeff = 0.011083*ones(Nx,Ny,Nz);            % [dB/(MHz^y cm)] 2nd&#60;br /&#62;
medium.alpha_power = 1.05;&#60;br /&#62;
medium.BonA = 6; %6&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
t_end = 175e-6;                  % [s]&#60;br /&#62;
kgrid.t_array = makeTime(kgrid, medium.sound_speed, [], t_end);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% Flaw Characteristics&#60;br /&#62;
% =========================================================================&#60;br /&#62;
if void_inclusion&#60;br /&#62;
%void_size = 0.75*10/1000; %% in grid points&#60;br /&#62;
%object = makeSphere(round(Nx/scalef), Ny/2, Nz/2, void_size);&#60;br /&#62;
%center_pos = [round(Nx/2), Ny/2, Nz/2];&#60;/p&#62;
&#60;p&#62;scattering_map = randn([Nx,Ny,Nz]);&#60;br /&#62;
scattering_c0 = 1000 + 25 + 75*scattering_map;&#60;br /&#62;
scattering_c0(scattering_c0 &#38;gt; 1600) = 2600;&#60;br /&#62;
scattering_c0(scattering_c0 &#38;lt; 1400) = 100;&#60;br /&#62;
scattering_rho0 = (scattering_c0/100)*7747;&#60;/p&#62;
&#60;p&#62;flaw = makeBall(Nx,Ny,Nz,Nx/scalef,Ny/2,Nz/2,3,0); % last argument &#34;1&#34; is for plotting&#60;br /&#62;
medium.sound_speed(flaw == 1) = scattering_c0(flaw == 1);; % m/s steel ball&#60;br /&#62;
medium.density(flaw == 1)     =  scattering_rho0(flaw == 1);;&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE SOURCE&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% define properties of the input signal&#60;br /&#62;
source_strength = 20e6;          % [Pa]&#60;br /&#62;
tone_burst_freq = 2.25e6;        % [Hz]&#60;br /&#62;
tone_burst_cycles = 3;&#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;br /&#62;
input_signal = toneBurst(1/(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./(1000*1134)).*input_signal;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE ULTRASOUND TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% physical properties of the transducer&#60;br /&#62;
transducer.number_elements = 16;    % total number of transducer elements&#60;br /&#62;
transducer.element_width = 2;       % width of each element [grid points/voxels]&#60;br /&#62;
transducer.element_length = 32;     % length of each element [grid points/voxels]&#60;br /&#62;
transducer.element_spacing = 0;     % spacing (kerf  width) between the elements [grid points/voxels]&#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 = 1000;                 % sound speed [m/s]&#60;br /&#62;
transducer.focus_distance = 28/1000;           % focus distance [m]&#60;br /&#62;
transducer.elevation_focus_distance = 28/1000; % focus distance in the elevation plane [m]&#60;br /&#62;
transducer.steering_angle = 0;                 % steering angle [degrees]&#60;/p&#62;
&#60;p&#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 = 16;&#60;br /&#62;
transducer.active_elements = ones(transducer.number_elements, 1);&#60;br /&#62;
%transducer.active_elements = zeros(transducer.number_elements, 1);&#60;br /&#62;
%transducer.active_elements(21:52) = 1;&#60;/p&#62;
&#60;p&#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;/p&#62;
&#60;p&#62;if run_simulation&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% RUN THE SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% set the input settings&#60;br /&#62;
input_args = {'DisplayMask', transducer.active_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, 'PlotScale', [-source_strength/7, source_strength/7]};&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
%[sensor_data] = kspaceFirstOrder3D(kgrid, medium, transducer, transducer, input_args{:});&#60;br /&#62;
filename = 'kwave_input_data.h5';&#60;br /&#62;
[sensor_data,p_final] = kspaceFirstOrder3D(kgrid, medium, transducer, transducer,'SaveToDisk',filename, input_args{:});
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
