Home

Awesome

About

i2nii converts several scientific and medical imaging formats to the popular NIfTI format. NIfTI is used by many neuroimaging tools including FSL, SPM, and AFNI. Note that this tool will not convert images from DICOM format, though the companion dcm2niix will. Likewise, it will not convert TIFF or many microscopy formats, though the Bio-Formats module of ImageJ/Fiji can convert these.

i2nii shares the image reading functions of the MRIcroGL viewer. If you prefer a drag-and-drop graphical user interface, you should use MRIcroGL. In contrast, i2nii is designed to be used from the command line. Compiled excutables are provided for Linux, MacOS and Windows. The source code should compile on a wide range of operating systems.

Installation

You can get i2nii using two methods:

Usage

Chris Rorden's i2nii v1.0.20191007
usage: i2nii [options] <in_file(s)>
 Options :
 -h : show help
 -o : output directory (omit to save to input folder)
 -r : rotation (l/r/n, LAS/RAS/native default n)
       caution: rotation can disrupt slice time correction
 -z : gz compress images (y/n, default n)
 Examples :
  i2nii -z y ecat.v
  i2nii img1.pic img2.pic
  i2nii -o ~/out "spaces in name.bvox"
  i2nii ./test/sivic.idf
  i2nii -o "~/my out" "input.nrrd"

Limitations

This software is provided as is. There are clear limitations.

Note that the -r option allows you to specify whether the raw data is stored in native, LAS, or RAS. If rotation is requested, the voxel data is copied losslessly. The image dimensions are permuted and flipped to the orthogonal orientation that best matches the desired storage order. For oblique acquisitions (where the slice angulation is not orthogonal to the scanner bore), the residual rotation is stored in the NIfTI SForm and QForm. Therefore, for software that uses the SForm and QForm information, each of these storage orientations is identical. The pupose of these commands is for simple tools that require specified spatial storage. A limitation of this option is that many supported image formats do not record spatial orientation (as reported in the previous paragraph).

Compiling

It is generally recommended that download a pre-compiled executable (see previous section). However, you can compile your own copy from source code.

fpc i2nii
./i2nii -o ./test/afni.BRIK+orig.BRIK
./i2nii ./test/mgh.mgz 
./i2nii ./test/mha.mha 
./i2nii ./test/nrrd.nhdr
./i2nii -o ./test/sivic.idf
./i2nii ./test/spr.spr
./i2nii ./test/vtk.vtk

Supported Image Formats

i2nii should automatically detect and convert the following image formats. Be aware that not all these formats have spatial transformations. Further, support for all features of these formats may be incomplete.

If your image format is not supported directly by MRIcroGL, you may want to see if it is supported by the Bio-Formats module of ImageJ/Fiji. If so, you can open the image with the module and save it as NIfTI or NRRD to read it with MRIcroGL.