xiangruili/dicm2nii

NIfTI conversion, visualization and transformation tools
20.3K Downloads
Updated 22 Feb 2023

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

Cite As

Xiangrui Li (2024). xiangruili/dicm2nii (https://github.com/xiangruili/dicm2nii/releases/tag/v2023.02.23), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2017a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Versions that use the GitHub default branch cannot be downloaded

Version Published Release Notes
2023.2.23.0

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

2022.03.06

update version

2018.08.08

1. use GetFullPath from Jan
2. accept mixture of files and folders as input
3. other fixes

2018.6.14.0

dicm2nii: implement 16-bit range scale (default off);
dicm_hdr: bug fix for insufficient bytes for search method; improvement for philips_par&xml
Switch to Github

2018.6.5.0

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.

2018.5.23.0

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.

2018.4.20.0

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

2018.3.9.0

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

2018.1.19.0

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.

2018.1.3.0

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

2017.12.29.0

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

2017.12.28.0

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.

2017.12.14.0

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.

2017.10.31.0

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

2017.9.27.0

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.

2017.8.3.0

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

2017.7.20.0

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.

2017.6.18.0

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

2017.3.22.0

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

2017.2.15.0

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.

2017.1.3.0

anonymize_dicm: replace PatientName with ID rather than scratching it.

2016.12.29.0

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.

2016.11.30.0

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.

2016.11.15.0

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.

2016.10.10.0

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.

2016.9.21.0

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

2016.9.20.0

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

2016.8.26.0

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.

2016.7.10.0

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

2016.6.10.0

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.

2016.6.1.0

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

2016.5.21.0

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

2016.5.16.0

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

2016.5.12.0

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.

2016.5.9.0

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

2016.5.6.0

Corrected version number

2016.5.5.0

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.

2016.3.24.0

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.

2016.1.31.0

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

2016.1.27.0

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

2016.1.15.0

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

2016.1.14.0

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.

2016.1.12.0

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

2016.1.5.0

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.

2015.11.28.0

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

2015.11.27.0

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

2015.11.22.0

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

2015.11.20.0

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.

2015.11.5.0

Bug fix for Show NIfTI hdr/ext

2015.11.4.0

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.

2015.9.26.0

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

1.44.0.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.

1.43.0.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

1.42.0.0

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

1.41.0.0

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

1.40.0.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.

1.39.0.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.

1.38.0.0

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

1.37.0.0

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

1.36.0.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.

1.34.0.0

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

1.33.0.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.

1.32.0.0

See previous update

1.31.0.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.

1.30.0.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.

1.29.0.0

Optional output argument for sort_dicm

1.28.0.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.

1.27.0.0

Take care of different carriage return issue in Philips PAR file

1.26.0.0

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

1.25.0.0

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

1.24.0.0

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

1.23.0.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.

1.22.0.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

1.21.0.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.

1.20.0.0

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

1.19.0.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;

1.18.0.0

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

1.17.0.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.

1.16.0.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.

1.15.0.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.

1.14.0.0

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

1.13.0.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.

1.12.0.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

1.11.0.0

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

1.10.0.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.

1.9.0.0

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

1.8.0.0

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

1.6.0.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.

1.5.0.0

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

1.4.0.0

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

1.3.0.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.

1.2.0.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.

1.1.0.0

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

1.0.0.0

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.