Skip to content

Commit

Permalink
Merge pull request #4 from raidionics/docker_update
Browse files Browse the repository at this point in the history
Models download from Github only, new Docker image backend.
  • Loading branch information
dbouget committed Feb 22, 2024
2 parents 4588652 + 6a4e7db commit ff91c05
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 40 deletions.
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BSD 2-Clause License

Copyright (c) 2021, dbouget
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

49 changes: 33 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
# Raidionics-Slicer
<div align="center">
<h1 align="center">Raidionics plugin (3D Slicer)</h1>
<h3 align="center">Open plugin for AI-based segmentation and standardized reporting for neuro and mediastinal applications</h3>

[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause)
[![Paper](https://zenodo.org/badge/DOI/10.1038/s41598-023-42048-7.svg)](https://doi.org/10.1038/s41598-023-42048-7)
[![Paper](https://zenodo.org/badge/DOI/10.3389/fneur.2022.932219.svg)](https://www.frontiersin.org/articles/10.3389/fneur.2022.932219/full)


Plugin for 3D Slicer to use the segmentation models and clinical reporting techniques (RADS) packaged in Raidionics.
A paper presenting the software and some benchmarks has been published in [Scientific Reports](https://doi.org/10.1038/s41598-023-42048-7).
The plugin was first introduced in the article _"Brain tumor preoperative surgery imaging: models and software solutions for
segmentation and standardized reporting"_, published in [Frontiers in Neurology](https://www.frontiersin.org/articles/10.3389/fneur.2022.932219/full).

<p align="center">
<img src="Raidionics/Raidionics/Resources/Icons/Raidionics-Slicer.gif" width="85%">
</p>
</div>

<details open>
<summary>

## Installation
</summary>
## [Installation](https://github.com/raidionics/Raidionics-Slicer#installation)

The plugin has been tested with the stable release 5.6.1 of 3D Slicer, and the upcoming release 5.7.0.
A [step-by-step video](https://www.youtube.com/watch?v=NStMzLcj1WE) for installing the plugin and running a segmentation model for the first time is available.

The plugin has been tested with the stable release 5.2.2 of 3D Slicer.
<details>
<summary>

### [Step-by-step](https://github.com/raidionics/Raidionics-Slicer#step-by-step)
</summary>
* Download 3D Slicer for your running operating system from [here](https://download.slicer.org/).

* Download the plugin source code through either:
Expand All @@ -25,14 +38,14 @@ The plugin has been tested with the stable release 5.2.2 of 3D Slicer.
* Download and install Docker (see [below](https://github.com/raidionics/Raidionics-Slicer#docker-setup--)).
The necessary _Raidionics_ Docker image should be collected automatically when downloading a model for the first time.
Please do the following if it did not happen correctly:
> docker pull dbouget/raidionics-rads:v1.1
> docker pull dbouget/raidionics-rads:v1.1-py38-cpu
* Load the plugin into 3D Slicer:
∘ All Modules > Extension Wizard.
∘ Developer Tools > Extension Wizard.
∘ Select Extension > point to the folder (second Raidionics) and add it to the path (tick the small box at the bottom).
∘ Select Extension > point to the first Raidionics subfolder (inside Raidionics-Slicer) and add it to the path (tick the small box at the bottom).

* Restart 3D Slicer to setup Python environment.
* :warning: Restarting 3D Slicer to setup Python environment might be necessary on some occasions.

* Raidionics will appear in the list of modules inside the _Machine Learning_ category

Expand All @@ -41,7 +54,8 @@ The plugin has been tested with the stable release 5.2.2 of 3D Slicer.
<details open>
<summary>

## How to cite </summary>
## [How to cite](https://github.com/raidionics/Raidionics-Slicer#how-to-cite)
</summary>
If you are using Raidionics-Slicer in your research, please use the following citation:

```
Expand All @@ -61,27 +75,30 @@ If you are using Raidionics-Slicer in your research, please use the following ci
<details>
<summary>

## Methodological background </summary>
## [Methodological background](https://github.com/raidionics/Raidionics-Slicer#methodological-background)
</summary>

More information about the different models provided and architectures used can be accessed from the below-listed publications.

### Neuro
* AGU-Net neural network architecture => [Meningioma Segmentation in T1-Weighted MRI Leveraging Global Context and Attention Mechanisms](https://www.frontiersin.org/articles/10.3389/fradi.2021.711514/full)

* Standardized reporting and Data System => [Glioblastoma Surgery Imaging—Reporting and Data System: Standardized Reporting of Tumor Volume, Location, and Resectability Based on Automated Segmentations ](https://www.mdpi.com/2072-6694/13/12/2854)

* Segmentation performance => [Glioblastoma Surgery Imaging–Reporting and Data System: Validation and Performance of the Automated Segmentation Task ](https://www.mdpi.com/2072-6694/13/18/4674)
* Preoperative GBM segmentation performance => [Glioblastoma Surgery Imaging–Reporting and Data System: Validation and Performance of the Automated Segmentation Task ](https://www.mdpi.com/2072-6694/13/18/4674)
* Postoperative GBM segmentation performance => [Segmentation of glioblastomas in early post-operative multi-modal MRI with deep neural networks](https://www.nature.com/articles/s41598-023-45456-x)
* Preoperative CNS segmentation performance => [Preoperative brain tumor imaging: models and software for segmentation and standardized reporting](https://www.frontiersin.org/journals/neurology/articles/10.3389/fneur.2022.932219/full)

### Mediastinum
* Mediastinum organs segmentation => [Semantic segmentation and detection of mediastinal lymph nodes and anatomical structures in CT data for lung cancer staging](https://link.springer.com/article/10.1007/s11548-019-01948-8)
* Lymph nodes segmentation => [Mediastinal lymph nodes segmentation using 3D convolutional neural network ensembles and anatomical priors guiding](https://www.tandfonline.com/doi/pdf/10.1080/21681163.2022.2043778)
* Airways segmentation => [AeroPath: An airway segmentation benchmark dataset with challenging pathology](https://arxiv.org/abs/2311.01138)

</details>

<details>
<summary>

## Docker setup </summary>
## [Docker setup](https://github.com/raidionics/Raidionics-Slicer#docker-setup)
</summary>
A proper Docker setup is **mandatory** since all processing is performed within
a Docker image. 3D Slicer is only used for its graphical user interface.

Expand All @@ -107,7 +124,7 @@ All images will be automatically downloaded upon model selection, which might
take some minutes while the 3D Slicer interface won't be responding.

* The main Docker image can also be downloaded manually by:
> docker pull dbouget/raidionics-rads:v1.1
> docker pull dbouget/raidionics-rads:v1.1-py38-cpu
* When you execute for the first time, you might get a pop-up from Docker asking to allow
the sharing of a `.raidonics-slicer/` directory, accept!
Expand Down
10 changes: 6 additions & 4 deletions Raidionics/Raidionics/src/RaidionicsLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def executeDocker(self, dockerName, modelName, dataPath, iodict, inputs, outputs
else:
widgetPresent = False

dataPath = '/home/ubuntu/resources'
dataPath = '/workspace/resources'

# Cleaning input/output folders for every run
if os.path.exists(SharedResources.getInstance().data_path):
Expand Down Expand Up @@ -383,14 +383,16 @@ def executeDocker(self, dockerName, modelName, dataPath, iodict, inputs, outputs

cmd = list()
cmd.append(self.dockerPath)
cmd.extend(('run', '-t', '-v'))
cmd.extend(('run', '-t'))
# if self.use_gpu:
# cmd.append(' --runtime=nvidia ')
#cmd.append(TMP_PATH + ':' + dataPath)
cmd.append('--user')
cmd.append(str(os.getuid()))
cmd.append('-v')
cmd.append(SharedResources.getInstance().resources_path + ':' + dataPath)
cmd.append(dockerName)
cmd.append('-c')
cmd.append('/home/ubuntu/resources/data/rads_config.ini')
cmd.append('/workspace/resources/data/rads_config.ini')
cmd.append('-v')
cmd.append('debug')

Expand Down
10 changes: 5 additions & 5 deletions Raidionics/Raidionics/src/utils/backend_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def generate_backend_config(input_folder: str, parameters, logic_target_space: s
rads_config.set('Default', 'caller', '')
rads_config.add_section('System')
rads_config.set('System', 'gpu_id', "-1") # Always running on CPU
rads_config.set('System', 'input_folder', '/home/ubuntu/resources/data')
rads_config.set('System', 'output_folder', '/home/ubuntu/resources/output')
rads_config.set('System', 'model_folder', '/home/ubuntu/resources/models')
rads_config.set('System', 'pipeline_filename', '/home/ubuntu/resources/models/' + model_name + '/pipeline.json')
rads_config.set('System', 'input_folder', '/workspace/resources/data')
rads_config.set('System', 'output_folder', '/workspace/resources/output')
rads_config.set('System', 'model_folder', '/workspace/resources/models')
rads_config.set('System', 'pipeline_filename', '/workspace/resources/models/' + model_name + '/pipeline.json')
if logic_task == 'reporting':
rads_config.set('System', 'pipeline_filename',
'/home/ubuntu/resources/reporting/' + parameters['UserConfiguration']['default'])
'/workspace/resources/reporting/' + parameters['UserConfiguration']['default'])
rads_config.add_section('Runtime')
rads_config.set('Runtime', 'reconstruction_method',
SharedResources.getInstance().user_configuration['Predictions']['reconstruction_method'])
Expand Down
Loading

0 comments on commit ff91c05

Please sign in to comment.