Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
garyptchoi authored Apr 30, 2020
1 parent 4ddfdf8 commit e1fc8ca
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 46 deletions.
16 changes: 5 additions & 11 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ spherical_conformal_map: Conformally map a genus-0 closed triangle mesh to the u
This code computes spherical conformal (i.e. angle-preserving) maps of genus-0 closed triangle meshes using the linear method in [1], which has been applied for human brain mapping, texture mapping, surface registration, cardiac mapping and so on.
Any comments and suggestions are welcome.

If you use this code in your own work, please cite the following paper:
If you use this code in your own work, please cite the following papers:
[1] P. T. Choi, K. C. Lam, and L. M. Lui,
"FLASH: Fast Landmark Aligned Spherical Harmonic Parameterization for Genus-0 Closed Brain Surfaces."
SIAM Journal on Imaging Sciences, vol. 8, no. 1, pp. 67-94, 2015.

If the area correction code (mobius_area_correction_spherical) is also used, please cite [1] as well as the following paper:
(For mobius_area_correction_spherical)
[2] G. P. T. Choi, Y. Leung-Liu, X. Gu, and L. M. Lui,
"Parallelizable global conformal parameterization of simply-connected surfaces via partial welding."
SIAM Journal on Imaging Sciences, 2020.

Copyright (c) 2013-2020, Gary Pui-Tung Choi
https://scholar.harvard.edu/choi

===============================================================
===============================================================
Usage (see demo.m):
map = spherical_conformal_map(v,f)

Input:
v: nv x 3 vertex coordinates of a genus-0 triangle mesh
f: nf x 3 triangulations of a genus-0 triangle mesh
Expand All @@ -28,13 +28,7 @@ Output:
map: nv x 3 vertex coordinates of the spherical conformal map

===============================================================
Some possible extensions are also provided (see demo_extension.m):
- spherical_area_preserving_map:
We replace the cotangent Laplacian in our proposed method by the locally authalic Laplacian. Note that this approach aims to reduce the local area distortion, while the global area distortion is not necessarily minimized.

- iterative_spherical_area_preserving_map:
We use the above modified method to obtain an initial spherical map, and then solve an energy minimization problem to obtain a more area-preserving map. Again, note that the energy only focuses on minimizing the local area distortion, while the global area distortion is not necessarily minimized.

An extension is also provided (see demo_extension.m):
- mobius_area_correction_spherical:
We further reduce the global area distortion of a spherical conformal parameterization while maintaining the conformality, using the Mobius area correction method in [2].
[2] G. P. T. Choi, Y. Leung-Liu, X. Gu, and L. M. Lui,
Expand Down
2 changes: 1 addition & 1 deletion demo.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
%
% Remark:
% See demo_extension.m to understand how the method can be extended for
% achieving other effects, e.g. spherical area-preserving map
% further reducing the area distortion
%
% If you use this code in your own work, please cite the following paper:
% [1] P. T. Choi, K. C. Lam, and L. M. Lui,
Expand Down
86 changes: 52 additions & 34 deletions demo_extension.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
% Demo of extending our proposed spherical mapping algorithms for
% minimizing other distortions, such as local area distortion
%
% In case you want to focus on spherical conformal map, read demo.m instead
% Demo of extending our proposed spherical conformal mapping algorithm [1]
% for further reducing the area distortion via a Mobius transformation [2]
% while preserving the conformality
%
% If you use this code in your own work, please cite the following papers:
% (For spherical_conformal_map.m)
% [1] P. T. Choi, K. C. Lam, and L. M. Lui,
% "FLASH: Fast Landmark Aligned Spherical Harmonic Parameterization for Genus-0 Closed Brain Surfaces."
% SIAM Journal on Imaging Sciences, vol. 8, no. 1, pp. 67-94, 2015.
%
% (For mobius_area_correction_spherical)
% (For mobius_area_correction_spherical.m)
% [2] G. P. T. Choi, Y. Leung-Liu, X. Gu, and L. M. Lui,
% "Parallelizable global conformal parameterization of simply-connected surfaces via partial welding."
% SIAM Journal on Imaging Sciences, 2020.
Expand All @@ -17,30 +17,31 @@
% https://scholar.harvard.edu/choi

addpath('mfile')
addpath('extension') % contain the codes for area-preserving map
addpath('extension') % contain the codes for the area correction

%% Example 1: David
load('david.mat')
plot_mesh(v,f); view([-130 0])

%% our linear method for spherical conformal map
%% our linear method for spherical conformal map ([1])
map = spherical_conformal_map(v,f);
plot_mesh(map,f); title('Spherical conformal map')

%% Extension 1: a simple variation of our linear method for a more area-preserving map
map = spherical_area_preserving_map(v,f);
plot_mesh(map,f); title('Spherical area-preserving map')
% evaluate the angle and area distortion
d = angle_distortion(v,f,map);
a = area_distortion(v,f,map);

%% Extension 2: an iterative scheme for further reducing the area distortion
map = iterative_spherical_area_preserving_map(v,f);
plot_mesh(map,f); title('Iterative spherical area-preserving map')
fprintf('Mean(angle distortion) = %.4f\n',mean(abs(d)));
fprintf('SD(angle distortion) = %.4f\n',std(abs(d)));
fprintf('Mean(area distortion) = %.4f\n',mean(abs(a)));
fprintf('SD(area distortion) = %.4f\n',std(abs(a)));

%% Extension 3: our linear method for spherical conformal map together with a Mobius area correction (Choi et al., SIAM J. Imaging Sci. 2020)
%% Extension: our linear method for spherical conformal map together with a Mobius area correction step ([1] + [2])
map = spherical_conformal_map(v,f);
map = mobius_area_correction_spherical(v,f,map);
plot_mesh(map,f); title('Spherical conformal map with Mobius area correction')

%% evaluate the angle distortion (please run any of the above methods and then run this part for the evaluation)
% evaluate the angle and area distortion
d = angle_distortion(v,f,map);
a = area_distortion(v,f,map);

Expand All @@ -50,49 +51,66 @@
fprintf('SD(area distortion) = %.4f\n',std(abs(a)));




%% Example 2: Lion
load('lion.mat')
plot_mesh(v,f,mean_curv);

%% our linear method for spherical conformal map
%% our linear method for spherical conformal map ([1])
map = spherical_conformal_map(v,f);
plot_mesh(map,f,mean_curv); view([-70 0]); title('Spherical conformal map')

%% Extension 1: a simple variation of our linear method for a more area-preserving map
map = spherical_area_preserving_map(v,f);
plot_mesh(map,f,mean_curv); view([-70 0]); title('Spherical area-preserving map')
% evaluate the angle and area distortion
d = angle_distortion(v,f,map);
a = area_distortion(v,f,map);

%% Extension 2: an iterative scheme for further reducing the area distortion
map = iterative_spherical_area_preserving_map(v,f);
plot_mesh(map,f,mean_curv); view([-70 0]); title('Iterative spherical area-preserving map')
fprintf('Mean(angle distortion) = %.4f\n',mean(abs(d)));
fprintf('SD(angle distortion) = %.4f\n',std(abs(d)));
fprintf('Mean(area distortion) = %.4f\n',mean(abs(a)));
fprintf('SD(area distortion) = %.4f\n',std(abs(a)));

%% Extension 3: our linear method for spherical conformal map together with a Mobius area correction
%% Extension: our linear method for spherical conformal map together with a Mobius area correction step ([1] + [2])
map = spherical_conformal_map(v,f);
map = mobius_area_correction_spherical(v,f,map);
plot_mesh(map,f,mean_curv); view([-70 0]); title('Spherical conformal map with Mobius area correction')

% evaluate the angle and area distortion
d = angle_distortion(v,f,map);
a = area_distortion(v,f,map);

fprintf('Mean(angle distortion) = %.4f\n',mean(abs(d)));
fprintf('SD(angle distortion) = %.4f\n',std(abs(d)));
fprintf('Mean(area distortion) = %.4f\n',mean(abs(a)));
fprintf('SD(area distortion) = %.4f\n',std(abs(a)));


%% Example 3: Brain
load('brain.mat')
plot_mesh(v,f,mean_curv); view([90 0]);

%% our linear method for spherical conformal map
%% our linear method for spherical conformal map ([1])
map = spherical_conformal_map(v,f);
plot_mesh(map,f,mean_curv); view([-30 0]); title('Spherical conformal map')

%% Extension 1: a simple variation of our linear method for a more area-preserving map
map = spherical_area_preserving_map(v,f);
plot_mesh(map,f,mean_curv); view([-30 0]); title('Spherical area-preserving map')
% evaluate the angle and area distortion
d = angle_distortion(v,f,map);
a = area_distortion(v,f,map);

fprintf('Mean(angle distortion) = %.4f\n',mean(abs(d)));
fprintf('SD(angle distortion) = %.4f\n',std(abs(d)));
fprintf('Mean(area distortion) = %.4f\n',mean(abs(a)));
fprintf('SD(area distortion) = %.4f\n',std(abs(a)));

%% Extension 2: an iterative scheme for further reducing the area distortion
map = iterative_spherical_area_preserving_map(v,f);
plot_mesh(map,f,mean_curv); view([-30 0]); title('Iterative spherical area-preserving map')

%% Extension 3: our linear method for spherical conformal map together with a Mobius area correction
%% Extension: our linear method for spherical conformal map together with a Mobius area correction step ([1]+[2])
map = spherical_conformal_map(v,f);
map = mobius_area_correction_spherical(v,f,map);
plot_mesh(map,f,mean_curv); view([-30 0]); title('Spherical conformal map with Mobius area correction')
plot_mesh(map,f,mean_curv); view([-30 0]); title('Spherical conformal map with Mobius area correction')

% evaluate the angle and area distortion
d = angle_distortion(v,f,map);
a = area_distortion(v,f,map);

fprintf('Mean(angle distortion) = %.4f\n',mean(abs(d)));
fprintf('SD(angle distortion) = %.4f\n',std(abs(d)));
fprintf('Mean(area distortion) = %.4f\n',mean(abs(a)));
fprintf('SD(area distortion) = %.4f\n',std(abs(a)));

0 comments on commit e1fc8ca

Please sign in to comment.