Skip to content

Handle crossing level sets#102

Merged
m-reuter merged 32 commits intomainfrom
tria-updates
Mar 10, 2026
Merged

Handle crossing level sets#102
m-reuter merged 32 commits intomainfrom
tria-updates

Conversation

@m-reuter
Copy link
Member

@m-reuter m-reuter commented Jan 21, 2026

  • new function to compute critical points (minima, maxima and saddles)
  • more flexible polgyon now has auto-detect for closed loop inputs in cases where first and last point are the same
  • improved extraction of multiple level set components (closed and regular paths)
  • added functionality to extract level sets also when they hit a vertex (e.g. at saddle points)
  • added gifti IO support via nibabel

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 61.08374% with 158 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.96%. Comparing base (c657092) to head (4c450ee).
⚠️ Report is 33 commits behind head on main.

Files with missing lines Patch % Lines
lapy/tria_mesh.py 62.30% 96 Missing and 25 partials ⚠️
lapy/_tria_io.py 55.10% 20 Missing and 2 partials ⚠️
lapy/plot.py 0.00% 6 Missing ⚠️
lapy/polygon.py 70.00% 4 Missing and 2 partials ⚠️
lapy/conformal.py 0.00% 1 Missing ⚠️
lapy/shapedna.py 66.66% 1 Missing ⚠️
lapy/solver.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   48.12%   49.96%   +1.84%     
==========================================
  Files          15       15              
  Lines        2851     3144     +293     
  Branches      363      412      +49     
==========================================
+ Hits         1372     1571     +199     
- Misses       1357     1425      +68     
- Partials      122      148      +26     
Flag Coverage Δ
unittests 49.96% <61.08%> (+1.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces several enhancements to the LaPy mesh processing library, focusing on critical point detection, level set extraction, and polygon handling. The changes add new functionality for identifying topological features (minima, maxima, saddles) on triangle meshes and improve the handling of level set curves, particularly closed loops.

Changes:

  • Added critical_points() method to identify extrema and saddle points on mesh surfaces
  • Enhanced Polygon class with auto-detection of closed loops when first/last points are identical
  • Refactored __reduce_edges_to_path() to handle multiple disconnected components and closed loops
  • Added extract_level_paths() method to extract multiple level set components as Polygon objects with metadata
  • Updated level_path() to use extract_level_paths() internally for consistency

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
lapy/polygon.py Added optional closed parameter with auto-detection logic that removes duplicate endpoints
lapy/tria_mesh.py Added is_boundary(), critical_points(), and extract_level_paths() methods; refactored __reduce_edges_to_path() to handle multiple components and closed loops; updated level_path() implementation
lapy/utils/tests/test_tria_mesh.py Added comprehensive tests for critical_points, extract_level_paths, and level_path with various edge cases including closed loops and multiple components

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m-reuter m-reuter marked this pull request as draft January 26, 2026 18:24
@m-reuter m-reuter changed the title Tria updates Handle crossing level sets Mar 3, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m-reuter m-reuter marked this pull request as ready for review March 10, 2026 21:06
@m-reuter m-reuter merged commit 431dd33 into main Mar 10, 2026
27 checks passed
@m-reuter m-reuter deleted the tria-updates branch March 10, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants