<?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: Error in HD5 read when using a plane wave source with C++ version.</title>
		<link>http://www.k-wave.org/forum/topic/error-in-hd5-read-when-using-a-plane-wave-source-with-c-version</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:01:47 +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/error-in-hd5-read-when-using-a-plane-wave-source-with-c-version" rel="self" type="application/rss+xml" />

		<item>
			<title>scottalm on "Error in HD5 read when using a plane wave source with C++ version."</title>
			<link>http://www.k-wave.org/forum/topic/error-in-hd5-read-when-using-a-plane-wave-source-with-c-version#post-5654</link>
			<pubDate>Wed, 31 Aug 2016 00:13:55 +0000</pubDate>
			<dc:creator>scottalm</dc:creator>
			<guid isPermaLink="false">5654@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;The problem ended up being how I was defining the source (along the time instead of the spatial dimension):&#60;/p&#62;
&#60;p&#62;source.uz = reshape(source.uz, [], 1);&#60;/p&#62;
&#60;p&#62;Should have been:&#60;/p&#62;
&#60;p&#62;source.uz = reshape(source.uz, 1, []);&#60;/p&#62;
&#60;p&#62;The Matlab code will execute this, but the C++ code won't (since it is improperly constructed). It would be nice if the Matlab code would do a check for dimension sizes, but at least there is a forum post if someone comes across this problem.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Error in HD5 read when using a plane wave source with C++ version."</title>
			<link>http://www.k-wave.org/forum/topic/error-in-hd5-read-when-using-a-plane-wave-source-with-c-version#post-5604</link>
			<pubDate>Wed, 27 Jul 2016 09:36:29 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">5604@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi scottalm,&#60;/p&#62;
&#60;p&#62;If you add a second time point to your source, e.g., something like&#60;/p&#62;
&#60;p&#62;&#60;code&#62;source.uz(:, 2) = 0&#60;/code&#62;;&#60;/p&#62;
&#60;p&#62;Does it work? I would need to check, but it's possible the C++ code explicitly checks for a 2D input signal.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jiri Jaros on "Error in HD5 read when using a plane wave source with C++ version."</title>
			<link>http://www.k-wave.org/forum/topic/error-in-hd5-read-when-using-a-plane-wave-source-with-c-version#post-5595</link>
			<pubDate>Tue, 26 Jul 2016 10:12:56 +0000</pubDate>
			<dc:creator>Jiri Jaros</dc:creator>
			<guid isPermaLink="false">5595@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi scottalm,&#60;/p&#62;
&#60;p&#62;I think the matlab script is not correct - you mixed the source spatial definition (position and size) with the driving signal definition.&#60;/p&#62;
&#60;p&#62;source.u_mask - this should be the spatial definition of the transducer&#60;br /&#62;
source.uz - this is the driving signal&#60;/p&#62;
&#60;p&#62;I think you tried to define the shape of the source in the uz component of the driving signal.&#60;br /&#62;
Jiri
&#60;/p&#62;</description>
		</item>
		<item>
			<title>scottalm on "Error in HD5 read when using a plane wave source with C++ version."</title>
			<link>http://www.k-wave.org/forum/topic/error-in-hd5-read-when-using-a-plane-wave-source-with-c-version#post-5592</link>
			<pubDate>Fri, 22 Jul 2016 00:40:08 +0000</pubDate>
			<dc:creator>scottalm</dc:creator>
			<guid isPermaLink="false">5592@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I am using the SSE3 Linux binaries for this work, but I have seen the same error in the Windows AVX2 binaries. &#60;/p&#62;
&#60;p&#62;I'm not sure if this is a real bug or just me missing something somewhere, but it seems that when I try to use a plane wave source with the C++ version of k-wave I get an error reading in the HD5 file. &#60;/p&#62;
&#60;p&#62;As an example, running the following works:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;% create the computational grid
Nx = 108;
Ny = 108;
Nz = 108;

dx = .05;
dy = .05;
dz = .05;
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);

model = ones(Nx, Ny, Nz);
% density
rho_v=[1e3];
% speed of sound
c_v=[1500];

medium.sound_speed = c_v(model); % [m/s]
medium.density     = rho_v(model);  % [kg/m^3] 

medium.alpha_coeff = 0;     % [dB/(MHz^2 cm)]
medium.alpha_power = 0.999;

sensor.mask = ones(Nx, Ny, Nz);

% record the maximum pressure
sensor.record = {&#38;#39;p_max&#38;#39;};

source.u_mask =  ones(Nx, Ny, Nz);

source.uz = zeros(Nx, Ny, Nz);
source.uz(:, :, 3) = 1;
source.uz = smooth(kgrid, source.uz, true);
source.uz = reshape(source.uz, [], 1);

input_args = {&#38;#39;PlotScale&#38;#39;, &#38;#39;auto&#38;#39;, ...
    &#38;#39;PMLInside&#38;#39;, false, &#38;#39;PlotPML&#38;#39;, false};

sensor_data = kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:})&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;But when I replace &#60;code&#62;kspaceFirstOrder3D&#60;/code&#62; with &#60;code&#62;kspaceFirstOrder3DC&#60;/code&#62;, it errors out giving me&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;K-Wave panic: Data loading was not successful!
Error: Dataset &#38;quot;uz_source_input&#38;quot;  has wrong dimension sizes!&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The size is appropriate for Matlab, but doesn't seem to work for C++. Am I doing something incorrectly?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
