Skip to content

A straightforward Python tool for converting 3D NIfTI images into DICOM slices, intentionally kept simple for easy adaptation

License

Notifications You must be signed in to change notification settings

ml-workgroup/nifti_to_dicom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

3D NIfTI to DICOM Converter

This repository provides a Python function that converts 3D NIfTI medical images into a series of DICOM slices. The code is intentionally kept straightforward and minimal so you can easily adapt it to your own needs and pipelines.

Table of Contents

  1. Features
  2. Requirements
  3. Example
  4. License

Features

  • NIfTI to DICOM Conversion: Converts 3D volume data from NIfTI (.nii, .nii.gz) format to standard DICOM files.
  • Lightweight and Adaptable: The code is kept simple for easy customization—perfect for research or clinical prototyping.
  • GPL License: Distributed under the GNU General Public License (GPL), ensuring the freedom to modify and redistribute.

Requirements


Example

Below is a minimal example demonstrating how to convert a NIfTI file named input_image.nii.gz into multiple DICOM slices in a folder called dicom_output:

import nibabel as nib
from nifti_to_dicom import nifti_3d_to_dicom

# Load NIfTI
nifti_img = nib.load("input_image.nii.gz")

# Convert and save to DICOM
nifti_3d_to_dicom(
    nifti_img=nifti_img,
    output_folder="dicom_output",
    PatientName="JohnDoe",
    PatientID="12345678",
    Modality="CT",
    SeriesDescription="Simple CT Example",
    StudyDescription="Demo Study",
    SeriesNumber=1
)

License

This project is licensed under the GNU General Public License 3.0 (GPL) by
Dr. med. Hinrich Winther, Machine Learning Work Group, Institute of Diagnostic and Interventional Radiology, Hannover Medical School.

You are free to copy, modify, and distribute this software with the same license.

About

A straightforward Python tool for converting 3D NIfTI images into DICOM slices, intentionally kept simple for easy adaptation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages