Skip to content

Conversation

@zasexton
Copy link
Contributor

@zasexton zasexton commented Oct 8, 2025

Current situation

This PR addresses critical usability issues in GUI workflow and
mesh processing:

  1. GUI unable to load .dmn files that were saved without boundary
    data
  2. Face extraction incorrectly classifying cylindrical lumen
    surfaces as walls or merging them with caps

These improvements enable proper handling of vessel network
geometries and seamless GUI operation with persisted domain
files.

Breaking Changes

  • extract_faces() return signature updated: Now returns (faces,
    wall_surfaces, cap_surfaces, lumen_surfaces, shared_boundaries)
    with lumens as a separate list (previously returned 4 values, now
    returns 5)

New Features

  • Lumen surface classification: Automatically detects and exports
    cylindrical lumen surfaces separately from caps and walls
    • Uses boundary crease detection to identify surfaces with
      sharp separation from surroundings
    • Multi-criteria geometric analysis (circularity, separation,
      planarity, aspect ratio)
    • Supports multi-outlet lumens with 3+ boundary loops
  • Improved boundary overlap detection: Caps with boundaries that
    share edges/vertices with other boundaries are now correctly
    reclassified as walls

Bug Fixes

  • Fixed .dmn loading in GUI: Domains saved without boundary data
    now load correctly
    • Auto-rebuilds boundaries when missing from saved file
    • Creates kernel on-demand in Patch.build() to prevent
      AttributeError
  • Improved normal computation: Switched to PyVista's
    auto-orientation with non-manifold traversal for better handling
    of surfaces with interior holes

Enhancements

  • Graph-based wall combination: More robust merging of wall
    surfaces using connected component analysis

Migration Guide

If your code uses extract_faces(), update to handle the new
return signature:

Before:

faces, walls, caps, shared_boundaries = extract_faces(surface,
mesh)

After:

faces, walls, caps, lumens, shared_boundaries =
extract_faces(surface, mesh)

Documentation

  • Inline docstrings explain boundary crease detection algorithm
  • Comments document circularity metrics and overlap checking
    logic
  • Function documentation updated for new classification
    hierarchy:
    • Caps: Single boundary loop, no overlap with other boundaries
    • Lumens: 2+ boundary loops with boundary creases
      (perpendicular normals)
    • Walls: All other surfaces (no boundary creases or overlapping
      boundaries)

Testing

  • Tested on cube_with_holes.vtu example mesh with cylindrical
    holes
  • Verified lumen classification correctly identifies 2
    cylindrical surfaces separate from 4 endcaps
  • Confirmed caps are reclassified as walls when boundaries
    overlap with lumens
  • Tested .dmn loading in GUI with and without saved boundary data
  • Verified boundary reconstruction works correctly for loaded
    patches

Files Modified:

  • svv/simulation/utils/extract_faces.py: +514/-84 lines (lumen
    detection, boundary overlap checks, graph-based wall merging)
  • svv/domain/patch.py: +8 lines (on-demand kernel creation)
  • svv/visualize/gui/main_window.py: +6 lines (auto-rebuild
    boundaries)

Code of Conduct & Contributing Guidelines

…elpers

- Integrate UnitSystem into TreeParameters with default CGS and mmHg
- Convert viscosity, density, pressure, and flow to active unit system
- Support set(..., unit=...) to accept alternate units
- Add set_unit_system(convert_existing=...) to switch systems safely
- Improve __str__ to include unit symbols and cleaner formatting
…ow injecting an existing parameters instance\n- Add optional unit_system for default parameters\n- Wire __init__ to set or convert unit system
…ella VTK import to avoid optional IO deps (e.g., NetCDF) at import time
- Create kernel on-demand in Patch.build() when loading from .dmn
- Auto-rebuild domain boundary in GUI when not included in .dmn file
- Resolves AttributeError when accessing kernel.d on loaded patches
…tection

This commit enhances the extract_faces function with multi-criteria surface
classification to accurately distinguish between caps, lumens, and walls.

Major changes:

1. Lumen Detection
   - Added new 'lumen' surface category exported separately from caps
   - Lumens are surfaces with 2+ boundary loops that exhibit boundary creases
   - Boundary crease detection checks if face normals are perpendicular to
     boundary loop plane normals (indicating clean separation from surroundings)
   - Multi-criteria verification using circularity, separation, planarity, and
     aspect ratio for 2-loop surfaces
   - Support for multi-outlet lumens (3+ boundary loops with creases)

2. Boundary Overlap Classification
   - Caps with boundary loops that share edges/vertices with other boundaries
     are now reclassified as walls
   - This correctly handles cases where flat endcaps connect to cylindrical
     lumens via shared circular edges

3. Improved Normal Computation
   - Switched to PyVista's auto-orientation with non-manifold traversal
   - Correctly handles both outer surfaces and interior holes
   - Removed manual normal correction that was causing issues

4. Graph-Based Wall Combination
   - Replaced linear wall merging with graph-based connected components
   - More robust handling of complex wall topologies
   - Caps and lumens are never merged with walls or each other

Return value updated: now returns (faces, wall_surfaces, cap_surfaces,
lumen_surfaces, shared_boundaries) with lumens as a separate list.

Classification hierarchy:
- Caps: Single boundary loop, no overlap with other boundaries
- Lumens: 2+ boundary loops with boundary creases (perpendicular normals)
- Walls: All other surfaces (no boundary creases or overlapping boundaries)
@zasexton zasexton self-assigned this Oct 8, 2025
@zasexton zasexton merged commit 6954157 into SimVascular:main Oct 8, 2025
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.

1 participant