Repository navigation
Add a spectral map onto the sphere - #129
Merged
Merged
Conversation
…n the same eigensolve
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #129 +/- ##
==========================================
+ Coverage 67.10% 69.20% +2.09%
==========================================
Files 19 19
Lines 3590 3588 -2
Branches 464 468 +4
==========================================
+ Hits 2409 2483 +74
+ Misses 998 907 -91
- Partials 183 198 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The unconditional six-eigenpair request fails on valid closed meshes with four to six vertices.
1 open issue
What changed in this PR
Adds an orientation-independent spectral sphere map and shares its eigensolve with tria_spherical_project, extending the performance improvements from #128.
Changes:
- Adds
spherical_spectral_mapandflipped_trianglesfor mapping surfaces and detecting folds. - Uses six reproducible eigenpairs with configurable tolerance and solver backend while preserving brain-axis alignment and projection checks.
- Adds tests for repeated eigenvalues, rigid-motion invariance, fold detection, and axis alignment.
| File | Description |
|---|---|
lapy/utils/tests/test_spherical_map.py |
Adds regression tests for spectral maps and spherical projection. |
lapy/diffgeo.py |
Adds mapping helpers and shares the configurable eigensolve between sphere maps. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds a general spectral map onto the sphere, and builds
tria_spherical_projecton the same eigensolve. This is the follow-up to #128 that brings the looser eigensolver tolerance to the sphere maps.Changes
spherical_spectral_map(tria, flow_iter=3, tol=1e-6, use_cholmod=False)inlapy.diffgeo: the first three non-constant eigenfunctions, scaled to [-1, 1], a few steps of mean curvature flow and a radial projection onto the unit sphere. Unliketria_spherical_project, it assumes no orientation of the surface in space and does not reject maps that fold, so it can be used to find where a surface folds. The result is mirrored if needed so that most triangles keep their orientation.flipped_triangles(sphere, t): the triangles of a map onto a sphere that face its centre, i.e. where the map folds over.tria_spherical_projectkeeps its alignment to brain axes, its scale and its checks, and gainstol(default1e-6) anduse_cholmod. It counts flipped area withflipped_triangles.tria_spherical_projectstarted from a random vector. Meshes with at most 6 vertices, where the sparse solver cannot return that many eigenpairs, are solved densely; before, a tetrahedron failed in the eigensolver.Effect on
tria_spherical_projectOn four cortical surfaces (
smoothwm.nofixof FastSurfer's 1.0 mm and 0.8 mm test cases, both hemispheres), the flipped area is the same as with LaPy 1.7.0 to three digits, all four pass the checks, and vertices move by at most 0.02 degrees (median 0). With the faster flow from #128, the projection takes 3.4 to 5.2 s instead of 5.2 to 8.0 s.Tests
New
test_spherical_map.py:tria_spherical_projectmaps the extreme points of an ellipsoid in each direction near the matching poles. The test fails if one axis comes out with the wrong sign.The suite passes with the current and the minimum dependency versions, and the docs build with
-W.