Skip to content

Commit 3651e8f

Browse files
docs and recon container
1 parent 49638f5 commit 3651e8f

7 files changed

Lines changed: 47 additions & 56 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ docker run --rm \
154154
ghcr.io/bic-mac-challenge/recon:latest
155155
```
156156

157-
The reconstructed PET is written to `/data/output/pet.nii.
157+
The reconstructed PET is written to `/data/output/pet.nii.gz`.
158+
159+
> [!WARNING]
160+
> Running reconstruction requires **~20 GB of RAM** and takes **20–120 minutes** depending on CPU speed. The `intermediates/` folder uses **~50 GB** of additional disk space — consider deleting it after a successful reconstruction.
158161
159162
---
160163

docs/docker-packaging.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Your container is run once per subject with two volume mounts:
44

55
```bash
6-
docker run --rm \
6+
timeout 300 docker run --rm \
77
--memory 128g \
88
--network none \
99
--gpus all \
@@ -31,9 +31,8 @@ Your container must write the predicted CT to **`/data/output/ct.nii.gz`** — a
3131

3232
## Baseline as a Starting Point
3333

34-
The baseline Dockerfile lives at `src/baseline/v2/inference/docker/Dockerfile`. It uses a PyTorch base image, installs dependencies from `requirements.txt`, copies code and weights, and sets the inference script as the entrypoint. Use it as a template.
34+
The baseline Dockerfile lives at `src/baseline/Dockerfile`. It uses a PyTorch base image, installs dependencies from `requirements.txt`, copies code and weights, and sets the inference script as the entrypoint. You can use it as a template.
3535

36-
The key adaptation for any submission is reading inputs from `/data/features/` and writing output to `/data/output/`:
3736

3837
```python
3938
FEATURES_DIR = Path("/data/features")
@@ -49,24 +48,14 @@ nib.save(nib.Nifti1Image(pred_hu, ref.affine, ref.header), str(OUTPUT_DIR / "ct.
4948

5049
---
5150

52-
## Submitting
53-
54-
Save your image and email it (or a download link) to **bic-mac-challenge@github.io**:
55-
56-
```bash
57-
docker save my-model:latest | gzip > my-model.tar.gz
58-
```
51+
## Validating Before Submission
5952

60-
Subject line: `[DRY-RUN] <TeamName>` or `[FINAL] <TeamName>`
61-
62-
See [submission-guide.md](submission-guide.md) for phase details.
53+
Before sending us your image, run it on the 4 validation subjects and upload the predictions to Codabench to confirm your container works end-to-end and your scores look reasonable. We cannot debug containers that fail silently on our infrastructure, so this step is required.
6354

6455
---
6556

66-
## Common Pitfalls
67-
68-
**Hardcoded paths** — make sure your container reads from `/data/features/`, not from training-time paths.
57+
## Submitting
6958

70-
**Affine mismatch** — always copy the header from `features/nacpet.nii.gz` when saving output; don't derive it from an intermediate resampled volume.
59+
See [submission-guide.md](submission-guide.md) for full submission instructions, including how to share your image via Docker Hub or a compressed archive.
7160

72-
**Network downloads at runtime**`torch.hub`, `huggingface_hub`, etc. will fail. Bake weights in during `docker build`.
61+
---

docs/reconstruction.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Intermediate outputs (μ-map, ACF sinogram, STIR-format files) are written to `o
2323

2424
---
2525

26+
> [!WARNING]
27+
> Running reconstruction requires **~20 GB of RAM** and takes **20–120 minutes** depending on CPU speed. The `intermediates/` folder uses **~50 GB** of additional disk space — consider deleting it after a successful reconstruction.
28+
2629
## Running the Pipeline
2730

2831
### Option 1: Docker (recommended)

docs/submission-guide.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ If you only submit `ct.nii.gz`, you will receive CT metrics only. Submitting bot
3333

3434
- NIfTI format (`.nii.gz`)
3535
- Same shape and affine as `features/nacpet.nii.gz`
36-
- CT values in Hounsfield units (valid range approximately −1000 to +3000 HU)
36+
- CT values in Hounsfield units
3737

3838
### Zip structure
3939

4040
```
4141
submission.zip
42-
├── sub-068/
42+
├── sub-004/
4343
│ ├── ct.nii.gz
4444
│ └── pet.nii.gz # optional
45-
├── sub-074/
45+
├── sub-009/
4646
│ ├── ct.nii.gz
47-
│ └── pet.nii.gz
48-
├── sub-081/
47+
│ └── pet.nii.gz # optional
48+
├── sub-010/
4949
│ ├── ct.nii.gz
50-
│ └── pet.nii.gz
51-
└── sub-087/
50+
│ └── pet.nii.gz # optional
51+
└── sub-018/
5252
├── ct.nii.gz
53-
└── pet.nii.gz
53+
└── pet.nii.gz # optional
5454
```
5555

56-
Upload to the [Codabench competition page](https://www.codabench.org/competitions/12555/).
56+
Upload to the [Codabench competition page](https://www.codabench.org/competitions/12555/#/participate-tab).
5757

5858
---
5959

@@ -67,25 +67,28 @@ We run your container on the 4 validation subjects and return either:
6767

6868
See [docker-packaging.md](docker-packaging.md) for how to build and test your container locally before submitting.
6969

70-
### Container requirements
71-
72-
Your container must:
73-
- Read inputs from `/data/features/` (read-only mount)
74-
- Write `ct.nii.gz` to `/data/output/`
75-
- Complete within 5 minutes per subject
76-
- Not require network access
7770

7871
### How to submit
7972

80-
Save your image and email it (or a download link) to **bic-mac-challenge@github.io**:
73+
Email **bic-mac-challenge@github.io** with subject line `[DRY-RUN] <TeamName>` and include:
74+
- Team name, Docker image name and tag
75+
- A short description of your approach
76+
- A link to your image using **one** of the options below
8177

78+
**Option A — Docker Hub (preferred):**
8279
```bash
83-
docker save my-model:latest | gzip > my-model.tar.gz
80+
docker tag my-model:latest <dockerhub-username>/my-model:latest
81+
docker push <dockerhub-username>/my-model:latest
8482
```
83+
Send us the full image name (e.g. `myteam/my-model:latest`).
8584

86-
Subject line: `[DRY-RUN] <TeamName>`
85+
**Option B — Compressed archive via file sharing:**
86+
```bash
87+
docker save my-model:latest | gzip > my-model.tar.gz
88+
```
89+
Upload `my-model.tar.gz` to Google Drive, Dropbox, or similar and share the download link.
8790

88-
Include in the body: team name, Docker image name and tag, and a short description of your approach.
91+
Dry Run submissions are limited to two per month per team.
8992

9093
---
9194

@@ -103,11 +106,7 @@ Results and winner announcements: **September 1, 2026**.
103106

104107
### How to submit
105108

106-
Same as the dry run — email your container to **bic-mac-challenge@github.io** with subject:
107-
108-
```
109-
[FINAL] <TeamName>
110-
```
109+
Same as the dry run — email your container to **bic-mac-challenge@github.io** with subject `[FINAL] <TeamName>`, using Docker Hub or a compressed archive with a file sharing link.
111110

112111
---
113112

src/recon/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ ENV OVERWRITE=""
5454
ENV VERBOSE=""
5555

5656
CMD python3 main.py \
57-
/data/recon \
58-
/data/ct/ct.nii.gz \
59-
/data/output \
57+
--recon_dir /data/recon \
58+
--ct /data/ct/ct.nii.gz \
59+
--output_dir /data/output \
6060
${OVERWRITE:+--overwrite} \
6161
${VERBOSE:+--verbose}

src/recon/docker-compose.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/recon/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def reconstruction_pipeline(
2828
overwrite=False,
2929
verbose=False,
3030
):
31-
31+
3232
out_pet_nifti_path = os.path.join(output_dir, 'pet.nii.gz')
3333
intemediates_dir = os.path.join(output_dir, 'intermediates')
3434
face_swapped_ct_path = os.path.join(intemediates_dir, 'ct_face_swapped.nii.gz')
@@ -40,6 +40,8 @@ def reconstruction_pipeline(
4040
mult_acf_sino_path = os.path.join(intemediates_dir, "mult.hs")
4141
pet_hv_path = os.path.join(intemediates_dir, "pet_20.hv")
4242

43+
log.warning("Running reconstruction requires 20GB of RAM and takes 20-120 minutes depending on CPU. The intermediates folder takes up ~50GB of additional space. Consider deleting it after succesfull reconstruction")
44+
4345
os.makedirs(intemediates_dir, exist_ok=True)
4446

4547
check_input_hashes(intemediates_dir, ct_path, ct_face_and_bed_path, overwrite)
@@ -106,11 +108,11 @@ def reconstruction_pipeline(
106108
# Step 6: Calculate ACF sinogram
107109
if not os.path.exists(acf_sino_path) or overwrite:
108110
t = time.perf_counter()
109-
log.info("[6/10] Converting mu-map from image to ACF sinogram...")
111+
log.info("[6/10] Converting mu-map image to ACF sinogram...")
110112
calculate_acf(mumap_hv_path, add_sino_path, acf_sino_path, acf_forwardprojector)
111113
log.info(f" done ({time.perf_counter()-t:.1f}s)")
112114
else:
113-
log.info("[6/10] Converting mu-map from image to ACF sinogram (skipped)")
115+
log.info("[6/10] Converting mu-map image to ACF sinogram (skipped)")
114116

115117
# Step 7: Apply ACF to additive sinogram
116118
if not os.path.exists(add_acf_sino_path) or overwrite:
@@ -133,7 +135,7 @@ def reconstruction_pipeline(
133135
# Step 9: Reconstruct PET
134136
if not os.path.exists(pet_hv_path) or overwrite:
135137
t = time.perf_counter()
136-
log.info("[9/10] Reconstructing PET (this will take some time)...")
138+
log.info("[9/10] Reconstructing PET (this will take some time - especially first subiteration)...")
137139
run_reconstruction(recon_template, add_acf_sino_path, mult_acf_sino_path, prompts_sino_path, pet_hv_path, verbose=verbose)
138140
log.info(f" done ({time.perf_counter()-t:.1f}s)")
139141
else:

0 commit comments

Comments
 (0)