GoNifti is a Python-based tool that allows users to convert DICOM images to Nifti format, either through a graphical user interface (GUI) or a command-line interface (CLI).
To use GoNifti, the input data must be in a specific format: each subfolder can contain only one MR sequence and the DICOM files must have the ".dcm" file extension. If the input data does not meet these requirements, a tool such as DicomTranslator can be used to preprocess the data.
- Python 3.10
- PyQt5
- Nibabel
- Numpy
- Pydicom
- Click
- Clone the GitHub repository to your computer
git clone https://github.com/ludgerradke/GoNifti- Install the required dependencies
pip install PyQt5 nibabel numpy pydicom click- Start the application by running the GoNiftiGUI.py script.
python GoNiftiGUI.py-
Select the root folder that contains the DICOM images to be converted.
-
Select the desired conversion mode:
save_in_separate_dir: The converted Nifti images will be saved in a separate folder that is located in the same parent folder as the root folder and has the name of the root folder with the suffix "_as_nifti".save_in_folder: The converted Nifti images will be saved in the same folder as the DICOM images and have the name "nifti.nii.gz".save_in_exam_date: The converted Nifti images will be saved in the same folder as the DICOM images and have the same filename extension as Nifti.
- Click the "Convert" button.
- After the conversion is complete, a message will be displayed indicating that the transformation is complete.
$ python .\GoNifti.py --help
Usage: GoNifti.py [OPTIONS] ROOT_FOLDER
Options:
--mode [save_in_separate_dir|save_in_folder|save_in_exam_date]
--cpus [1|2|3|4|5|6|7|8|9|10|11|12]
--out_dtype [int32|float32|float64]
--help Show this message and exit.$ python .\GoNifti.py <path>
Found 161 DICOM folders.
Converting DICOM to NIFTI [####################################] 100%
Transformation completed.- Open a terminal and navigate to the project directory.
- Run the CLI script by using the command
pathon gonifti [ROOT_FOLDER] --mode [MODE] --cpus [CPUS], whereROOT_FOLDERis the path to the folder containing the DICOM images to be converted,MODEis the desired conversion mode (save_in_separate_dir, save_in_folder, or save_in_exam_date), andCPUSis the number of CPUs to use for the conversion process (default is 1). - After the conversion is complete, a message will be displayed indicating that the transformation is complete.
For example, to convert DICOM images in the folder /path/to/dicom/folder using the save_in_separate_dir conversion mode and 4 CPUs, you would run the following command:
python gonifti.py /path/to/dicom/folder --mode save_in_separate_dir --cpus 4This project is licensed under the GNU 3.0 license and contributions are welcome.
The project also includes a compiled executable version of the program in the dist folder, which can be used without the need for installing any dependencies or having Python installed on the system.
