Skip to content

Commit

Permalink
Initial source code release matching v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dbouget committed Aug 10, 2021
1 parent 4296729 commit aa4ae65
Show file tree
Hide file tree
Showing 121 changed files with 2,748 additions and 6 deletions.
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# use glob syntax.
syntax: glob

.DS_Store
*.elc
*.pyc
*~
.idea/
*.xml
os
numpy
*.h5
*.hd5
*.ckpt
*.mhd
*.raw
venv/
tmp_dependencies/
build/
dist/
segmentation/resources/
*.ini
*.sqlite3
*.idea
*.vscode
/home
/Atlases
ANTs/
*.exe
*.pkg
*.deb
GSI-RADS
quickpkg/
*.nii.gz
resources/models/
42 changes: 36 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![license](https://img.shields.io/github/license/DAVFoundation/captain-n3m0.svg?style=flat-square)](https://github.com/DAVFoundation/captain-n3m0/blob/master/LICENSE)
[![GitHub Downloads](https://img.shields.io/github/downloads/SINTEFMedtek/GSI-RADS/total?label=GitHub%20downloads&logo=github)](https://github.com/SINTEFMedtek/GSI-RADS/releases)

<img src="GIS-RADS_illustration.png" width="70%" height="70%">
<img src="/home/dbouget/Documents/Code/Public/GSI-RADS/images/GIS-RADS_illustration.png" width="70%" height="70%">

## 1. Description
The repository contains the software to automatically compute glioblastoma's features from a T1-wighted MRI pre-operative MRI,
Expand Down Expand Up @@ -54,15 +54,45 @@ The software may appear unresponsive when running analysis.
NOTE: The output folder is populated automatically with the following:
* The diagnosis results in human-readable text (report.txt) and Excel-ready format (report.csv).
* The automatic segmentation masks of the brain and the tumor in the original patient space (input_brain_mask.nii.gz and input_tumor_mask.nii.gz).
* The anatomical structures mask in original patient space (input_anatomical_regions_mask.nii.gz).
* The cortical structures mask in original patient space for the different atlases used.
* The input volume and tumor segmentation mask in MNI space in the sub-directory named \'registration\'.


## 3. Computed features
### 2.3 Computed features
The following features are automatically computed and reported to the user:
- **Multifocality**: whether the tumor is multifocal or not, the total number of foci, and the largest minimum distance between two foci.
- **Volume**: total tumor volume in original patient space and MNI space (in ml).
- **Laterality**: tumor percentage in each hemisphere, and assessment of midline crossing.
- **Resectability**: expected resectbale and residual volumes (in ml), and resection index.
- **Subcortical structures**: percentage of the tumor volume overlapping each structure from the MNI atlas, the Hard-Oxford atlas, and Schaefer atlas.
- **White matter tracts**: percentage of the tumor volume overlapping each tract from the BrainLab atlas. If no overlap, the minimum distance to the tract is provided (in mm).
- **Resectability**: expected residual volumes (in ml) and resection index.
- **Cortical structures**: percentage of the tumor volume overlapping each structure from the MNI atlas, the Harvard-Oxford atlas, and Schaefer atlas (version 7 and 17).
- **Subcortical structures**: percentage of the tumor volume overlapping each structure from the BCB atlas. If no overlap, the minimum distance to the structure is provided (in mm).

## 3. Source code usage

### 3.1 Installation
Use the requirements.txt file to create a virtual environment with the required libraries.
> virtualenv -p python3 venv
> cd venv
> source bin/activate
> pip install -r ../requirements.txt
> deactivate
Then, to download the trained models locally, run the following:
> source venv/bin/activate
> python setup.py
> deactivate

### 3.2 Usage
The command line input parameters are:
* -g [--use_gui]: Must be set to 0 to disable the gui, otherwise 1.
* -i [--input_filename]: Complete path to the MRI volume to process.
* (optional) -s [--input_tumor_segmentation_filename]: Complete path to the corresponding tumor mask, to avoid re-segmentation.
* -o [--output_folder]: Main destination directory. A unique timestamped folder will be created inside for each run.
* -d [--gpu_id]: Number of the GPU to use for the segmentation task. Set the value to -1 to run on CPU.


To run directly from command line, without the use of the GUI, run the following:
> source venv/bin/activate
> python main.py -g 0 -i /path/to/volume/T1.nii.gz -o /path/to/output/ -d 0
> deactivate
14 changes: 14 additions & 0 deletions diagnosis/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from diagnosis.src.diagnose import *
from diagnosis.src.Utils.configuration_parser import ResourcesConfiguration
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'


def diagnose_main(input_volume_filename, input_segmentation_filename, output_folder, preprocessing_scheme='P2',
gpu_id='-1'):
env = ResourcesConfiguration.getInstance()
env.set_environment(output_dir=output_folder)
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = gpu_id

diagnose(input_filename=input_volume_filename, input_segmentation=input_segmentation_filename,
preprocessing_scheme=preprocessing_scheme)
2 changes: 2 additions & 0 deletions diagnosis/src/NeuroDiagnosis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import *

Loading

0 comments on commit aa4ae65

Please sign in to comment.