File: demo_grayscale_ex1.m

package info (click to toggle)
octave-iso2mesh 1.9.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 11,128 kB
  • sloc: cpp: 11,982; ansic: 10,158; sh: 365; makefile: 59
file content (27 lines) | stat: -rw-r--r-- 901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% this example demonstrates how to mesh a gray-scale volume directly.
% the data set is a Jacobian matrix obtained by multiplying two
% Green's functions
% see Appendix in Qianqian Fang, Computational methods for microwave medical imaging. Ph.D.
% Dissertation, Dartmouth College, Hanover, NH, U.S.A., Dec 2004.

[xi, yi, zi] = meshgrid(1:40, 1:40, 1:80);
r1 = [xi(:) - 20, yi(:) - 20, zi(:) - 20];
r2 = [xi(:) - 20, yi(:) - 20, zi(:) - 60];
r1 = reshape(r1(:, 1).^2 + r1(:, 2).^2 + r1(:, 3).^2, size(xi));
r2 = reshape(r2(:, 1).^2 + r2(:, 2).^2 + r2(:, 3).^2, size(xi));

k = 10;

% generate Green's functions

g1 = exp(sqrt(-1) * k * r1) ./ (4 * pi * r1);
g2 = exp(sqrt(-1) * k * r2) ./ (4 * pi * r2);

% get Jacobian (sensitivity)
g12 = g1 .* g2;

% create a mesh based on the level-set at log(J)=-7.5

[node, elem, face] = v2m(log10(abs(g12)) + 10, 2.5, 2, 10, 'cgalsurf');

plotmesh(node, face);