An open API service indexing awesome lists of open source software.

https://github.com/dbouget/neuro_dicom_parser


https://github.com/dbouget/neuro_dicom_parser

Last synced: 11 months ago
JSON representation

Awesome Lists containing this project

README

          

# Utility tool for DICOM folder conversion to Nifti

Code for processing a patient DICOM folder retrieved from the PACS system for a patient referred to a neuroradiology
or neurosurgery department. All DICOM acquisitions are converted to nifti, the corresponding MR sequences are
identified for each scan, and then a subset of four MR scans (i.e., T1w, T1w-CE, T2, FLAIR) is isolated for further
processing.

## [Installation](https://github.com/dbouget/neuro_dicom_parser#installation)

```
pip install git+https://github.com/dbouget/neuro_dicom_parser.git
```

## [Getting started](https://github.com/dbouget/neuro_dicom_parser#getting-started)

Different use-cases are handled based on the content to convert and the way files are stored locally. More detailed
descriptions of folder structures for each use-case are provided below. The variables are:
* -i (input_folder): path to the folder to process.
* -c (input_category): granularity level of the input folder content within [cohort_patient, single_patient, single_timepoint, single_image]
* -s (input_structure): indication of the way the DICOM folders are structured on disk, to select from [sectra_cdmedia, manual]
* -o (output_folder): path to the folder where the results will be stored
* -m (conversion_method): method to use for the actual DICOM to Nifti conversion, to select from [dcm2niix, sitk]
* -v (verbose): amount of details to be printed in the console, to select from [debug, info, warning, error]
* -x (override): if content already existing should be removed and produced again

### [CLI](https://github.com/dbouget/neuro_dicom_parser#cli)

If the input is a folder for a single patient in SECTRA CD Media structure
```
neurodicomparser -i "/path/to/patient_folder" -c single_patient -s sectra_cdmedia -o "/path/to/destination_folder" (-v debug)
```

If the input is a folder for multiple patients with manual structure
```
neurodicomparser -i "/path/to/cohort_folder" -c cohort_patient -s manual -o "/path/to/destination_folder" (-v debug)
```

### [Python module](https://github.com/dbouget/neuro_dicom_parser#python-module)

```
from neurodicomparser.run import run_sectra_cdmedia, run_manual_structure
run_sectra_cdmedia(input_folder="/path/to/single_input_folder", input_category=single_patient, output_folder="/path/to/destination_folder")
run_manual_structure(input_folder="/path/to/cohort_input_folder", input_category=cohort_patient, output_folder="/path/to/destination_folder")
```

### [Docker CLI](https://github.com/dbouget/neuro_dicom_parser#docker-cli)
For launching the Docker image as a CLI, run the following, after replacing all with actual paths matching the files on your machine:

```
docker run -v :/workspace/resources -t -i --network=host --ipc=host --user $(id -u) dbouget/neurodicomparser:v1.0-py310-cpu -c /workspace/resources/ -c single_patient -s manual -o /workspace/resources/ -m dcm2niix -v debug
```

## [Expected folder structure](https://github.com/dbouget/neuro_dicom_parser#expected-folder-structure)

For now, only two folder structures are supported: either the raw SECTRA CD Media, or a custom manually-defined
structure. More options might be available in the future depending on use-cases.

### [SECTRA CD Media](https://github.com/dbouget/neuro_dicom_parser#sectra-cd-media)
When working with DICOM folders extracted from the PACS system as SECTRA CD Media, the following structure is expected
on disk.

└── path/to/sectra-cohort/
└── patient1/
├── CDViewer.zip
├── run_cdviewer.eze
├── DICOMDIR
├── [...]
├── DICOM/
│ ├── AB366595/
│ │ ├── 00002E47/
│ │ │ ├── ACFB2931/
│ │ │ │ ├── 0000C3D4/
│ │ │ │ │ ├── *.dcm
│ │ │ │ │ ├── [...]
│ │ │ │ │ ├── *.dcm
│ │ │ │ ├── 002033D4/
│ │ │ │ ├── [...]
│ │ │ │ └── 1E00C354/

### [Manual](https://github.com/dbouget/neuro_dicom_parser#manual)
When working with DICOM folders organized manually, the following structure is expected on disk.

└── path/to/manual-cohort/
└── patient1/
├── investigation1/
│ ├── dicom/
│ │ ├── acquisition1/
│ │ │ ├── *.dcm
│ │ │ ├── [...]
│ │ │ └── *.dcm
│ │ ├── acquisition2/
│ │ │ ├── *.dcm
│ │ │ ├── [...]
│ │ │ └── *.dcm
└── investigation2/
│ ├── dicom/
│ │ ├── acquisition1/
│ │ │ ├── *.dcm
│ │ │ ├── [...]
│ │ │ └── *.dcm
│ │ ├── acquisition2/
│ │ │ ├── *.dcm
│ │ │ ├── [...]
│ │ │ └── *.dcm
│ │ ├── [...]
│ │ ├── acquisitionX/
│ │ │ ├── *.dcm
│ │ │ ├── [...]
│ │ │ └── *.dcm