|
| 1 | +# DeepEdit |
| 2 | + |
| 3 | + |
| 4 | +DeepEdit is a method that combines an automatic and a semi-automatic approach for 3D medical images into a |
| 5 | +single deep learning-based model. DeepEdit has three working modes: first, it can be used in click-free |
| 6 | +inference mode (similar to a regular segmentation network), providing fully-automatic segmentation predictions which |
| 7 | +can be used as a form of initialisation; second, it allows users to provide clicks to initialise and guide |
| 8 | +a semi-automatic segmentation model; lastly, given an initial segmentation, DeepEdit can be used to refine |
| 9 | +and improve the initial prediction by providing editing clicks. DeepEdit training process is similar to the algorithm |
| 10 | +proposed by **_Sakinis et al._** [DeepGrow](../../deepgrow/ignite) - Gaussian-smoothed clicks for all labels and background |
| 11 | +are generated and added as input to the backbone CNN, but removes the minimum-click limitation of DeepGrow. |
| 12 | +Contrary to DeepGrow, DeepEdit model allows the prediction of an automatic segmentation-based |
| 13 | +initialisation without user-provided clicks, which can then be further edited by providing clicks. Additionally, |
| 14 | +DeepEdit can also be used for multi-label segmentation problems, allowing the user to generate/segment |
| 15 | +all labels simultaneously instead of one label at a time. |
| 16 | + |
| 17 | +This tutorial contains an example to train a DeepEdit model and a notebook to run inference |
| 18 | +over a pre-trained model. The train file reads images and labels folders (imagesTr, labelsTr) as they come in the |
| 19 | +[Medical Segmentation Decathlon](https://msd-for-monai.s3-us-west-2.amazonaws.com/Task09_Spleen.tar). |
| 20 | + |
| 21 | +More information about the transforms used in DeepEdit are also in the Notebook. |
| 22 | + |
| 23 | +**_Important note:_** |
| 24 | + |
| 25 | +This tutorial is intended to show how to train and test a DeepEdit model in MONAI Core library. Users may also find interesting |
| 26 | +DeepEdit model working in [MONAI Label](https://github.com/Project-MONAI/MONAILabel/tree/main/sample-apps/radiology#deepedit) |
| 27 | +platform. There you can find how DeepEdit works along with 3D Slicer and/or OHIF. |
| 28 | + |
| 29 | +<p align="center"> |
| 30 | + <img src="../../figures/general_schema_deepedit.png" alt="deepedit scheme"> |
| 31 | +</p> |
| 32 | + |
| 33 | +**_Sakinis et al.,_** Interactive segmentation of medical images through |
| 34 | +fully convolutional neural networks. (2019) https://arxiv.org/abs/1903.08205 |
| 35 | + |
| 36 | +### 1. Data |
| 37 | + |
| 38 | +A DeepEdit model could be trained on any 3D medical image dataset. |
| 39 | + |
| 40 | +For this tutorial we used the public available dataset (Task09_Spleen) that can be downloaded from [Medical Segmentation Decathlon](https://drive.google.com/drive/folders/1HqEgzS8BV2c7xYNrZdEAnrHk7osJJ--2) |
| 41 | + |
| 42 | +### 2. Questions and bugs |
| 43 | + |
| 44 | +- For questions relating to the use of MONAI, please us our [Discussions tab](https://github.com/Project-MONAI/MONAI/discussions) on the main repository of MONAI. |
| 45 | + |
| 46 | +- For bugs relating to MONAI functionality, please create an issue on the [main repository](https://github.com/Project-MONAI/MONAI/issues). |
| 47 | + |
| 48 | +- For bugs relating to the running of a tutorial, please create an issue in [this repository](https://github.com/Project-MONAI/Tutorials/issues). |
| 49 | + |
| 50 | +### 3. List of notebooks and examples |
| 51 | + |
| 52 | +#### Prepare Your Data |
| 53 | + |
| 54 | +- Download the Task09_Spleen zip file |
| 55 | +- Decompressed the file |
| 56 | +- Write the full path in the **input** flag in the [train file](./train.py) |
| 57 | + |
| 58 | + |
| 59 | +#### [DeepEdit Training](./train.py) |
| 60 | + |
| 61 | +This is an extension for [train.py](./train.py) that redefines basic default arguments to run 3D training. |
| 62 | + |
| 63 | +```bash |
| 64 | +# Run to know all possible options |
| 65 | +python ./train.py -h |
| 66 | + |
| 67 | +# Train a DeepEdit model |
| 68 | +python ./train_3d.py |
| 69 | + --input deepedit/Task09_Spleen \ |
| 70 | + --output deepedit_model/ \ |
| 71 | + --epochs 100 |
| 72 | + |
| 73 | +# After training to export/save as torch script model |
| 74 | +python ./train.py |
| 75 | + --input deepedit_model/model.pt \ |
| 76 | + --output deepedit_model/model.ts \ |
| 77 | + --export true |
| 78 | +``` |
| 79 | + |
| 80 | +#### [DeepEdit Inference](./inference.ipynb) |
| 81 | + |
| 82 | +This notebook helps to run any pre-transforms before running inference over a DeepEdit single label model. |
| 83 | +It also helps to run post-transforms to get the final label mask. |
| 84 | + |
| 85 | + |
| 86 | +#### DeepEdit Stats |
| 87 | + |
| 88 | +By-default Tensorboard handlers are added as part of training/validation steps. |
0 commit comments