<?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; User Favorites: yuanbo</title>
		<link><a href='http://www.k-wave.org/forum/profile/yuanbo'>yuanbo</a></link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 22:31:19 +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/profile/" rel="self" type="application/rss+xml" />

		<item>
			<title>RenanCunha on "Some first steps on ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/some-first-steps-on-ultrasound-simulation#post-8684</link>
			<pubDate>Thu, 08 Dec 2022 00:17:51 +0000</pubDate>
			<dc:creator>RenanCunha</dc:creator>
			<guid isPermaLink="false">8684@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi developers and members,&#60;/p&#62;
&#60;p&#62;I'm new to K-wave, and I have recently started dealing with acoustic simulation for FUS. I'm starting with an example of Prof. Treeby in FUN22. I have some basic questions about the code shown in his presentation.&#60;/p&#62;
&#60;p&#62;1) Loading&#60;/p&#62;
&#60;p&#62;%Prof. Treeby&#60;br /&#62;
ct_3D = load_nii('scct_unsmooth.nii');&#60;br /&#62;
ct_2D = ct_3D.img(2:end, 2:end, 70); &#60;/p&#62;
&#60;p&#62;%My code&#60;br /&#62;
ct_2D = dicomread(&#34;24291&#34;);&#60;/p&#62;
&#60;p&#62;A) Why use NIfTI files? Is there a downside to using DICOM?&#60;/p&#62;
&#60;p&#62;B) I also didn't understand the command &#34;ct_2D = ct_3D.img(2:end, 2:end, 70)&#34;. It seems that Prof. Treeby chooses slice 70 (and that's why it's a ct_2D) from the .nii file, but I don't understand the &#34;2:end&#34; options.&#60;/p&#62;
&#60;p&#62;C) Prof. Treeby said that when doing simulations, it's better to do them in 3D rather than 2D. What would be the advantage of that?&#60;/p&#62;
&#60;p&#62;2) Attenuation coefficient &#60;/p&#62;
&#60;p&#62;%Prof. Treeby&#60;br /&#62;
alpha_coeff = 0.6 + 7.4*skull_mask;&#60;br /&#62;
alpha_power = ones(Nx, Ny);&#60;br /&#62;
medium.alpha_coeff = fitPowerLawParamsMulti(alpha_coeff, alpha_power, medium.sound_speed, freq, 2, true)&#60;br /&#62;
medium.alpha_power = 2;&#60;/p&#62;
&#60;p&#62;%My code&#60;br /&#62;
alpha_coeff = 0.6 + 7.4*skull_mask;&#60;br /&#62;
alpha_power = ones(Nx, Ny);&#60;br /&#62;
medium.alpha_coeff = 0.11;&#60;br /&#62;
medium.alpha_power = 2;&#60;/p&#62;
&#60;p&#62;A) MATLAB couldn't run line 3 of this code on my computer. I am trying to understand why it wasn't possible, but Prof. Treeby said that this line had something different and he could provide a document for it. So to eliminate the error, I simply assigned a test value to medium.alpha_coeff. But how do I make it work properly?&#60;/p&#62;
&#60;p&#62;3) Grid, transducer, signal, and simulation&#60;/p&#62;
&#60;p&#62;%Prof. Treeby&#60;/p&#62;
&#60;p&#62;%Grid&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dx);&#60;br /&#62;
cfl = 0.3;&#60;br /&#62;
t_end = 150e-6;&#60;br /&#62;
kgrid.makeTime(medium.sound_speed, cfl, t_end);&#60;/p&#62;
&#60;p&#62;%Transducer&#60;br /&#62;
karray = kWaveArray;&#60;br /&#62;
position = [5e-3, -0.11];&#60;br /&#62;
radius = 64e-3;&#60;br /&#62;
diameter = 64e-3;&#60;br /&#62;
focus_pos = [5e-3, 0];&#60;br /&#62;
karray.addArcElement(position, radius, diameter, focus_pos);&#60;/p&#62;
&#60;p&#62;%Signal&#60;br /&#62;
amp = 100e3;&#60;br /&#62;
input_signal = createCWSignals(kgrid.t_array, freq, amp, 0);&#60;/p&#62;
&#60;p&#62;%Command conversion&#60;br /&#62;
 source.p_mask = karray.getArrayBinaryMask(kgrid);&#60;br /&#62;
% source.p = karray.getDistributedSourceSignal(kgrid, input_signal);&#60;/p&#62;
&#60;p&#62;%Signal detection&#60;br /&#62;
sensor.record = ('p_max_all');&#60;/p&#62;
&#60;p&#62;%Simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, ...&#60;br /&#62;
    'PMLInside', false, ...&#60;br /&#62;
    'PMLSize', 'auto', ...&#60;br /&#62;
    'PlotPML', false, ...&#60;br /&#62;
    'PlotScale', amp * [-1, 1], ...&#60;br /&#62;
    'DisplayMask', edge(skull_mask, 'Canny'), ...&#60;br /&#62;
    'DataCast', 'single');&#60;/p&#62;
&#60;p&#62;A) This is where most errors appear in my simulation. I get:&#60;/p&#62;
&#60;p&#62;Unrecognized function or variable 'tolStar'.&#60;br /&#62;
Error in offGridPoints (line 264)&#60;br /&#62;
                [ind, is, js] = tolStar(bli_tolerance, kgrid, point);&#60;/p&#62;
&#60;p&#62;Error in kWaveArray/getElementGridWeights (line 931)&#60;br /&#62;
                grid_weights = offGridPoints(kgrid, integration_points, scale, ...&#60;/p&#62;
&#60;p&#62;Error in kWaveArray/getArrayBinaryMask (line 968)&#60;br /&#62;
                grid_weights = obj.getElementGridWeights(kgrid, ind);&#60;/p&#62;
&#60;p&#62;Error in dicomtest1 (line 57)&#60;br /&#62;
 source.p_mask = karray.getArrayBinaryMask(kgrid);&#60;/p&#62;
&#60;p&#62;I would like to ask you for some tips on how to handle these errors. Also, since my transducer is pulsed, what is the best practice for modifying the transducer from continuous to pulsed?&#60;/p&#62;
&#60;p&#62;I would appreciate any help!&#60;br /&#62;
Regars,&#60;br /&#62;
Renan
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
