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

		<item>
			<title>zhili on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4084</link>
			<pubDate>Fri, 08 Nov 2013 05:55:22 +0000</pubDate>
			<dc:creator>zhili</dc:creator>
			<guid isPermaLink="false">4084@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad:&#60;br /&#62;
  Thank you very much for the info and I will try it later.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4057</link>
			<pubDate>Fri, 01 Nov 2013 12:48:50 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4057@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi zhili,&#60;/p&#62;
&#60;p&#62;Unfortunately manually defining the beamforming delays on transmit is not currently supported. However, I can certainly take a look at adding this functionality for a future release. &#60;/p&#62;
&#60;p&#62;In the meantime, if you want to try to modify the code yourself, take a look at the &#60;code&#62;delay_mask&#60;/code&#62; method of the &#60;code&#62;kWaveTransducer&#60;/code&#62; class, and the line &#60;code&#62;delay_mask = source.delay_mask;&#60;/code&#62; in /private/kspaceFirstOrder_inputChecking.m.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zhili on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4048</link>
			<pubDate>Fri, 01 Nov 2013 02:06:18 +0000</pubDate>
			<dc:creator>zhili</dc:creator>
			<guid isPermaLink="false">4048@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;on transmit side, thanks.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4045</link>
			<pubDate>Thu, 31 Oct 2013 18:08:45 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4045@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Do you want to set the beamforming delays on receive, i.e., a modification of the scan_line method, or on transmit?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zhili on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4040</link>
			<pubDate>Thu, 31 Oct 2013 12:55:35 +0000</pubDate>
			<dc:creator>zhili</dc:creator>
			<guid isPermaLink="false">4040@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad:&#60;br /&#62;
  Thank you very much for the suggestion. I'll do so as what you suggested.&#60;/p&#62;
&#60;p&#62;  On the other hand, if I'd like to use focus_distance and steering at the same time, say focus at 20mm, and steering at 15 degree, so the final focus point will be at (x,y)=(20mm,20*sin(15*pi/180) ), or at (x,y) = (20*cos(15*pi/180),20*sin(15*pi/180) )? &#60;/p&#62;
&#60;p&#62;  Actually, what I'd like to do is to directly give the simulator the beamforming_delays which I have calculated by my own according to any focus point(x,y)? Any convenient way to assign the beamforming_delays to the engine?&#60;/p&#62;
&#60;p&#62;thanks a lot.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4033</link>
			<pubDate>Wed, 30 Oct 2013 10:19:23 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4033@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Zhili,&#60;/p&#62;
&#60;p&#62;If there is no elevation focus, then I would suggest averaging the signals over blocks of element_width*element_length. This will match what happens in the MATLAB version. If you are not interested in the spatial averaging effects that arise due to a finite element size, then you could also use your option 2 or 3.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zhili on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4032</link>
			<pubDate>Wed, 30 Oct 2013 03:51:04 +0000</pubDate>
			<dc:creator>zhili</dc:creator>
			<guid isPermaLink="false">4032@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;br /&#62;
  Thank you very much for the answer and looking forward for the new release. And for current simulation, which solution do you suggest because C++ version is much faster:&#60;br /&#62;
1. sum these element_width*element_length signals together to become one output as matlab version&#60;br /&#62;
2. pick one of them as the output, say 1,3,5,...,61,63 rows(because element_width=2) in above case&#60;br /&#62;
3. just let element_width and element_length=1 though the dy resolution will be lower&#60;br /&#62;
4.Or other way you suggest. &#60;/p&#62;
&#60;p&#62;thanks a lot
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4030</link>
			<pubDate>Tue, 29 Oct 2013 17:50:02 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4030@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Zhili,&#60;/p&#62;
&#60;p&#62;This is the same problem as mentioned above, i.e., the output from the MATLAB code is a single time series per physical element of the transducer, while the output from the C++ code is a single time series per grid point in the sensor mask. We plan to add a new method to the kWaveTransducer class that converts the sensor data returned by the C++ code to the same format as the MATLAB code in the next release.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zhili on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-4023</link>
			<pubDate>Sat, 26 Oct 2013 02:20:02 +0000</pubDate>
			<dc:creator>zhili</dc:creator>
			<guid isPermaLink="false">4023@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Brad:&#60;br /&#62;
  Not quite sure if what I encountered is the same as what you mentioned above. I run the us_bmode_linear example, in Matlab version kspaceFirstOrder3D, the size of sensor_data is just the number_elements x samples = 32 x 1585. However, for C++ version kspaceFirstOrder3DC, the size of sensor_data is (number_element*element_width*element_length) x samples= (32*2*24) x 1585 = 1536 x 1585. And the first 16 sensor_data_3DC(1:32,:) is not the same as sensor_data_3D(:,:). Then the image is not the same. &#60;/p&#62;
&#60;p&#62;  If that so, which one is more realistic and why? Or anything I didn't do it right?&#60;/p&#62;
&#60;p&#62;thanks.&#60;br /&#62;
Zhili
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-1176</link>
			<pubDate>Sat, 19 Jan 2013 23:33:41 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">1176@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi hhamtaii,&#60;/p&#62;
&#60;p&#62;When you use an object of the &#60;code&#62;kWaveTransducer&#60;/code&#62; class as the sensor, the MATLAB implementation of &#60;code&#62;kspaceFirstOrder3D&#60;/code&#62; will automatically average the signals across the grid points belonging to each transducer element using the appropriate delays. The output &#60;code&#62;sensor_data&#60;/code&#62; will then contain as many time series as there are transducer elements.&#60;/p&#62;
&#60;p&#62;Unfortunately this behaviour is not implemented in the C++ code, so instead the output &#60;code&#62;sensor_data&#60;/code&#62; will contain as many time series as the number of grid points that form the transducer. These can still be combined to form the same output as the MATLAB code, but it is a little fiddly. We are planning on adding an extra function to the &#60;code&#62;kWaveTransducer&#60;/code&#62; class to automatically do this with the next release.&#60;/p&#62;
&#60;p&#62;I hope that explains things - apologies for not documenting this behaviour more comprehensively!&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>hhamtaii on "mismatch between matlab and c code"</title>
			<link>http://www.k-wave.org/forum/topic/mismatch-between-matlab-and-c-code#post-1175</link>
			<pubDate>Sat, 19 Jan 2013 20:06:23 +0000</pubDate>
			<dc:creator>hhamtaii</dc:creator>
			<guid isPermaLink="false">1175@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I run k-wave version 1.0 on a Matlab 2012a and a 64-bit windows 7. According to the toolbox manual, I replaced the kspaceFirstOrder3D with kspaceFirstOrder3DC in native examples of the toolbox, such as B-mode example or Phased-Array example so to speed up, but I found out that the main outputs (sensor-data) mismatch between the two prospecting equivalent functions.&#60;br /&#62;
Sensor-data from the Matlab function has a true dimension and seemingly true values, however the corresponding output of the c++ code, is oversized and weird value. I checked if the former is a subset of the latter, but it was NOT.&#60;br /&#62;
Is anything more than just replacing the two function names, necessary to utilize the c++ code? Or there is kind of bug?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
