-
Notifications
You must be signed in to change notification settings - Fork 0
/
lb_smooth.m
78 lines (68 loc) · 2.38 KB
/
lb_smooth.m
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
function output=lb_smooth(input,surf,sigma, k, V, D)
%output=lb_smooth(input,surf,sigma, k, V, D)
%
% The function performs heat kernel smoothing using the eigenfunctions
% of the Laplace-Beltrami operator on a triangle mesh.
%
% input : Signal to smooth.
% surf : Structured array consisting of surf.vertices and surf.faces.
% The default MATLAB data strcture for isosurface algorithm
% is needed
% sigma : bandwidth. The bandwidth corresponds to diffuion time in a heat equation [3].
% k : number of basis used
% V : eigenfunctions of the Laplace-Beltrami operator
% D : diag(D) gives the eigenvalues of the Laplece-Beltrami
% operator in increasing order.
%
%
% The code was downloaed from http://brainimaging.waisman.wisc.edu/~chung/lb
%
%
% (C) Moo K. Chung, Seongho Seo
%
% email://mkchung@wisc.edu
%
% Department of Biostatisics and Medical Informatics
% University of Wisconsin, Madison
%
% Department of Brain and Cognitive Sciences
% Seoul National University
%
%
% If you use this code, please reference [3]. The details on
% the mathematical basis of of the algorithm can be found in these papers.
%
% [1] Chung, M.K. 2001. Statistical Morphometry in Neuroanatomy,
% PhD Thesis, McGill University.
% http://www.stat.wisc.edu/~mchung/papers/thesis.pdf
%
% [2] Chung, M.K., Taylor, J. 2004. Diffusion Smoothing on Brain Surface via Finite
% Element Method, IEEE International Symposium on Biomedical Imaging (ISBI). 562.
% http://www.stat.wisc.edu/~mchung/papers/BMI2004/diffusion_biomed04.pdf
%
% [3] Seo, S., Chung, M.K., Vorperian, H. K. Heat kernel smoothing of anatomical
% manifolds via Laplace-Beltrami eigenfunctions. submitted.
%
% Update history: April 23, 2010.
% At this momement it smooth out surface and input is simply [].
if isempty(input)
p=surf.vertices;
else
p=input;
end;
Psi=V(:,1:k); %p = Psi * beta
eigen=diag(D);
W= exp(-1*eigen(1:k)*sigma);
%W= repmat(W', size(Psi,1), 1);
W= repmat(W', size(Psi,1), 1);
% We will also assume sigma=0, in which case we have eigenfunction
% expansion.
beta= inv(Psi'*Psi)*Psi'*p;
phat=(W.*Psi)*beta;
if isempty(input)
output.vertices=phat;
output.faces = surf.faces;
else
output=phat;
end;
%figure;figure_patch(surfhat1,[0.74 0.71 0.61],0.5)