<?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: image reconstruction for defects</title>
		<link>http://www.k-wave.org/forum/topic/image-reconstruction-for-defects</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:15:40 +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/image-reconstruction-for-defects" rel="self" type="application/rss+xml" />

		<item>
			<title>bencox on "image reconstruction for defects"</title>
			<link>http://www.k-wave.org/forum/topic/image-reconstruction-for-defects#post-1651</link>
			<pubDate>Fri, 22 Mar 2013 10:11:57 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">1651@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi oozunlu,&#60;/p&#62;
&#60;p&#62;The problem is with the forward modelling of the scattering, and specifically the very large contrast between the acoustic properties in the steel background and the air inclusion. k-Wave was written with only small heterogeneities in mind (say 10%), such as might be found between different soft tissue when doing ultrasound imaging. Large and sharp contrasts don't work well because the numerical method is a spectral method - it uses a Fourier transform to calculate the gradient.  (Technically, the coefficients in the spatial Fourier transform of the acoustic properties do not decay fast enough, and so the solution quickly becomes inaccurate.)&#60;/p&#62;
&#60;p&#62;You could try smoothing the acoustic properties using the smooth function, or trying an inclusion closer in properties to the steel background, but you would probably be better trying a model more specifically designed for modelling scattering from what is essentially a pressure-release (sound soft) interface. ie. one in which you can actually specify that as a boundary condition.&#60;/p&#62;
&#60;p&#62;Another thing to note is that in practice you will have shear waves in steel, which are also not modelled by k-Wave which assumes the medium is a fluid.&#60;/p&#62;
&#60;p&#62;Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>oozunlu on "image reconstruction for defects"</title>
			<link>http://www.k-wave.org/forum/topic/image-reconstruction-for-defects#post-1615</link>
			<pubDate>Thu, 21 Mar 2013 15:38:38 +0000</pubDate>
			<dc:creator>oozunlu</dc:creator>
			<guid isPermaLink="false">1615@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I modified &#34;2D Time Reversal Reconstruction For A Line Sensor Example&#34; and made medium heterogeneous with the following addition: However, simulation results in an expected situation. Did I do something wrong? Is it possible to apply image reconstruction for defects?&#60;br /&#62;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#60;br /&#62;
(I added an air bubble into a steel block)&#60;/p&#62;
&#60;p&#62;disc_x_pos=round(Nx*0.7);&#60;br /&#62;
disc_y_pos=round(Ny/4);&#60;br /&#62;
disc_radius=5;&#60;br /&#62;
air_buble = makeDisc(Nx, Ny, disc_x_pos, disc_y_pos, disc_radius);&#60;br /&#62;
air_buble_reverse = (air_buble-1)*-1;&#60;br /&#62;
medium.sound_speed = medium.sound_speed .* air_buble_reverse;&#60;br /&#62;
medium.sound_speed = medium.sound_speed + air_buble * 340 ;&#60;/p&#62;
&#60;p&#62;medium.density = 7800*ones(Nx, Ny);             % [kg/m^3]&#60;br /&#62;
medium.density = medium.density .* air_buble_reverse;&#60;br /&#62;
medium.density = medium.density + air_buble * 12.25  ;&#60;/p&#62;
&#60;p&#62;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#60;/p&#62;
&#60;p&#62;therefore, the complete solution is:&#60;br /&#62;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#60;/p&#62;
&#60;p&#62;clear all;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% create the computational grid&#60;br /&#62;
PML_size = 20;          % size of the PML in grid points&#60;br /&#62;
Nx = 128 - 2*PML_size;  % number of grid points in the x (row) direction&#60;br /&#62;
Ny = 256 - 2*PML_size;  % number of grid points in the y (column) direction&#60;br /&#62;
dx = 0.1e-3;            % grid point spacing in the x direction [m]&#60;br /&#62;
dy = 0.1e-3;            % grid point spacing in the y direction [m]&#60;br /&#62;
kgrid = makeGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed = 1500;	% [m/s]&#60;/p&#62;
&#60;p&#62;% create initial pressure distribution using makeDisc&#60;br /&#62;
disc_magnitude = 5; % [au]&#60;br /&#62;
disc_x_pos = 60;    % [grid points]&#60;br /&#62;
disc_y_pos = 140;  	% [grid points]&#60;br /&#62;
disc_radius = 5;    % [grid points]&#60;br /&#62;
disc_2 = disc_magnitude*makeDisc(Nx, Ny, disc_x_pos, disc_y_pos, disc_radius);&#60;/p&#62;
&#60;p&#62;disc_x_pos = 30;    % [grid points]&#60;br /&#62;
disc_y_pos = 110; 	% [grid points]&#60;br /&#62;
disc_radius = 8;    % [grid points]&#60;br /&#62;
disc_1 = disc_magnitude*makeDisc(Nx, Ny, disc_x_pos, disc_y_pos, disc_radius);&#60;/p&#62;
&#60;p&#62;medium.sound_speed = 1500*ones(Nx, Ny);         % [m/s]&#60;/p&#62;
&#60;p&#62;disc_x_pos=round(Nx*0.7);&#60;br /&#62;
disc_y_pos=round(Ny/4);&#60;br /&#62;
disc_radius=5;&#60;br /&#62;
air_buble = makeDisc(Nx, Ny, disc_x_pos, disc_y_pos, disc_radius);&#60;br /&#62;
air_buble_reverse = (air_buble-1)*-1;&#60;br /&#62;
medium.sound_speed = medium.sound_speed .* air_buble_reverse;&#60;br /&#62;
medium.sound_speed = medium.sound_speed + air_buble * 340 ;&#60;/p&#62;
&#60;p&#62;medium.density = 7800*ones(Nx, Ny);             % [kg/m^3]&#60;br /&#62;
medium.density = medium.density .* air_buble_reverse;&#60;br /&#62;
medium.density = medium.density + air_buble * 12.25  ;&#60;/p&#62;
&#60;p&#62;% smooth the initial pressure distribution and restore the magnitude&#60;br /&#62;
%p0 = smooth(kgrid, disc_1 + disc_2, true);&#60;br /&#62;
p0 = smooth(kgrid, disc_1 + disc_2, true);&#60;br /&#62;
% assign to the source structure&#60;br /&#62;
source.p0 = p0;&#60;/p&#62;
&#60;p&#62;% define a binary line sensor&#60;br /&#62;
sensor.mask = zeros(Nx, Ny);&#60;br /&#62;
sensor.mask(1, :) = 1;&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
[kgrid.t_array dt] = makeTime(kgrid, medium.sound_speed);&#60;/p&#62;
&#60;p&#62;% set the input arguements: force the PML to be outside the computational&#60;br /&#62;
% grid; switch off p0 smoothing within kspaceFirstOrder2D&#60;br /&#62;
input_args = {'PMLInside', false, 'PMLSize', PML_size, 'Smooth', false, 'PlotPML', false};&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;% reset the initial pressure&#60;br /&#62;
source.p0 = 0;&#60;/p&#62;
&#60;p&#62;% assign the time reversal data&#60;br /&#62;
sensor.time_reversal_boundary_data = sensor_data;&#60;/p&#62;
&#60;p&#62;% run the time reversal reconstruction&#60;br /&#62;
p0_recon = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;% add first order compensation for only recording over a half plane&#60;br /&#62;
p0_recon = p0_recon*2;&#60;/p&#62;
&#60;p&#62;% repeat the FFT reconstruction for comparison&#60;br /&#62;
p_xy = kspaceLineRecon(sensor_data.', dy, dt, medium.sound_speed, 'PosCond', true, 'Interp', 'linear');&#60;/p&#62;
&#60;p&#62;% define a second k-space grid using the dimensions of p_xy&#60;br /&#62;
[Nx_recon, Ny_recon] = size(p_xy);&#60;br /&#62;
kgrid_recon = makeGrid(Nx_recon, dt*medium.sound_speed, Ny_recon, dy);&#60;/p&#62;
&#60;p&#62;% resample p_xy to be the same size as source.p0&#60;br /&#62;
p_xy_rs = interp2(kgrid_recon.y, kgrid_recon.x - min(kgrid_recon.x(:)), p_xy, kgrid.y, kgrid.x - min(kgrid.x(:)));&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% VISUALISATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% plot the initial pressure and sensor distribution&#60;br /&#62;
figure;&#60;br /&#62;
imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, p0 + sensor.mask*disc_magnitude, [-disc_magnitude disc_magnitude]);&#60;br /&#62;
colormap(getColorMap);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
colorbar;&#60;/p&#62;
&#60;p&#62;% plot the reconstructed initial pressure&#60;br /&#62;
figure;&#60;br /&#62;
imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, p0_recon, [-disc_magnitude disc_magnitude]);&#60;br /&#62;
colormap(getColorMap);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
colorbar;&#60;/p&#62;
&#60;p&#62;% apply a positivity condition&#60;br /&#62;
p0_recon(p0_recon &#38;lt; 0) = 0;&#60;/p&#62;
&#60;p&#62;% plot the reconstructed initial pressure with positivity condition&#60;br /&#62;
figure;&#60;br /&#62;
imagesc(kgrid.y_vec*1e3, kgrid.x_vec*1e3, p0_recon, [-disc_magnitude disc_magnitude]);&#60;br /&#62;
colormap(getColorMap);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
colorbar;&#60;/p&#62;
&#60;p&#62;% plot a profile for comparison&#60;br /&#62;
figure;&#60;br /&#62;
plot(kgrid.y_vec*1e3, p0(disc_x_pos, :), 'k-', ...&#60;br /&#62;
    kgrid.y_vec*1e3, p_xy_rs(disc_x_pos, :), 'r--', ...&#60;br /&#62;
    kgrid.y_vec*1e3, p0_recon(disc_x_pos, :), 'b:');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
ylabel('Pressure');&#60;br /&#62;
legend('Initial Pressure', 'FFT Reconstruction', 'Time Reversal');&#60;br /&#62;
axis tight;&#60;br /&#62;
set(gca, 'YLim', [0 5.1]);
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
