<?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: How to rotate arc (circle) source</title>
		<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:40:54 +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/how-to-rotate-arc-circle-source" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-558</link>
			<pubDate>Wed, 20 Jun 2012 23:25:37 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">558@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Neer,&#60;/p&#62;
&#60;p&#62;You could create a full circle with the required radius (making the circle grid size big enough to contain it), then copy the part you need to your sensor mask. For example, something like:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;circle = makeCircle(2*radius+1, 2*radius+1, radius+1, radius+1, radius);
sensor.mask = circle(1:Nx, round(end/2 - Ny/2)+1:round(end/2 + Ny/2));&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Good luck with your simulations,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>neer on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-557</link>
			<pubDate>Wed, 20 Jun 2012 22:33:26 +0000</pubDate>
			<dc:creator>neer</dc:creator>
			<guid isPermaLink="false">557@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;br /&#62;
I visited the above thread as my requirements are similar to Mr. Diwaker. I want to construct a rotated sensor mask in the form of an arc. The problem is when I construct the initial complete circle, it does not fit within the grid space. In other words my question is, is it possible to construct a completely fitting arc with included angle less than pi?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-183</link>
			<pubDate>Tue, 21 Jun 2011 00:21:55 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">183@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Diwaker,&#60;/p&#62;
&#60;p&#62;To create a triangular medium, you could do something like:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;% define literals
Nx = 128;
Nz = 128;
triangle_size = 32;
triangle_x_pos = 32;
triangle_z_pos = 64;
triangle_sound_speed = 3000;
water_sound_speed = 1500;

% create medium
medium.sound_speed = zeros(Nz, Nx);
medium.sound_speed(triangle_z_pos:triangle_z_pos + triangle_size - 1, ...
    triangle_x_pos:triangle_x_pos + triangle_size - 1) ...
    = tril(ones(triangle_size));
medium.sound_speed(medium.sound_speed == 1) = triangle_sound_speed;
medium.sound_speed(medium.sound_speed == 0) = water_sound_speed;

% display medium
figure;
imagesc(medium.sound_speed);
axis image;
colorbar;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;To define a custom display mask, you will need to add the commands &#60;code&#62;&#38;#39;DisplayMask&#38;#39;, your_display_mask&#60;/code&#62; after all the other inputs when you call &#60;code&#62;kspaceFirstOrder2D&#60;/code&#62;. The display mask must be a binary matrix the same size as your computational grid. The variable &#60;code&#62;medium&#60;/code&#62; is actually a structure with several fields (&#60;code&#62;medium.sound_speed&#60;/code&#62;, &#60;code&#62;medium.density&#60;/code&#62;, etc). You will need to address the fields directly if you want to use them as a display mask.&#60;/p&#62;
&#60;p&#62;I hope that helps with your project.&#60;/p&#62;
&#60;p&#62;Kind regards,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Diwaker on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-169</link>
			<pubDate>Wed, 15 Jun 2011 11:56:06 +0000</pubDate>
			<dc:creator>Diwaker</dc:creator>
			<guid isPermaLink="false">169@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thank you Brad,&#60;/p&#62;
&#60;p&#62;I am new to MATLAB. A small syntax as to be used in the program would be really nice. &#60;/p&#62;
&#60;p&#62;Whenever, I tried to use triangular binary medium, there is an error of uneven X,Y and Z vector. &#60;/p&#62;
&#60;p&#62;I couldn't get external image loaded as medium like we do in source {source.p}, can you write a sample command?&#60;/p&#62;
&#60;p&#62;Sample command also to make the medium visible is requested. I used Display_mask=medium, this resulted error.&#60;/p&#62;
&#60;p&#62;Changing color-map succeeded nicely. &#60;/p&#62;
&#60;p&#62;Thank you very much for availing such a wonderful tool.&#60;/p&#62;
&#60;p&#62;regards,&#60;/p&#62;
&#60;p&#62;Diwaker
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-161</link>
			<pubDate>Mon, 30 May 2011 03:21:49 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">161@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Diwaker,&#60;/p&#62;
&#60;p&#62;&#60;em&#62;*How to make right angled triangular mediums?&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;You could use something like &#60;code&#62;triangle = tril(ones(64, 64));&#60;/code&#62; to create the triangle, and then place it within a larger matrix where you need it.&#60;/p&#62;
&#60;p&#62;&#60;em&#62;*Is it possible to load arbitrary shapes as images and make them work as medium?&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;Yes. See the &#60;a href=&#34;http://www.k-wave.org/documentation/example_ivp_loading_external_image.php&#34;&#62;Loading External Image Maps Example&#60;/a&#62;. Instead of assigning the loaded image to the initial pressure you could scale it, and then assign it to &#60;code&#62;medium.sound_speed&#60;/code&#62; etc.&#60;/p&#62;
&#60;p&#62;&#60;em&#62;*Can medium be made visible on the running simulation, may be as a color patch or a faint border?&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;You can set a custom display mask using the &#60;code&#62;&#38;#39;DisplayMask&#38;#39;&#60;/code&#62; input, but this only has limited functionality. The mask must be binary and is displayed as black.&#60;/p&#62;
&#60;p&#62;&#60;em&#62;*Can the color-map of the animated plot be changed to gray-scale?&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;Yes. Open &#60;code&#62;getColorMap&#60;/code&#62; and replace the line &#60;code&#62;cm = [neg; pos];&#60;/code&#62; with &#60;code&#62;cm = gray(num_colors);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Kind regards,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Diwaker on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-160</link>
			<pubDate>Wed, 25 May 2011 07:33:23 +0000</pubDate>
			<dc:creator>Diwaker</dc:creator>
			<guid isPermaLink="false">160@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;I was on holidays for 2 weeks. I tried your solution yesterday it worked nicely. Thank you very very much.&#60;/p&#62;
&#60;p&#62;I yet have another problem. I want to create a Heterogeneous medium of type, Water-Glass-Water. The glass has to be right angled triangle.&#60;/p&#62;
&#60;p&#62;*How to make right angled triangular mediums?&#60;/p&#62;
&#60;p&#62;*Is it possible to load arbitrary shapes as images and make them work as medium? &#60;/p&#62;
&#60;p&#62;*Can medium be made visible on the running simulation, may be as a color patch or a faint border?&#60;/p&#62;
&#60;p&#62;*Can the color-map of the animated plot be changed to gray-scale?&#60;/p&#62;
&#60;p&#62;I appreciate you support, &#60;/p&#62;
&#60;p&#62;thanks&#60;br /&#62;
Diwaker
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-141</link>
			<pubDate>Thu, 05 May 2011 09:31:10 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">141@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Diwaker,&#60;/p&#62;
&#60;p&#62;The source shape is defined as a binary matrix (i.e., a matrix of 1's and 0's) where the 1's (or 'trues') correspond to the source elements within the grid. This can be anything you want.&#60;/p&#62;
&#60;p&#62;If you are using the function &#60;code&#62;makeCircle&#60;/code&#62;, this creates a binary mask of a circle using the midpoint circle algorithm based on the input parameters, one of which is the arc angle. Within the function, this is defined clockwise from the negative x-axis. As such, a 90° arc as in the &#60;a href=&#34;http://www.k-wave.org/documentation/example_tvsp_transducer_field_patterns.php&#34;&#62;Simulating Transducer Field Patterns Example&#60;/a&#62; will point diagonally across the domain from the top left to the bottom right.&#60;/p&#62;
&#60;p&#62;If you want to create an arc pointing in another direction, you can create a complete circle in the position you require, and then mask out the elements you don't need. For example, to create an arc pointing downwards you could use something like:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;Nx = 128;
Nz = 128;
arc_radius = 20;
arc_height = 10;
x_pos = Nx/2;
z_pos = 25;
arc = makeCircle(Nx, Nz, x_pos, z_pos, arc_radius);
arc(z_pos - arc_radius + arc_height:end, :) = 0;
imagesc(arc);
axis image;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Diwaker on "How to rotate arc (circle) source"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-rotate-arc-circle-source#post-140</link>
			<pubDate>Thu, 05 May 2011 08:35:40 +0000</pubDate>
			<dc:creator>Diwaker</dc:creator>
			<guid isPermaLink="false">140@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I have been trying to get the arc source emitting vertically downwards.  I think, one needs to rotate the circle for it. Else, it automatically chooses to start somewhere around the left corner of the figure window producing the diagonal propagation.&#60;/p&#62;
&#60;p&#62;Is there a way to make the circle emit straight downwards?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
