VascuSim
A Python package for working with cardiovascular simulation datasets from the BioSiMMLab.
Overview
VascuSim provides tools for processing, streaming, and analyzing vascular simulation data stored in VTU/VTP format, with efficient conversion to PyTorch Geometric data formats for graph neural network training.
Key features:
- Loading and conversion of VTU/VTP files to PyTorch Geometric data format
- Streaming functionality for efficient access to large datasets
- Support for various data sources (local files, NAS, Hugging Face)
- Comprehensive geometric processing utilities
- Visualization tools for vascular structures
- Domain decomposition for distributed processing
📚 Documentation | 📦 PyPI Package | 🐛 Issue Tracker
Installation
Basic Installation
pip install vascusim
Development Installation
git clone https://github.com/BioSiMMLab/vascusim.git
cd vascusim
pip install -e ".[dev]"
Optional Dependencies
For SMB/CIFS support (for NAS streaming):
pip install "vascusim[smb]"
For documentation building:
pip install "vascusim[docs]"
Usage Examples
Loading Vascular Data
import torch
from vascusim.data.conversion import vtu_to_pyg
# Convert a VTU file to PyTorch Geometric format
data = vtu_to_pyg("path/to/simulation.vtu")
# Access node positions and connectivity
pos = data.pos
edge_index = data.edge_index
# Access node attributes
velocity = data.node_velocity # if available in the VTU file
pressure = data.node_pressure # if available in the VTU file
Using the Dataset API
from vascusim.data.dataset import VascuDataset
# Create a dataset from a local directory
dataset = VascuDataset(
source_url="path/to/data",
cache_dir="~/.vascusim/cache",
normalize=True
)
# Access an item
data = dataset[0]
# Use with PyTorch DataLoader
from torch_geometric.loader import DataLoader
loader = DataLoader(dataset, batch_size=4, shuffle=True)
Streaming from Remote Sources
from vascusim.data.dataset import StreamingVascuDataset
# Stream from Hugging Face dataset
hf_dataset = StreamingVascuDataset(
source_url="huggingface.co/datasets/biosimmlab/vascu-example",
streaming_type="hf",
prefetch=True
)
# Stream from NAS
nas_dataset = StreamingVascuDataset(
source_url="192.168.1.100",
streaming_type="nas",
username="user",
password="pass"
)
Visualization
import matplotlib.pyplot as plt
from vascusim.utils.visualization import plot_geometry, plot_flow
# Plot geometry
fig = plot_geometry(data, show_points=True)
plt.savefig("geometry.png")
# Visualize flow fields
plot_flow(data, flow_field="velocity", color_by_magnitude=True)
Processing Vascular Geometry
from vascusim.processing.geometry import compute_curvature, extract_centerline
# Compute curvature for each node
curvature = compute_curvature(data)
# Extract centerline
centerline = extract_centerline(data, smoothing=0.1)
# Apply transformations
from vascusim.data.transforms import Normalize, AddNoise
transform = Normalize()
normalized_data = transform(data)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Run the tests (
python run_test.py) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Citing
If you use VascuSim in your research, please cite:
@software{vascusim2025,
author = {Xu, Wenzhuo},
title = {VascuSim: Dataset package for cardiovascular simulations},
url = {https://github.com/biosimmlab/vascusim},
year = {2025}
}
Acknowledgements
This project is maintained by the BioSiMMLab.
Metadata
Release files for vascusim 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vascusim-0.2.0.tar.gz | 100.9 kB | Without provenance | Details for vascusim-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vascusim-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for vascusim-0.2.0-py3-none-any.whl |
Total release size: 172.2 kB
Release files / vascusim-0.2.0.tar.gz
| Download URL | vascusim-0.2.0.tar.gz |
|---|---|
| Size | 100.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aeef0eb85d0ddbd3e07931d6bf5b362e341e38428cbed2e6dec1205e7c21365c
|
|
BLAKE2b-256 checksum How to use checksums |
d911160313603d6ce49b63ac916db2c7c44858ba78770e394e488f317e541368
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / vascusim-0.2.0-py3-none-any.whl
| Download URL | vascusim-0.2.0-py3-none-any.whl |
|---|---|
| Size | 71.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fba2dcd081f8dec0dcd9b38808d2ef25ea2113538547b33d09f63de4d6d48f5b
|
|
BLAKE2b-256 checksum How to use checksums |
37b6b732be5e313968b9e8bf1257232275ae29714df1479158bc0667ac407c59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Security for vascusim 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.