Package: nii2dcm
nii2dcmNIfTI to DICOM file creation with PythonExplore the docs »View Repo·Report Bug·Request FeatureOverviewDICOMis the international standard used to store, transfer and display medical images
in clinical institutions. It is a vast and complicated standard. TheNIfTIfile format is widely used within medical imaging
research because it is a comparatively simple data format, generally stripped of identifiable patient data and with far
fewer metadata fields.Researchers often convert DICOM files to NIfTI files using tools such asdcm2niix. However, the reverse process is much harder.nii2dcmis designed to convert a NIfTI file (.nii/.nii.gz) into a single-frame DICOM Series in one line, e.g.:nii2dcmnifti-file.nii.gzdicom-output-directory/--dicom-typeMR(back to top)InstallationTo install and run nii2dcm locally, you have two options:pipbuild from sourcepippipinstallnii2dcmbuild from sourceClone this repo:gitclonehttps://github.com/tomaroberts/nii2dcm.gitSetup a Python virtual environment (recommended):cdnii2dcm/
python-mvenvnii2dcm-venvsourcenii2dcm-venv/bin/activate
python-mpipinstall--upgradepipInstall dependencies and nii2dcm:pipinstallsetuptoolswheel
pipinstall-rrequirements.txt
pipinstall.Verify installation by displaying nii2dcm help informationnii2dcm-h(back to top)Usagenii2dcm is designed to be pointed at a single.niior.nii.gzfrom which it generates a single-frame DICOM dataset.It isrecommendedto specify the output DICOM modality using the-dor--dicom-typeflag (see examples below).
Without this, a generic DICOM is created without complete imaging modality metadata.DicomMRICreate an MRI 2D multi-slice DICOM dataset:nii2dcmnifti-file.nii.gzdicom-output-directory/-dMRDicomMRISVRCreate an MRI 3DSVRDICOM dataset:nii2dcmSVR-output.nii.gzdicom-output-directory/-dSVRDicomCreate a generic DICOM dataset:nii2dcmnifti-file.nii.gzdicom-output-directory/OtherEventually, nii2dcm will be extended to cover other imaging modalities including CT, Ultrasound, X-Ray, etc.(back to top)Reference DICOM metadata transferralThere are often situations where it can be useful to transfer information from an existing DICOM Study into a new DICOM
Series. For example, if you want to store your new DICOM dataset alongside your original DICOM Study.The-ror--ref-dicomflag attempts to transfer common DICOM attributes from a reference DICOM file into the
output DICOM:nii2dcmnifti-file.nii.gzdicom-output-directory/-dMR-rreference-dicom-file.dcmCurrently, attributes to transfer arelisted here in the DicomMRI class.(back to top)RoadmapThis project is in its infancy! Expect bugs :bug: :ant: :beetle:There are many things I would like to test and implement.Raise an Issueif you have ideas or suggestions.Developer NoteIf you would like to create another class of DICOM within nii2dcm, you can use the baseDicomMRIclass or theDicomMRISVRclass for inspiration. You
will also need to extend the command line interface to utilise your class, i.e.--dicom-type CT.Pleaseraise an Issueif you need developer support.(back to top)AcknowledgmentsSVRTK @ KCL- the original motivation for this projectChris Rorden for dcm2niix- inspiration for the reverse processNHS Topol Digital Fellowships scheme- for the protected time to work
on thishighdicom- beautiful and extensive Python library for various
tasks, including DICOM creationSimpleITK- comprehensive software including DICOM reading and writing(back to top)LinksSome useful, free image viewing software:ITK-Snap- fast, simple interface. Opens NIfTI and DICOMMITK Workbench- excellent for viewing
multiple image datasets in the same geometric space. Opens NIfTI and DICOM3D Slicer- comprehensive imaging softwareHoros- similar to a hospital clinical information system(back to top)DisclaimerThe Software has been developed for research purposes only and is not a clinical tool.LicenceBSD 3-Clause License can be found here(back to top)