Skip to content

Commit

Permalink
Configuration (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
giladmaya authored Aug 16, 2024
1 parent 26358d8 commit 60f98d4
Show file tree
Hide file tree
Showing 27 changed files with 611 additions and 223 deletions.
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Local Development",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../docker/development.Dockerfile"
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "poetry install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
"mounts": [
"source=${localWorkspaceFolder},target=/project,type=bind,consistency=cached"
]
}
19 changes: 19 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ jobs:
with:
pytest-xml-coverage-path: ./coverage.xml

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cardinalby/export-env-action@v2
id: cicd_env
with:
envFile: 'github.env'
expand: 'true'
- uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: abatilo/[email protected]
with:
poetry-version: ${{ env.POETRY_VERSION }}
- run: poetry install --no-interaction
- name: Build docs
run: poetry run mkdocs build

# build:
# runs-on: ubuntu-latest
# steps:
Expand Down
7 changes: 7 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ build:
os: ubuntu-22.04
tools:
python: "3.8"
jobs:
post_create_environment:
- pip install poetry==1.1.11
post_install:
# TODO: Change to docs group after poetry upgrade
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install


mkdocs:
configuration: mkdocs.yml
Expand Down
20 changes: 20 additions & 0 deletions docker/development.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update --yes && \
apt-get install -y python3-pip

ENV POETRY_VERSION=1.1.11
RUN pip3 install --upgrade pip && pip3 install "poetry==$POETRY_VERSION"


RUN mkdir /src
WORKDIR /src

RUN poetry config virtualenvs.create false

# Install dependencies (cached)
COPY pyproject.toml poetry.lock ./
RUN poetry install

CMD ["/bin/bash"]
Binary file added docs/assets/bme_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/miccai2022_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/tcml_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 0 additions & 19 deletions docs/dataset_preprocessing.md

This file was deleted.

49 changes: 47 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,57 @@

PD-DWI is a physiologically-decomposed Diffusion-Weighted MRI machine-learning model for predicting response to neoadjuvant chemotherapy in invasive breast cancer.

PD-DWI was developed by [TCML](https://tcml-bme.github.io/) group as part of [BMMR2 challenge](https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=89096426) using [ACRIN-6698](https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=50135447) dataset.
PD-DWI was developed by [TCML](https://tcml-bme.github.io/) group.

<figure markdown="span">
![TCML](assets/tcml_logo.png)
</figure>

**If you publish any work which uses this package, please cite the following publication:** Gilad, M., Freiman, M. (2022). PD-DWI: Predicting Response to Neoadjuvant Chemotherapy in Invasive Breast Cancer with Physiologically-Decomposed Diffusion-Weighted MRI Machine-Learning Model. In: Wang, L., Dou, Q., Fletcher, P.T., Speidel, S., Li, S. (eds) Medical Image Computing and Computer Assisted Intervention – MICCAI 2022. MICCAI 2022. Lecture Notes in Computer Science, vol 13433. Springer, Cham. https://doi.org/10.1007/978-3-031-16437-8_4

!!! note
This work was developed as part of the [BMMR2 challenge](https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=89096426) using [ACRIN-6698](https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=50135447) dataset.

!!! warning
Not intended for clinical use.
Not intended for clinical use.

## BMMR2 Challenge

``` plotly
{
"data": [
{
"x": [
"Benchmark",
"Team C",
"Team B",
"Team A",
"PD-DWI"
],
"y": [
0.782,
0.803,
0.838,
0.840,
0.885
],
"marker": {
"color": ["rgba(136,204,238,1)", "rgba(136,204,238,1)", "rgba(136,204,238,1)", "rgba(136,204,238,1)", "rgba(204,102,119,1)"]
},
"type": "bar"
}
],
"layout": {
"title": "Model Performance",
"xaxis": { "title": "Best Performing Models" },
"yaxis": {
"title": "AUC Score",
"range": [
0.75,
0.9
]
}
}
}
```

34 changes: 0 additions & 34 deletions docs/installation.md

This file was deleted.

34 changes: 34 additions & 0 deletions docs/installation/install_package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Install Package

## Install via pip

PD-DWI package is available on PyPi for installation via pip. Wheels are automatically generated for each release of PD-DWI, allowing you to
install pd-dwi without having to compile anything.

!!! note
Ensure that you have python 3.8 installed on your machine.

* Install PD-DWI:
```bash
python -m pip install pd-dwi
```

## Install from source

PD-DWI can also be installed from source code.

!!! note
Ensure the following pre-prerequisites are installed on your machine:

* git
* python 3.8
* poetry 1.1.11

1. Clone the repository
```console
git clone https://github.com/TechnionComputationalMRILab/PD-DWI.git
```
2. Install the project
```console
cd PD-DWI & poetry install --all-extras
```
39 changes: 3 additions & 36 deletions docs/usage.md → docs/usage/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Usage
# Getting Started

## Dataset setup

Expand Down Expand Up @@ -34,43 +34,10 @@ To calculate the ADC and F maps from your DWI data, please use our pre-processin

All clinical data will be stored in a file named _clinical.csv_.
Each line will contain the following values, by order of appearance:

1. Patient ID DICOM - subject identifier, must be identical to subject's folder name
2. hrher4g - 4 level hormone receptor status
3. SBRgrade - 3 level tumor grade
4. race - subject's race
5. Ltype - lesion type
6. pcr - pCR label of subject. If not available, should be defined as an empty string

## Command-line usage

All options on the command line can be listed by running:

!!! note ""
pd-dwi -h

### Train
To train a pd-dwi model, run:

!!! note ""
pd-dwi train -dataset <path/to/dataset\> -config <path/to/config\> -out <path/to/store/model\>

* The pd-dwi framework expects the dataset to be organized in a specific way, please refer to Dataset setup for additional information.
* For training configuration structure and options, please refer to training configuration documentation.


### Predict
To predict model output using a pre-trained pd-dwi model, run

!!! note ""
pd-dwi predict -model <path/to/pre-trained/model\> -dataset <path/to/dataset\> [-probability] -out <path/to/store/model/output\>

!!! warning
The pre-trained model must be trained on the same pd-dwi version as the one used for prediction


### Score
To evaluate the performance of the pd-dwi model, run

!!! note ""
pd-dwi score -model <path/to/pre-trained/model\> -dataset <path/to/dataset\>

6. pcr - pCR label of subject. If not available, should be defined as an empty string
11 changes: 11 additions & 0 deletions docs/usage/model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Model


## Command-line usage

This page provides documentation for command line tools.

::: mkdocs-click
:module: pd_dwi.scripts.cli
:command: pd_dwi_cli
:style: table
10 changes: 10 additions & 0 deletions docs/usage/pre_processing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# DWI Pre Processing

## Command-line Usage

This page provides documentation for pre-processing command line tools.

::: mkdocs-click
:module: pd_dwi.scripts.cli
:command: preprocessing_cli
:style: table
File renamed without changes.
58 changes: 53 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,60 @@
site_name: PD-DWI

repo_url: https://github.com/technionComputationalMRILab/PD-DWI/

theme:
name: readthedocs
highlightjs: true
include_homepage_in_sidebar: true

nav:
- Home: index.md
- Installation: installation.md
- Usage: usage.md
- Training Configuration: training_configuration.md
- Dataset Preprocessing: dataset_preprocessing.md
- Installation:
- Install Package: installation/install_package.md
- Usage:
- Getting Started: usage/index.md
- DWI Pre Processing: usage/pre_processing.md
- Model: usage/model.md
- Training Configuration: usage/training_configuration.md

plugins:
- plotly
- search

theme: readthedocs
markdown_extensions:
# Python Markdown
- abbr
- admonition
- attr_list
- def_list
- footnotes
- md_in_html
- toc:
permalink: true

# Python Markdown Extensions
- pymdownx.arithmatex:
generic: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.details
- pymdownx.highlight
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde
- mkdocs-click
- pymdownx.superfences:
custom_fences:
- name: plotly
class: mkdocs-plotly
format: !!python/name:mkdocs_plotly_plugin.fences.fence_plotly


Loading

1 comment on commit 60f98d4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
pd_dwi
   __init__.py20100% 
   dataset.py463230%12, 15–18, 20–22, 24, 26–27, 29, 31–32, 34–37, 39–43, 45, 47–49, 56, 59, 62, 66, 69
   model.py803753%56, 58–60, 62–63, 66, 68–70, 72–73, 77–78, 80–82, 84–85, 87–88, 90, 92–94, 100–111
   training_utils.py53492%27–28, 60, 84
pd_dwi/config
   __init__.py00100% 
   config.py71198%100
   utils.py11190%15
pd_dwi/feature_selection
   __init__.py00100% 
   select_k_best.py60100% 
pd_dwi/models
   __init__.py12466%14–16, 18
pd_dwi/preprocessing
   __init__.py00100% 
   adc.py853361%15, 17–18, 20–21, 23–26, 28, 84–85, 87–90, 92, 95, 98–100, 103, 105, 107, 110–112, 114–115, 117–118, 131, 165
   column_transformer.py10460%14–15, 18, 20
pd_dwi/preprocessing/transformers
   __init__.py00100% 
   hormone_receptor_encoder.py19952%16–17, 19, 22–24, 26, 29, 32
   radiomics_encoder.py692859%40, 43, 55–56, 58, 61, 63–64, 66, 68, 71, 74, 77–82, 84–85, 87, 90, 93–98
   sbr_grade_encoder.py21957%18–19, 22, 24, 27–28, 30, 33, 36
pd_dwi/scripts
   __init__.py00100% 
   adc_preprocess_command.py14750%16–17, 19–20, 22–24
   cli.py190100% 
   list_command.py70100% 
   predict_command.py14657%16, 18–19, 21–22, 24
   score_command.py8275%11–12
   train_command.py10370%12–14
pd_dwi/utils
   __init__.py00100% 
   dcm_utils.py211528%10–12, 14, 21, 23–26, 28, 30–32, 34, 39
TOTAL57819566% 

Please sign in to comment.