Metadata-Version: 2.4
Name: hermes-drh
Version: 0.1.0
Summary: HERMES: patient-specific 3D FDTD DRH simulation (MRI voxels, SAR, thermal, antenna optimization)
Author: HERMES DRH Team
License: MIT
Project-URL: Homepage, https://github.com/hermes-drh/hermes-drh
Project-URL: Documentation, https://github.com/hermes-drh/hermes-drh#readme
Project-URL: Repository, https://github.com/hermes-drh/hermes-drh
Keywords: fdtd,hyperthermia,sar,mri,brain,simulation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: <3.14,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<3,>=1.26
Requires-Dist: scipy>=1.11
Requires-Dist: numba>=0.59
Requires-Dist: nibabel>=5.2
Requires-Dist: matplotlib>=3.8
Requires-Dist: PyYAML>=6.0
Requires-Dist: tqdm>=4.66
Provides-Extra: segmentation
Requires-Dist: torch<2.11,>=2.2; extra == "segmentation"
Requires-Dist: monai>=1.3; extra == "segmentation"
Provides-Extra: dashboard
Requires-Dist: streamlit>=1.30; extra == "dashboard"
Provides-Extra: all
Requires-Dist: torch<2.11,>=2.2; extra == "all"
Requires-Dist: monai>=1.3; extra == "all"
Requires-Dist: streamlit>=1.30; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-cov>=4; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: black>=24; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Dynamic: license-file

# hermes-drh

**HERMES** (Hyperthermia Electromagnetic and Robust Modeling Evaluation Suite) is a Python framework for patient-specific deep regional hyperthermia (DRH) research: MRI-derived voxel models, 3D FDTD electromagnetic simulation, SAR and simplified thermal post-processing, optional four-quadrant antenna optimization, and visualization.

All CLI paths below assume your **current working directory is `CODE/`**, so relative paths like `dataset/validation_data/001` resolve to `CODE/dataset/validation_data/001`.

## Development environment (`CODE/.venv`)

Create an isolated venv **inside `CODE/`** (keeps thesis `dataset/` and `best_model.pth` reachable via relative paths):

```bash
cd path/to/thesis/CODE

# One-shot bootstrap (editable install, default extras: all)
bash scripts/bootstrap_venv.sh

source .venv/bin/activate
hermes-simulate --help
```

Manual equivalent:

```bash
cd path/to/thesis/CODE
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip wheel
pip install -e ".[all]"    # or [dev], [segmentation], [segmentation,dashboard]
```

Checkpoint and validation data (from `CODE/`):

```bash
export HERMES_CHECKPOINT="$PWD/best_model.pth"

hermes-simulate --modalities-dir dataset/validation_data/001 \
  --max-dim 80 --time-steps 200 --skip-animations \
  --results-dir results/smoke_001
```

If BraTS folders live next to `CODE/` (thesis root) instead of under `CODE/dataset/`:

```bash
hermes-simulate --modalities-dir ../dataset/validation_data/001 \
  --max-dim 80 --time-steps 200 --skip-animations \
  --results-dir results/smoke_001
```

## TestPyPI smoke test (clean install in `CODE/.venv`)

Verifies the published wheel while still using local `dataset/` (run every command from `CODE/`):

```bash
cd path/to/thesis/CODE
rm -rf .venv && python3 -m venv .venv && source .venv/bin/activate
pip install -U pip

pip install -i https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  "hermes-drh[segmentation]==0.1.0"

export HERMES_CHECKPOINT="$PWD/best_model.pth"

hermes-simulate --modalities-dir dataset/validation_data/001 \
  --max-dim 80 --time-steps 200 --skip-animations \
  --results-dir results/testpypi_smoke
```

Production PyPI (after release):

```bash
pip install "hermes-drh[segmentation]==0.1.0"
```

## Install extras

| Command | Use case |
|---------|----------|
| `pip install -e .` | FDTD from existing segmentation NIfTI only |
| `pip install -e ".[segmentation]"` | `--modalities-dir` / `--modalities` (PyTorch + MONAI) |
| `pip install -e ".[dashboard]"` | Streamlit dashboard |
| `pip install -e ".[all]"` | Segmentation + dashboard |
| `pip install -e ".[dev]"` | Contributors (pytest, build, twine, ruff) |

Requires **Python 3.11–3.13**. For MP4 animations, install **ffmpeg** on your system.

## Quickstart (from `CODE/`)

```bash
source .venv/bin/activate   # after bootstrap above

# Existing segmentation NIfTI (no PyTorch)
hermes-simulate --seg path/to/labels.nii.gz --results-dir results/from_seg

# BraTS-style folder under CODE/dataset/
export HERMES_CHECKPOINT="$PWD/best_model.pth"
hermes-simulate --modalities-dir dataset/validation_data/001 --results-dir results/from_modalities

# Bundled example YAML
hermes-simulate --config configs/simulation_example.yaml \
  --modalities-dir dataset/validation_data/001 \
  --results-dir results/example_yaml

# MP4s from streamed frames
hermes-build-animations results/from_modalities --subsample 5 --skip-3d
```

## Dashboard

```bash
source .venv/bin/activate
pip install -e ".[dashboard]"   # or ".[all]"
hermes-dashboard
```

Run from `CODE/` so the dashboard finds `results/` and can launch `hermes-simulate`.

## Thesis paper bundle (not on PyPI)

From `CODE/` (uses local `hermes-simulate` when the venv is active):

```bash
python run_paper_bundle.py --modalities-dir dataset/validation_data/001 --bundle-root results
```

## License

MIT — see [LICENSE](LICENSE).
