Switch to unified view

a b/documentation/generate_lesion_measures.md
1
# How to generate lesion measures from the test set predicted masks?
2
Once you have performed the inference and saved the network predicted masks in NIFTI format (as described in [inference.md](./inference.md)), you can proceed with the generation of lesion measures from test set predicted and ground truth lesions masks. We compute six different patient level lesion measures: patient-level lesion SUV<sub>mean</sub>, lesion SUV<sub>max</sub>, number of lesions, total metabolic tumor volume (TMTV) in ml, total lesion glycolysis (TLG) in ml, and lesion dissemination (D<sub>max</sub>) in cm. These metrics have been defined in [metrics/metrics.py](./../metrics/metrics.py) and have been shown to be prognostic biomarkers in lymphoma. 
3
4
## Step 1: Activate the required conda environment (`lymphoma_seg`) and navigate to `segmentation` folder
5
First, activate the conda environment `lymphoma_seg` using (created as described in [conda_env.md](./conda_env.md)):  
6
7
```
8
conda activate lymphoma_seg
9
cd segmentation
10
```
11
12
## Step 2: Run the script to compute test metrics
13
After this, run the following script in your terminal,
14
```
15
python generate_lesion_measures.py --fold=0 --network-name='unet' --input-patch-size=192
16
```
17
18
Alternatively, modify the [segmentation/generate_lesion_measures.sh](./../segmentation/generate_lesion_measures.sh) for your use-case (which contains the same bash script as above) and run:
19
20
```
21
bash generate_lesion_measures.sh
22
```
23
24
The ground truth and predicted lesion measures on the test set will be written to `LYMPHOMA_SEGMENTATION_FOLDER/results/test_lesion_measures/fold{fold}/{network_name}/{experiment_code}/testlesionmeasures.csv`, as described in [results_format.md](./results_format.md) file. The relevant directory structure may then look like:
25
26
    └───lymphoma.segmentation/
27
            ├── data
28
            └── results
29
                ├── logs
30
                ├── models
31
                ├── predictions
32
                └── test_metrics
33
                └── test_lesion_measures
34
                    ├── fold0
35
                    │   └── unet
36
                    │       └── unet_fold0_randcrop192
37
                    │           └── testlesionmeasures.csv   
38
                    └── fold1
39
                        └── unet
40
                            └── unet_fold1_randcrop192
41
                                └── testlesionmeasures.csv