This repository provides the code for running BICEPS (Bone Injection of CEment Planning System). BICEPS takes a CT image of a patient with one or more Vertebral Compression Fractures and generates an estimation of the healthy state of the patients spine to enable treatment planning. The methodology was first introduced and is described in Patient-specific virtual spine straightening and vertebra inpainting: An automatic framework for osteoplasty planning. The main steps of the system, the inputs and outputs of each step are discribed in the visual example below.
The code has been implemented using Python 3.7. To install the necessary packages for this framework run:
pip install -r requirements.txt
To run this framework the user needs to specify two inputs, the patient directory and the vertebra fracture id. For example:
python main.py --patient_dir ./patient01/ --fracture 22
The patient directory must include a sub-directory with the fractured scan; this can be named arbitrarily but should include the chars 'ct' in it. Currently only nifti files are expected, so file should have ending .nii
or nii.gz
. Additionally, the directory can also include scans of the pre-fractured, healthy, state and post-operative state (again the scans in these sub-directories must include 'ct' in them). The sub-directories are named with the date of the scan. Then the framework will include these in the analysis by adding either --healthy
or --post_op
as arguments when running main. An example of the structure is as follows:
--patient01
--02052016
--ct_scan.nii
--04122019
--ct_scan.nii
--20122019
--ct_scan.nii
--mask_scan.nii
The vertebra - label correspondence is as follows:
Vertebra | Label |
---|---|
C1 | 1 |
C2 | 2 |
... | ... |
C7 | 7 |
T1 | 8 |
... | ... |
T12 | 19 |
L1 | 20 |
... | ... |
L5 | 24 |
Additional optional arguments the user may provide are:
height_scale: *to be described*
visualize: If set the scans and masks of all steps are shown using napari - caution can be expensive to visualize all steps' outputs
save: If set the intermediate scans are stored
You can download all the trained models here. After download place them in the models
directory.
Pedicle detection is a new feature of BICEPS. It aims to increase accuracy by only considering vertebral bodies in the evaulations (in other words, it neglects the spinal processes as the current inpainting pipeline has sometimes problems reproducing them correctly).
Vertebral bodies are separated from the spinal processes after the final inpainting step. For the comparison of volumes, the separation is also performed for the pre-fractured (healthy) and post-operative scan.
To enable pedicle detection, an additional parameter named --pedicle_detection has to be provided. An exemplary run could be executed with the following command:
python main.py --patient_dir ./patient01/ --fracture 20 --healthy --post_op --pedicle_detection
For pedicle detection to work properly, some additional input files have to be provided. The following tree summarizes the required files:
--patient01
--02052016
--ct_scan.nii
--ct_scan_seg-subreg_ctd.json
--04122019
--ct_scan.nii
--ct_scan_seg-subreg_ctd.json
--20122019
--ct_scan.nii
--patient01_inpaint_seg-subreg_ctd.json
In addition to the required files for standard BICEPS, pedicle detection requires JSON-files that contain the positions of vertebral centroids that correspond to a specific scan. For the pre-fractured and fractured scans, there has to be a JSON-file that exactly follows the naming shown in the example (<name_of_scan>_seg-subreg_ctd.json). For the inpainted scan, there also has to be a JSON-file in the main folder that follows the naming shown in the example (<name_of_folder>_inpaint_seg-subreg_ctd.json).
The JSON-files have to follow the syntax demonstrated in this example:
{"vertebralCentroids":
[
{"direction":["P","I","L"]},
{"label":18,"X":134.6,"Y":36.7,"Z":23},
{"label":19,"X":122.4,"Y":97.9,"Z":23},
{"label":20,"X":114.2,"Y":163.2,"Z":23},
{"label":21,"X":97.9,"Y":228.5,"Z":23},
{"label":22,"X":85.7,"Y":301.9,"Z":22}
]
}
Currently, these JSON-files have to be provided by hand and can be generated with the website Anduin BoneScreen. The JSON-file corresponding to the inpainted image can be generated by first running BICEPS without pedicle detection and saving the temporary files. This will generate a file for the inpainted image that can be used as an input for Anduin BoneScreen.
If you use this repo for your research, please cite us in your work by:
@article{bukas2021patient,
title={Patient-specific virtual spine straightening and vertebra inpainting: An automatic framework for osteoplasty planning},
author={Bukas, Christina and Jian, Bailiang and Venegas, Luis F Rodriguez and De Benetti, Francesca and Ruehling, Sebastian and Sekuboyina, Anjany and Gempt, Jens and Kirschke, Jan S and Piraud, Marie and Oberreuter, Johannes and others},
journal={arXiv preprint arXiv:2103.07279},
year={2021}
}