xiangruili/dicm2nii

NIfTI conversion, visualization and transformation tools

https://github.com/xiangruili/dicm2nii

Download
Download

You are now following this Submission

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Cite As

Xiangrui Li (2026). xiangruili/dicm2nii (https://github.com/xiangruili/dicm2nii/releases/tag/v2026.03.19), GitHub. Retrieved .

Acknowledgements

Inspired: MRIqual, DICOM to any Image Format Converter

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
2026.3.19

See release notes for this release on GitHub: https://github.com/xiangruili/dicm2nii/releases/tag/v2026.03.19

Download
2018.6.5

1. dicm_hdr: can read Philips xml file; many improvements for PAR dealing
2. dicm2nii: can deal with incomplete volume for Philips PAR/XML/DICOM;
better dealing for different complex image types.

Download
2018.5.23

dicm2nii: take care of some special Philips cases:
1. store VolumeTiming from FrameReferenceTime, seen in pet data;
2. bug fix to remove Philips DTI ADC vol;
3. switch to floating value for rescale.

Download
2018.4.20

1. dicm2nii: bug fix for long file name
2. some minor fix.

Download
2018.3.9

nii_viewer:
1. check NIfTI struct in workspace when adding overlay
2. Implement 'Standard deviation' like for 'time course'.
dicm_hdr->philips_par: bug fix for wrong slice flip; work for incomplete volume

Download
2018.1.19

1. nii_viewer: map inflated surface click to correct location in volume, even for old matlab
2. dicm2nii: bug fix for fieldmap TEs
3. other minor fixes and improvement.

Download
2018.1.3

nii_viewer: support inflated surface to volume mapping. Tested only for HCP surfaces.

Download
2017.12.29

surface view uses combined overlay, so it works smoothly for different environment.

Download
2017.12.28

1. nii_viewer: implement surface view for CIfTI (HCP gii template included).
2. dicm_hdr: bug fix for possible slice flip in Philips PAR. Thx ShereifH.

Download
2017.12.14

1. dicm2ii: work for Siemens multiframe dicom.
2. nii_viewer: try to convert back to volume to visualize CIfTI.
3. dicm_img: bug fix for compressed dicom without offset table.

Download
2017.10.31

1. nii_view: two more layout including compact one-row display
2. other minor improvement and fix

Download
2017.9.27

1. Save VolumeTiming for missing volumes based on BIDS;
2. Correct Siemens readout time;
3. Use GE SLICEORDER if RTIA_timer not available;
4. Always store TE and readout for distortion correction.

Download
2017.8.3

1. Bug fix for reading Philips PAR file;
2. Better tab auto-completion.

Download
2017.7.20

1. Add functionSignatures.json file for tab auto-completion;
2. Allow regularly missing InstanceNumbers, like dicom from CMRR for auditory study;
3. Try to take care of GitHub download, so prepare for GitHub hosting.

Download
2017.6.18

1. dicm2nii & nii_viewer: can read big-endian AFNI image;
2. dicm2nii: set multiband slice_code to 0 to avoid FreeSurfer error;
3. Users need to manually download once to fix package update from GUI;
4. nii_viewer: improved Ctrl-drop to add overlay

Download
2017.3.22

1. dicm2nii: better precision requirement for ImagePositionPatient;
2. dicm2nii: bug fix for mixed MAG/PHASE multi-frame dicom with >2 volumes.

Download
2017.2.15

1. nii_viewer: Can open DICOM etc files by converting into NIfTI without saving, allowing to view image from one or more files without converting.
2. dicm2nii: can convert FreeSurfer mgh/mgz files into NIfTI.
3. other fixes and improvement.

Download
2017.1.3

anonymize_dicm: replace PatientName with ID rather than scratching it.

Download
2016.12.29

1. nii_moco: new implementation to perform motion correction;
2. anonymize_dicm: new implementation to remove Patient Name in dicom files;
3. dicm2nii: transform CT image with gantry tilt;
4. other minor improvement and fix.

Download
2016.11.30

1. dicm2nii: fix for irregular image order in Philips multi-frame dicom;
2. dicm_hdr: avoid error due to missing value for a tag;
3. other minor improvements.

Download
2016.11.15

1. nii_viewer: allow to manually remove excessive neck tissue;
2. nii_viewer: better overlay treatment for Analyze files;
3. nii_tool: fast hdr/ext read for gz file by memory gunzip;
4. minor improvement here and there.

Download
2016.10.10

1. nii_viewer: implement warped overlay;
2. nii_viewer: implement “Save volume as”;
3. dicm_hdr: fix problem for some Philips PAR file;
4. Other minor fixes.

Download
2016.9.21

dicm2nii: fix bug introduced by update hours ago (slope/intercept wrongly applied to files expect 1st).

Download
2016.9.20

1. dicm2nii: Add preferences to GUI
2. dicm2nii: Convert series with inconsistent Rescale slope or intercept
3. other minor fixes and improvement

Download
2016.8.26

1. dicm2nii: add pref to allow to not use SeriesInstanceUID;
2. nii_viewer: option to load single volume for large dataset;
3. dicm_hdr: can read dicom without PixelData;
4. other minor fixes and improvement.

Download
2016.7.10

nii_viewer: file list GUI improvement; implement histogram plot and sphere ROI creation.
Other minor fix and improvement.

Download
2016.6.10

nii_viewer: add 'RGB' LUT so 3-volume image can be in RGB;
dicm2nii: avoid skipping series due to empty-PixedlData junk dicom;
allow setpref to not save PatientName and not use parfor;
Other minor fixes.

Download
2016.6.1

dicm2nii: always save ReadoutSeconds for topup;
nii_viewer: implement image center of gravity display;
Other minor fixes and improvements.

Download
2016.5.21

nii_stc: new file for nifti slice timing correction.
dicm_img: try to support files with BitsStored~=HighBit+1.
dicm2nii & nii_viewer: minor fixes.

Download
2016.5.16

dicm2nii: big fix for error due to missing file(s).

Download
2016.5.12

dicm2nii:
1. GE bvec sign correction for sag/cor acquisition;
2. Avoid error due to missing info in Siemens B15 CSASeriesHeaderInfo.
nii_viewer:
Bug fix for zoom in/out by key press.

Download
2016.5.9

nii_viewer: Update phase LUTs to three; Add "Open in new window"

Download
2016.5.6

Corrected version number

Download
2016.5.5

dicm2nii: better mosaic detection for old/bad data; Convert MoCo series by default.
nii_viewer: added two LUT for complex data: useful for retinotopy.
dicm_hdr: performance tweaks: almost 100% improvement.
Many minor fixes and improvements.

Download
2016.3.24

1. dicm2nii: Fix Siemens mosaic detection for rare cases.
2. nii_viewer: Allow background image to move in stack;
Remove some restriction for DTI vector lines.
3. Some minor fixes.

Download
2016.1.31

1. nii_viewer: bug fix for messed-up callback in set_file;
2. some minor improvement.

Download
2016.1.27

1. dicm2nii: support big endian dicom files;
2. other minor fixes.

Download
2016.1.15

check update: fix the problem to download into current directory.

Download
2016.1.14

1. nii_viewer: implement time course plot;
2. nii_viewer: fix hanging problem for some Matlab versions due to invisible figure;
3. dicm_img: bug fix for not casting bytes into double.

Download
2016.1.12

1. Implement update check from dicm2nii and nii_viewer GUI;
2. Use matlab pref method for dicm2nii, nii_tool and nii_viewer;
3. dicm2nii: fix for files missing SeriesInstanceUID;
4. nii_viewer: some improvement and bug fix. Faster display

Download
2016.1.5

Fixes and improvements for dicm2nii, nii_tool, and mostly for nii_viewer:
1. Friendly file list GUI;
2. add overlay by Ctrl drag&drop;
3. modulated image display;
4. ROI label display, such as AAL;
5. more LUT options, including custom LUT.

Download
2015.11.28

nii_viewer: bug fix introduced in previous update (reorient problem)

Download
2015.11.27

nii_viewer:
1. avoid error for white background under Linux;
2. bug fix for alpha and case of unmatched s/qform.

Download
2015.11.22

nii_viewer fix and improvement:
1. bug fix for nii with sform=0;
2. Add "Show NIfTI essentials";
3. better effect for white backgroun.

Download
2015.11.20

1. dicm2nii: GUI supports drag and drop of folder/files; optionally save JSON file;
2. nii_tool: partial gz unzip makes hdr only read much faster;
3. nii_viewer: Key navigation and zoom implemented; allow L/R flip, white background and more.

Download
2015.11.5

Bug fix for Show NIfTI hdr/ext

Download
2015.11.4

1. Implement nii_viewer.m for nii visualization;
2. Add file nii_xform to resample/transform nii image;
3. Some minor improvement for dicm2nii, nii_tool etc;
4. Include dndcontrol by Maarten van der Seijs.

Download
2015.9.26

1. Take care irregular slice ordering for PAR/REC and multiframe dicom;
2. Bug fix for case of nSlices = 1;
3. Other minor fixes.

Download
1.44.0

1. nii_tool: auto detects RGB style for image reading;
2. try to fix slice timing for some multiband data;
3. some other minor fixes.

Download
1.43.0

Major: Store text NIfTI extension for information, like DTI bval/bvec, slice timing, unwarp parameters etc
Minor: more missing files check and some minor fixes and improvements

Download
1.42.0

Do not store ecode=40 NIfTI extension due to possible problem with FSL

Download
1.41.0

Fix problems with latest Matlab versions: uint32 figure handle and parpool.

Download
1.40.0

1. Can convert BrainVoyager files into NIfTI;
2. Bug fix for phaseDir for Philips data;
3. nii_tool allows to set default NIfTI version and RGB style;
4. Other minor fix and improvement.

Download
1.39.0

1. Works multi subject/study data;
2. Won't skip derived data, such as those from GLM/DTI;
3. Transformation takes care of possible shear at slice direction;
4. Many minor improvement.

Download
1.38.0

1. Bug fix for phase encoding direction;
2. Improved DTI bvec sign treatment;
3. Many minor fixes and improvements.

Download
1.37.0

1. dicm2nii can save SPM style NIfTI;
2. nii_tool can convert between 3D and 4D NIfTI;
3. many other fixes and improvements.

Download
1.36.0

1. Include new file nii_tool.m, which can read/write almost any datatype of NIfTI files with different versions;
2. dicm_img returns the same as dicomread by default (transposed img);
3. Include pigz for Windows and Linux for fast gz (de)compression.

Download
1.34.0

1. Fix error for multiframe dicom with single frame;
2. Make number of slices detection more reliable;
3. Other minor improvements.

Download
1.33.0

1. Use ImagePositionPatient to derive SliceThickness if possible;
2. Override number of slices in dicom header with unique ImagePositionPatient;
3. Add RescaleIntercept and RescaleSlope consistency check.

Download
1.32.0

See previous update

Download
1.31.0

1. Use parallel tool if available and worthy;
2. First tested version for Octave 3.8.1(GUI not working);
3. Some minor fixes.

Download
1.30.0

1. bug fix for missing number of slices in GE multiframe dicom;
2. sort_dicm takes care of multiple StudyID;
3. minor improvements on dicm2nii, dicm_hdr and dicm_dict.

Download
1.29.0

Optional output argument for sort_dicm

Download
1.28.0

1. Include new file sort_dicm, which sorts files for different subjects into sub-folders;
2. Remember the GUI setting from last conversion;
3. Other minor improvements.

Download
1.27.0

Take care of different carriage return issue in Philips PAR file

Download
1.26.0

1. Take care of missing VR by some 3rd party dicom converter;
2. some minor improvements.

Download
1.25.0

1. Fix the problem caused by PAR 4.2 keyword case change;
2. Ignore PAR file extension case.

Download
1.24.0

1. can deal with compressed tgz, tar file
2. some minor fixes

Download
1.23.0

1. Take care of non-unique ixyz;
2. Bug fix for slice_code for interleaved descending;
3. Bug fix for GE interleaved file order;
4. Store readout for DTI.

Download
1.22.0

1. Image storage change to make DTI data work for FSL 5.05 and later
2. Change phase direction in image space for FSL
3. Use ProtocolName for Siemens data
4. GE data: can get phase direction for later version; take care of interleaved numbering

Download
1.21.0

1. Fix to work for new GE data, including DTI;
2. Improved multi-subject data conversion;
3. Better file name for GE/Philips data;
4. Many minor fix and improvement.

Download
1.20.0

Not set cal_min and cal_max anymore, so avoid display range problem.

Download
1.19.0

1. Store FSL slice timing in dcmHeaders.mat;
2. Implement slice timing for multiband dicom;
3. Bug fix for slice order for some GE data;
4. Other minor improvements;

Download
1.18.0

1. bug fix for MoCo series detection;
2. bug fix in rename_dicm: missing Manufacturer

Download
1.17.0

1. Support dicom without meta info;
2. Bug fix for gzip.m detection;
3. Fix problem with ~ as home folder;
4. Improvement for error info file.

Download
1.16.0

Majors:
1. skip missing file check;
2. Allow missing files at the beginning of a series.
Minors:
1. Bug fix for DTI parameter parsing;
2. Also save error info into a file;
3. Other minor improvements.

Download
1.15.0

1. Bug fix and improvement for DTI parameters.
2. Deal Philip multi-frame B0 map correctly.
3. Great speed improvement for multi-frame dicom.

Download
1.14.0

1. Implement conversion for AFNI HEAD/BRIK files.
2. Bug fixes for dealing with current folder as src folder etc.

Download
1.13.0

1. Minor improvement for dicm_hdr: read V4.1 PAR file correctly;
2. Make some MRI parameter non-mandatory, so may work for other modality.

Download
1.12.0

1. Support implicit VR dicom;
2. Make dicm_hdr, dicm_img and dicm_dict available to users by extracting them from dicm2nii. Add rename_dicm.
3. Improve dicm_hdr

Download
1.11.0

1. First working version for Philips multiframe dicom
2. Some tweaks to dicm_hdr
3. Minor bug fixes

Download
1.10.0

1. Works for Siemens non-mosaic DTI data too.
2. Make xform matrix robust, aiming to work for Philips single dicom file (no data for test though).
3. dicm_hdr can decode SQ now.
4. Avoid fullfile, since it doesn't accept cellstr in older Matlab.

Download
1.9.0

Major: first implementation for conversion of GE and Philips data.
Minor: remove dependency on normc, etc.

Download
1.8.0

Bug fix for DTI bval/bvec files introduced in last update

Download
1.6.0

1. Try and suggest to use pigz for gz compression
2. Fix the missing-field error for DTI data with more that one excitations.
3. Protect GUI from command line plotting.

Download
1.5.0

A bug fix for '*' input, and some minor improvement for dicom header reading

Download
1.4.0

Some SPM users may not have Imaging Processing Toolbox. This update removed this dependency. This also speeds up the dicom header parsing.

Download
1.3.0

1. File name is changed from dcm2nii.m to dicm2nii.m. This will avoid confusion with MRICron's dcm2nii converter.
2. GUI is implemented.
3. Bug fix for cellstr input for multiple files.

Download
1.2.0

1. Allow to specify a subjectID for nii;
2. Accept more input source options, like 1 or more dicom files, or wildcard like run1*.dcm;
3. Include related NIfTI toolbox code in the m file for easy distribution.

Download
1.1.0

Some minor improvement for the code. Add a line for usage.

Download
1.0.0

Download
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.