<?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: Cart2grid issue with linear arrays</title>
		<link>http://www.k-wave.org/forum/topic/cart2grid-issue-with-linear-arrays</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:21: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/cart2grid-issue-with-linear-arrays" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Cart2grid issue with linear arrays"</title>
			<link>http://www.k-wave.org/forum/topic/cart2grid-issue-with-linear-arrays#post-434</link>
			<pubDate>Tue, 10 Apr 2012 02:54:37 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">434@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Dan,&#60;/p&#62;
&#60;p&#62;Thanks for the report and your detective work. We actually check for this error inside &#60;code&#62;private/kspaceFirstOrder_createStorageVariables.m&#60;/code&#62; for the specific case of a Cartesian sensor mask used with &#60;code&#62;&#38;#39;CartInterp&#38;#39;&#60;/code&#62; set to &#60;code&#62;&#38;#39;nearest&#38;#39;&#60;/code&#62;. However, it would seem that this code would be better off inside &#60;code&#62;cart2grid&#60;/code&#62; to give a warning for other usage scenarios. We'll migrate this across for the next release.&#60;/p&#62;
&#60;p&#62;In your case, one option would be to use a binary sensor mask with dx set exactly to the element spacing. This way you won't need interpolation, and you will also be forced to use a grid spacing small enough to capture the same range of spatial frequencies that would be physically sampled by your array.&#60;/p&#62;
&#60;p&#62;Brad
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DanR on "Cart2grid issue with linear arrays"</title>
			<link>http://www.k-wave.org/forum/topic/cart2grid-issue-with-linear-arrays#post-431</link>
			<pubDate>Thu, 05 Apr 2012 21:02:30 +0000</pubDate>
			<dc:creator>DanR</dc:creator>
			<guid isPermaLink="false">431@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Brad and Ben,&#60;br /&#62;
A small issue has popped up as I have done a little modeling of linear arrays. Depending on my selected grid interval and size of the sensor elements, I get a fatal error:&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
Subscripted assignment dimension mismatch.&#60;br /&#62;
Error in kspaceFirstOrder_inputChecking (line 227)&#60;br /&#62;
                sensor.time_reversal_boundary_data(:, new_col_pos) =&#60;br /&#62;
                order_index;&#60;br /&#62;
Error in kspaceFirstOrder2D (line 427)&#60;br /&#62;
kspaceFirstOrder_inputChecking; ...&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I modified makeCartCircle to generate the Cartesian coordinates of a line of sensor elements. Generally, the elements are quite small. If I choose a dx of 0.044 mm and 9 points per sensor (with two points as spaces), I do not get an error. If I choose dx to be 0.067 mm and 6 points per sensor, I do get this error.&#60;/p&#62;
&#60;p&#62;I have traced the problem to &#60;code&#62;Cart2grid.m&#60;/code&#62;. Looking at the array &#60;code&#62;data_x&#60;/code&#62; which holds the Cartesian x-value, I see that it can contain 1 or more duplicate values as a result of the rounding function. Since &#60;code&#62;data_y&#60;/code&#62; values are constant (the array was oriented vertically), this put duplicate points into the same position in &#60;code&#62;grid_data&#60;/code&#62;, losing the first point. Now the arrays become mismatched. In the past, I have used this code for circular arrays without a problem, but the probability of both the x- and y-coordinates rounding to the same grid point as a previous point is much smaller.&#60;/p&#62;
&#60;p&#62;Relevant code in &#60;code&#62;Cart2grid&#60;/code&#62;:&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
% scale position values to grid centered pixel coordinates using nearest&#60;br /&#62;
% neighbour interpolation&#60;br /&#62;
data_x = round(data_x./kgrid.dx);&#60;br /&#62;
data_y = round(data_y./kgrid.dy);&#60;/p&#62;
&#60;p&#62;% shift pixel coordinates to coincide with matrix indexing&#60;br /&#62;
data_x = data_x + floor(kgrid.Nx/2) + 1;&#60;br /&#62;
data_y = data_y + floor(kgrid.Ny/2) + 1;&#60;/p&#62;
&#60;p&#62;% map values&#60;br /&#62;
for data_index = 1:length(data_x)&#60;br /&#62;
    grid_data(data_x(data_index), data_y(data_index)) = point_index(data_index);&#60;br /&#62;
end&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I can work around this by judiciously choosing my grid size. Or I can probably reduce the chances of it happening by putting my sensors at an angle. So it is not big issue.&#60;br /&#62;
Regards,&#60;br /&#62;
Dan
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
