Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "brats-tumor-segmentation-pipeline"
on:
push:
branches: [main]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Setup python 3.11 environment"
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: "Install python libraries"
run: |
pip install -r requirements.txt
pip install -e .
- name: "Run ruff linting"
run: ruff check src/
- name: "Run pytest"
run: pytest tests/ -v

2 changes: 1 addition & 1 deletion src/preprocessing/create_splits.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create_splits(data_dir: Path, output_dir: Path):
for case in case_names:
seg = nib.load(data_dir / case / f"{case}-seg.nii.gz").get_fdata()
labels = np.unique(seg)
tumor_labels = [str(l) for l in [1, 2, 3] if l in labels]
tumor_labels = [str(label_id) for label_id in [1, 2, 3] if label_id in labels]
strat_labels.append("_".join(tumor_labels))

label_counts = Counter(strat_labels)
Expand Down
2 changes: 1 addition & 1 deletion src/training/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def main():
"epoch": epoch + 1,
"best_val_loss": best_val_loss,
"scheduler": scheduler.state_dict()
}, CHECKPOINT_DIR / f"best_model.pth")
}, CHECKPOINT_DIR / "best_model.pth")
else:
epochs_no_improvement += 1

Expand Down
1 change: 1 addition & 0 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from src.training.dataset import BraTSDataset

@pytest.mark.skipif(not Path("data/processed").exists(), reason="No data available")
def test_dataset_output():
PROJECT_ROOT = Path(__file__).resolve().parents[1]
DATA_DIR = PROJECT_ROOT / "data" / "processed"
Expand Down
Loading