stentfit 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stentfit-0.1.0/LICENSE +21 -0
- stentfit-0.1.0/PKG-INFO +82 -0
- stentfit-0.1.0/README.md +56 -0
- stentfit-0.1.0/pyproject.toml +43 -0
- stentfit-0.1.0/src/stentfit/__init__.py +67 -0
- stentfit-0.1.0/src/stentfit/artery_generate.py +613 -0
- stentfit-0.1.0/src/stentfit/artery_mesh.py +469 -0
- stentfit-0.1.0/src/stentfit/sim_setup.py +684 -0
- stentfit-0.1.0/src/stentfit/stent_pipeline.py +370 -0
- stentfit-0.1.0/src/stentfit/stent_plotting.py +1119 -0
- stentfit-0.1.0/src/stentfit/stent_rings.py +374 -0
- stentfit-0.1.0/src/stentfit/stent_sampling.py +343 -0
- stentfit-0.1.0/src/stentfit/stent_skeleton_2d.py +1389 -0
- stentfit-0.1.0/src/stentfit/stent_skeleton_3d.py +560 -0
- stentfit-0.1.0/src/stentfit/stent_splines.py +398 -0
stentfit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vural Aktas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
stentfit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stentfit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Semi-automated virtual stent implantation via contact simulation
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Vural Aktas
|
|
8
|
+
Author-email: vuralaktas6741@gmail.com
|
|
9
|
+
Requires-Python: >=3.13,<3.14
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: beamme (>=0.2.0,<0.3.0)
|
|
14
|
+
Requires-Dist: fourcipp (>=1.132.0)
|
|
15
|
+
Requires-Dist: gmsh (>=4.15.0)
|
|
16
|
+
Requires-Dist: matplotlib (>=3.11.0)
|
|
17
|
+
Requires-Dist: numpy (>=2.5.1)
|
|
18
|
+
Requires-Dist: pandas (>=3.0.3)
|
|
19
|
+
Requires-Dist: plotly (>=6.8.0)
|
|
20
|
+
Requires-Dist: scikit-image (>=0.26.0)
|
|
21
|
+
Requires-Dist: scikit-learn (>=1.9.0)
|
|
22
|
+
Requires-Dist: scipy (>=1.18.0)
|
|
23
|
+
Requires-Dist: trimesh (>=4.12.2)
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# stentFIT
|
|
27
|
+
|
|
28
|
+
[](https://stentfit.readthedocs.io/en/latest/?badge=latest)
|
|
29
|
+
|
|
30
|
+
Semi-automated virtual stent implantation with mixed-dimensional modelling
|
|
31
|
+
|
|
32
|
+
Full documentation, including the API reference and workflow diagrams, is hosted at [stentfit.readthedocs.io](https://stentfit.readthedocs.io/en/latest/).
|
|
33
|
+
|
|
34
|
+
`stentFIT` turns a stent surface mesh (`.stl`) into a 1D beam-element model ready for beam-to-solid contact simulation. It samples the stent surface, detects its rings, extracts a 2D skeleton per ring, wraps that skeleton back onto the 3D mid-surface, fits a B-spline to each strut curve, and meshes the result into Simo–Reissner beams with [BeamMe](https://beamme-py.github.io/beamme/). Extracting the stent's 1D wireframe is a semi-automated process: it allows manual edits of intermediate steps such as ring detection and 2D skeletonisation. It also provides a smoke test that verifies the quality of the 1D stent model inside a generated pipe-like 3D vessel.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install stentfit
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Requires **Python 3.13** (pinned to match [BeamMe](https://beamme-py.github.io/beamme/)'s supported range). Core dependencies such as `beamme` (stent beam meshing and artery solid meshing), `gmsh` (artery solid meshing), and `fourcipp` are installed automatically. Running the generated simulation input files additionally requires a compiled **4C** executable, which is not included in this package.
|
|
43
|
+
|
|
44
|
+
## What it does & How to use it
|
|
45
|
+
|
|
46
|
+
**1. Stent skeletonisation** ([`examples/stent_skeleton.ipynb`](examples/stent_skeleton.ipynb))
|
|
47
|
+
|
|
48
|
+
- Sample a point cloud from the stent STL and align it to its centreline axis.
|
|
49
|
+
- Detect rings and skeletonise each ring in 2D (optional auto-tuning + manual edits).
|
|
50
|
+
- Wrap the 2D skeleton onto the local mid-surface, clean up the graph, and fit a B-spline per strut.
|
|
51
|
+
- Mesh the fitted splines into a 1D Simo–Reissner beam mesh with BeamMe.
|
|
52
|
+
|
|
53
|
+
Each stage writes `skeleton_points.csv`, `skeleton_splines.json`, `stent_features.json`, and interactive HTML views into the output directory.
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
**2. Test artery generation & simulation setup** ([`examples/test_sim_generation.ipynb`](examples/test_sim_generation.ipynb))
|
|
58
|
+
|
|
59
|
+
A synthetic/parametric smoke test exercises the full mixed-dimensional chain end-to-end:
|
|
60
|
+
|
|
61
|
+
- Generate a parametric test artery (straight / curved / S-bend) sized to the stent, and mesh its wall as a 3D solid with GMSH.
|
|
62
|
+
- Warp the stent beam mesh onto the artery centreline.
|
|
63
|
+
- Check beam-to-solid coupling compatibility (stiffness ratio, element-size ratios) and visualize the stent inside the artery via Paraview.
|
|
64
|
+
- Tie the beam mesh to the artery lumen and write a schema-validated 4C simulation input file with a quasi-static radial expansion load.
|
|
65
|
+
|
|
66
|
+
This confirms the stent-to-artery mapping and 4C input generation work end-to-end, using placeholder materials and tied meshtying rather than real contact such as full deployment physics (contact, HGO-C artery material, elasto-plastic beam bending) is planned but not yet implemented.
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
`stentfit` was created by Vural Aktas. It is licensed under the terms of the MIT license.
|
|
73
|
+
|
|
74
|
+
## Contributing
|
|
75
|
+
|
|
76
|
+
Interested in contributing? Reach out at [vural.aktas@rwth-aachen.de](mailto:vural.aktas@rwth-aachen.de).
|
|
77
|
+
|
|
78
|
+
## Credits
|
|
79
|
+
|
|
80
|
+
`stentfit` was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/)
|
|
81
|
+
and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
|
|
82
|
+
|
stentfit-0.1.0/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# stentFIT
|
|
2
|
+
|
|
3
|
+
[](https://stentfit.readthedocs.io/en/latest/?badge=latest)
|
|
4
|
+
|
|
5
|
+
Semi-automated virtual stent implantation with mixed-dimensional modelling
|
|
6
|
+
|
|
7
|
+
Full documentation, including the API reference and workflow diagrams, is hosted at [stentfit.readthedocs.io](https://stentfit.readthedocs.io/en/latest/).
|
|
8
|
+
|
|
9
|
+
`stentFIT` turns a stent surface mesh (`.stl`) into a 1D beam-element model ready for beam-to-solid contact simulation. It samples the stent surface, detects its rings, extracts a 2D skeleton per ring, wraps that skeleton back onto the 3D mid-surface, fits a B-spline to each strut curve, and meshes the result into Simo–Reissner beams with [BeamMe](https://beamme-py.github.io/beamme/). Extracting the stent's 1D wireframe is a semi-automated process: it allows manual edits of intermediate steps such as ring detection and 2D skeletonisation. It also provides a smoke test that verifies the quality of the 1D stent model inside a generated pipe-like 3D vessel.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install stentfit
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires **Python 3.13** (pinned to match [BeamMe](https://beamme-py.github.io/beamme/)'s supported range). Core dependencies such as `beamme` (stent beam meshing and artery solid meshing), `gmsh` (artery solid meshing), and `fourcipp` are installed automatically. Running the generated simulation input files additionally requires a compiled **4C** executable, which is not included in this package.
|
|
18
|
+
|
|
19
|
+
## What it does & How to use it
|
|
20
|
+
|
|
21
|
+
**1. Stent skeletonisation** ([`examples/stent_skeleton.ipynb`](examples/stent_skeleton.ipynb))
|
|
22
|
+
|
|
23
|
+
- Sample a point cloud from the stent STL and align it to its centreline axis.
|
|
24
|
+
- Detect rings and skeletonise each ring in 2D (optional auto-tuning + manual edits).
|
|
25
|
+
- Wrap the 2D skeleton onto the local mid-surface, clean up the graph, and fit a B-spline per strut.
|
|
26
|
+
- Mesh the fitted splines into a 1D Simo–Reissner beam mesh with BeamMe.
|
|
27
|
+
|
|
28
|
+
Each stage writes `skeleton_points.csv`, `skeleton_splines.json`, `stent_features.json`, and interactive HTML views into the output directory.
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
**2. Test artery generation & simulation setup** ([`examples/test_sim_generation.ipynb`](examples/test_sim_generation.ipynb))
|
|
33
|
+
|
|
34
|
+
A synthetic/parametric smoke test exercises the full mixed-dimensional chain end-to-end:
|
|
35
|
+
|
|
36
|
+
- Generate a parametric test artery (straight / curved / S-bend) sized to the stent, and mesh its wall as a 3D solid with GMSH.
|
|
37
|
+
- Warp the stent beam mesh onto the artery centreline.
|
|
38
|
+
- Check beam-to-solid coupling compatibility (stiffness ratio, element-size ratios) and visualize the stent inside the artery via Paraview.
|
|
39
|
+
- Tie the beam mesh to the artery lumen and write a schema-validated 4C simulation input file with a quasi-static radial expansion load.
|
|
40
|
+
|
|
41
|
+
This confirms the stent-to-artery mapping and 4C input generation work end-to-end, using placeholder materials and tied meshtying rather than real contact such as full deployment physics (contact, HGO-C artery material, elasto-plastic beam bending) is planned but not yet implemented.
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
`stentfit` was created by Vural Aktas. It is licensed under the terms of the MIT license.
|
|
48
|
+
|
|
49
|
+
## Contributing
|
|
50
|
+
|
|
51
|
+
Interested in contributing? Reach out at [vural.aktas@rwth-aachen.de](mailto:vural.aktas@rwth-aachen.de).
|
|
52
|
+
|
|
53
|
+
## Credits
|
|
54
|
+
|
|
55
|
+
`stentfit` was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/)
|
|
56
|
+
and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["poetry-core>=2.0.0"]
|
|
3
|
+
build-backend = "poetry.core.masonry.api"
|
|
4
|
+
|
|
5
|
+
[tool.poetry]
|
|
6
|
+
name = "stentfit"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Semi-automated virtual stent implantation via contact simulation"
|
|
9
|
+
authors = ["Vural Aktas <vuralaktas6741@gmail.com>"]
|
|
10
|
+
license = "MIT"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
|
|
13
|
+
[tool.poetry.dependencies]
|
|
14
|
+
python = ">=3.13,<3.14" # capped to match BeamMe's supported Python range
|
|
15
|
+
numpy = ">=2.5.1"
|
|
16
|
+
scipy = ">=1.18.0"
|
|
17
|
+
pandas = ">=3.0.3"
|
|
18
|
+
matplotlib = ">=3.11.0"
|
|
19
|
+
plotly = ">=6.8.0"
|
|
20
|
+
trimesh = ">=4.12.2"
|
|
21
|
+
scikit-image = ">=0.26.0"
|
|
22
|
+
scikit-learn = ">=1.9.0"
|
|
23
|
+
beamme = ">=0.2.0,<0.3.0" # 0.3.0 renamed/changed Mesh.write_vtk -> write_vtu (single-file, no beam/solid split); pin until ported
|
|
24
|
+
gmsh = ">=4.15.0" # artery solid meshing (Mac-native; replaced Cubit/CubitPy)
|
|
25
|
+
# fourcipp parses & writes 4C input files (needed to import the GMSH solid mesh
|
|
26
|
+
# and dump the assembled .4C.yaml). Imported unconditionally by stent_splines.py
|
|
27
|
+
# (via beamme.four_c), so it must be a core dependency, not an optional group
|
|
28
|
+
# (Poetry's [dependency-groups] aren't installed by plain `pip install`).
|
|
29
|
+
fourcipp = ">=1.132.0"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
[dependency-groups]
|
|
33
|
+
dev = [
|
|
34
|
+
"ipykernel (>=7.3.0,<8.0.0)",
|
|
35
|
+
"ipython (>=9.15.0,<10.0.0)",
|
|
36
|
+
"jupyter (>=1.1.1,<2.0.0)"
|
|
37
|
+
]
|
|
38
|
+
docs = [
|
|
39
|
+
"myst-nb (>=1.4.0,<2.0.0)",
|
|
40
|
+
"sphinx-autoapi (>=3.8.0,<4.0.0)",
|
|
41
|
+
"sphinx-rtd-theme (>=3.1.0,<4.0.0)",
|
|
42
|
+
"sphinxcontrib-mermaid (>=2.1.0,<3.0.0)"
|
|
43
|
+
]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
from importlib.metadata import version
|
|
3
|
+
|
|
4
|
+
from .stent_sampling import sample_stent_points
|
|
5
|
+
from .stent_rings import detect_rings
|
|
6
|
+
from .stent_skeleton_2d import (skeletonize_rings_2d,
|
|
7
|
+
save_ring_2d_checkpoint,
|
|
8
|
+
load_ring_2d_checkpoint,
|
|
9
|
+
edit_rings_2d_interactive,
|
|
10
|
+
assemble_2d_skeleton)
|
|
11
|
+
from .stent_skeleton_3d import (wrap_skeleton_to_3d,
|
|
12
|
+
save_stent_features_and_views)
|
|
13
|
+
from .stent_splines import (fit_skeleton_splines,
|
|
14
|
+
mesh_skeleton_beams)
|
|
15
|
+
from .stent_plotting import (plot_skeleton_splines_2d,
|
|
16
|
+
plot_skeleton_splines_trimesh)
|
|
17
|
+
from .stent_pipeline import (stent_pipeline,
|
|
18
|
+
run_skeletonization_2d,
|
|
19
|
+
resume_and_edit_rings,
|
|
20
|
+
finalize_skeleton)
|
|
21
|
+
|
|
22
|
+
from .artery_mesh import (mesh_artery_gmsh,
|
|
23
|
+
import_artery_solid,
|
|
24
|
+
assemble_beam_solid)
|
|
25
|
+
from .artery_generate import generate_artery_for_stent
|
|
26
|
+
from .sim_setup import (stent_feature_extraction,
|
|
27
|
+
stent_meshing_alignment,
|
|
28
|
+
create_assembly_mesh,
|
|
29
|
+
paraview_mesh_files,
|
|
30
|
+
check_coupling_assumptions,
|
|
31
|
+
build_smoketest_input,
|
|
32
|
+
build_smoketest_pipeline)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
__version__ = version("stentfit")
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"sample_stent_points",
|
|
40
|
+
"detect_rings",
|
|
41
|
+
"skeletonize_rings_2d",
|
|
42
|
+
"save_ring_2d_checkpoint",
|
|
43
|
+
"load_ring_2d_checkpoint",
|
|
44
|
+
"edit_rings_2d_interactive",
|
|
45
|
+
"assemble_2d_skeleton",
|
|
46
|
+
"wrap_skeleton_to_3d",
|
|
47
|
+
"save_stent_features_and_views",
|
|
48
|
+
"fit_skeleton_splines",
|
|
49
|
+
"mesh_skeleton_beams",
|
|
50
|
+
"plot_skeleton_splines_2d",
|
|
51
|
+
"plot_skeleton_splines_trimesh",
|
|
52
|
+
"stent_pipeline",
|
|
53
|
+
"run_skeletonization_2d",
|
|
54
|
+
"resume_and_edit_rings",
|
|
55
|
+
"finalize_skeleton",
|
|
56
|
+
"mesh_artery_gmsh",
|
|
57
|
+
"import_artery_solid",
|
|
58
|
+
"assemble_beam_solid",
|
|
59
|
+
"generate_artery_for_stent",
|
|
60
|
+
"stent_feature_extraction",
|
|
61
|
+
"stent_meshing_alignment",
|
|
62
|
+
"create_assembly_mesh",
|
|
63
|
+
"paraview_mesh_files",
|
|
64
|
+
"check_coupling_assumptions",
|
|
65
|
+
"build_smoketest_input",
|
|
66
|
+
"build_smoketest_pipeline",
|
|
67
|
+
]
|