|
1 | 1 | # ScribbleBench |
2 | 2 |
|
3 | 3 | [](https://github.com/Karol-G/ScribbleBench/raw/main/LICENSE) |
4 | | -[](https://pypi.org/project/ScribbleBench) |
5 | 4 | [](https://python.org) |
6 | | -[](https://github.com/Karol-G/ScribbleBench/actions) |
7 | | - |
8 | | -[](https://codecov.io/gh/Karol-G/ScribbleBench) |
9 | 5 |
|
10 | | -Revisiting 3D Medical Scribble Supervision: Benchmarking Beyond Cardiac Segmentation |
| 6 | +**ScribbleBench** is a comprehensive benchmark for evaluating the generalization capabilities of 3D scribble-supervised medical image segmentation methods. It spans seven diverse datasets across multiple anatomies and modalities and provides realistic, automatically generated scribble annotations. |
11 | 7 |
|
12 | | ----------------------------------- |
| 8 | +This repository provides: |
| 9 | +- A guide on how to setup the ScribbleBench benchmark using the original dataset sources and our ScribbleBench scribbles. |
| 10 | +- Our scribble generation code to create realistic interior and boundary scribbles heuristics. |
| 11 | +- An evaluation script to evaluate your method using ScribbleBench. |
| 12 | +- A reference to our scribble baseline nnnUNet+pL |
| 13 | +- A scribble annotation protocol for domain experts that can be used as guidance to quickly annotate new datasets manually. |
13 | 14 |
|
14 | | -Project description... |
| 15 | +ScribbleBench was introduced in our MICCAI 2025 paper: |
| 16 | +**“Revisiting 3D Medical Scribble Supervision: Benchmarking Beyond Cardiac Segmentation”** |
| 17 | +Authors: Karol Gotkowski, Klaus H. Maier-Hein, Fabian Isensee |
15 | 18 |
|
16 | | -## Installation |
17 | 19 |
|
18 | | -You can install `ScribbleBench` via [pip](https://pypi.org/project/ScribbleBench/): |
| 20 | +## 📦 Benchmark Setup |
19 | 21 |
|
20 | | - pip install ScribbleBench |
| 22 | +ScribbleBench includes scribbles for the following 7 public datasets: |
| 23 | +- ACDC |
| 24 | +- MSCMR |
| 25 | +- WORD |
| 26 | +- AMOS2022 (Task2) |
| 27 | +- KiTS23 |
| 28 | +- LiTS |
| 29 | +- BraTS2020 |
21 | 30 |
|
| 31 | +### 📥 Download Datasets |
22 | 32 |
|
| 33 | +TODO |
23 | 34 |
|
24 | 35 |
|
25 | | -## Contributing |
| 36 | +## 🛠️ Scribble Generation |
26 | 37 |
|
27 | | -Contributions are very welcome. Tests can be run with [tox], please ensure |
28 | | -the coverage at least stays the same before you submit a pull request. |
| 38 | +You can use our script to generate scribbles for your own 3D medical segmentation datasets. The script supports: |
| 39 | +- Interior scribbles using NURBS curves. |
| 40 | +- Boundary scribbles based on partial contours. |
| 41 | +- Foreground/background slice balancing. |
| 42 | +- Multiprocessing for efficient processing of large datasets. |
29 | 43 |
|
30 | | -## License |
| 44 | +### 🚀 Run Scribble Generation |
31 | 45 |
|
32 | | -Distributed under the terms of the [Apache Software License 2.0] license, |
33 | | -"ScribbleBench" is free and open source software |
| 46 | +```bash |
| 47 | +python generate_scribbles.py \ |
| 48 | + --input path/to/dense_segmentations \ |
| 49 | + --output path/to/save_scribbles \ |
| 50 | + --num_labels 4 \ |
| 51 | + --conf scribble_conf.yml \ |
| 52 | + --processes 8 |
| 53 | +``` |
34 | 54 |
|
35 | | -## Issues |
| 55 | +**Optional arguments:** |
36 | 56 |
|
37 | | -If you encounter any problems, please file an issue along with a detailed description. |
| 57 | +* `--name` → specify one or more file names to process (omit `.nii.gz`) |
| 58 | +* `--disable_ignore` → disables marking unlabeled voxels with an ignore label |
38 | 59 |
|
39 | | -[Cookiecutter]: https://github.com/audreyr/cookiecutter |
40 | | -[MIT]: http://opensource.org/licenses/MIT |
41 | | -[BSD-3]: http://opensource.org/licenses/BSD-3-Clause |
42 | | -[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt |
43 | | -[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt |
44 | | -[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0 |
45 | | -[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt |
| 60 | +## 📊 Evaluation |
46 | 61 |
|
47 | | -[tox]: https://tox.readthedocs.io/en/latest/ |
48 | | -[pip]: https://pypi.org/project/pip/ |
49 | | -[PyPI]: https://pypi.org/ |
| 62 | +You can evaluate your segmentation predictions using the provided script: |
| 63 | + |
| 64 | +```bash |
| 65 | +python evaluation.py \ |
| 66 | + --gt_dir path/to/ground_truth \ |
| 67 | + --pred_dir path/to/predictions \ |
| 68 | + --num_labels 4 \ |
| 69 | + --processes 8 |
| 70 | +``` |
| 71 | + |
| 72 | +## 🛠️ Scribble Baseline nnUNet+pL |
| 73 | + |
| 74 | +Our scribble baseline nnUNet+pL is implemented in the [nnU-Net](https://github.com/MIC-DKFZ/nnUNet) framework itself. It is there referred to as "ignore label" and is described [here](https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/ignore_label.md). |
| 75 | + |
| 76 | +## 📋 Scribble Annotation Protocol |
| 77 | + |
| 78 | +You can also manually create your own scribbles for new datasets by following this lightweight annotation protocol. These human-created scribbles can be used directly to train a model using the same methods as with automatically generated ones. |
| 79 | + |
| 80 | +### ✏️ Instructions |
| 81 | + |
| 82 | +Given a 3D image **I** in your dataset: |
| 83 | +- For each axial slice **S** in **I**: |
| 84 | + - For each class **C** present in slice **S**: |
| 85 | + - Select a single **connected component (CC)** of class **C** in **S** |
| 86 | + - For that component **CC**, draw: |
| 87 | + - One **interior scribble** |
| 88 | + - One **boundary scribble** |
| 89 | + |
| 90 | +Note: Do not ignore the background class! Also include a good number of pure background slices. |
| 91 | + |
| 92 | +#### 🟢 Interior Scribble |
| 93 | +- Must be drawn **inside the component CC**. |
| 94 | +- Should be placed roughly **in and around the center area** of the component. |
| 95 | +- Ideal length is **comparable to the diameter or extent** of the component. |
| 96 | +- Can be any arbitrary shape (straight, curved, etc.) as long as it lies **fully within the component**. |
| 97 | + |
| 98 | +#### 🔵 Boundary Scribble |
| 99 | +- Should trace **a portion (15%–100%)** of the **inner boundary** of the component CC. |
| 100 | +- Should ideally follow the actual boundary as closely as possible. |
| 101 | +- A **1–3 voxel inward offset** is acceptable, but **closer to the true boundary is better**. |
| 102 | +- This scribble helps the model capture **boundary details** during learning. |
| 103 | + |
| 104 | +Following this protocol allows quick and efficient labeling of 3D datasets using just a few sparse lines per class and slice, while maintaining strong training performance. |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +## 📄 Citation |
| 109 | + |
| 110 | +If you use ScribbleBench or our scribble generation code, please cite: |
| 111 | + |
| 112 | +```bibtex |
| 113 | +@inproceedings{gotkowski2025scribblebench, |
| 114 | + title = {Revisiting 3D Medical Scribble Supervision: Benchmarking Beyond Cardiac Segmentation}, |
| 115 | + author = {Karol Gotkowski and Klaus H. Maier-Hein and Fabian Isensee}, |
| 116 | + booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI)}, |
| 117 | + year = {2025} |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | + |
| 122 | +## 📬 Contact |
| 123 | + |
| 124 | +For questions, suggestions, or contributions, feel free to open an issue or contact [karol.gotkowski@dkfz.de](mailto:karol.gotkowski@dkfz.de). |
0 commit comments