NIfTI: Difference between revisions

From VrlWiki
Jump to navigation Jump to search
Jadrian Miles (talk | contribs)
Jadrian Miles (talk | contribs)
No edit summary
Line 1: Line 1:
Files ending in <tt>'''.nii'''</tt> are in the [http://nifti.nimh.nih.gov/nifti-1 NIfTI medical image format]; it is becoming a standard export format for many different software packages, including [http://www.fmrib.ox.ac.uk/fsl/ FSL].  <tt>.nii</tt> files combine the metadata header and image data into a single file, but NIfTI-1 is a modified form of Analyze 7.5, so it sometimes comes in <tt>'''.hdr'''</tt>/<tt>'''.img'''</tt> pairs.  The NIfTI I/O library and command line tools also directly handle compressed NIfTI, with the extension <tt>'''.nii.gz'''</tt>.  You can test for the format by using the <code>is_nifti_file()</code> function in the I/O library.
Files ending in <tt>'''.nii'''</tt> are in the [http://nifti.nimh.nih.gov/nifti-1 NIfTI medical image format]; it is becoming a standard export format for many different software packages, including [http://www.fmrib.ox.ac.uk/fsl/ FSL].  <tt>.nii</tt> files combine the metadata header and image data into a single file, but NIfTI-1 is a modified form of Analyze 7.5, so it sometimes comes in <tt>'''.hdr'''</tt>/<tt>'''.img'''</tt> pairs.  The NIfTI I/O library and command line tools also directly handle compressed NIfTI, with the extension <tt>'''.nii.gz'''</tt>.  You can test for the format by using the <code>is_nifti_file()</code> function in the I/O library.


=Paths=
== Paths ==
<code>$G/src/nifti</code> is the source code for the NIfTI I/O library, which installs to <code>$G/lib/nifti</code> and <code>$G/include/nifti</code>.
<code>$G/src/nifti</code> is the source code for the NIfTI I/O library, which installs to <code>$G/lib/nifti</code> and <code>$G/include/nifti</code>.


=Use=
== Use ==
=== Library ===
To use the NIfTI I/O library, simply <code>#include <nifti1_io.h></code> in your code and add the following to the library list in your makefile: <code>niftiio znz m z</code>.
To use the NIfTI I/O library, simply <code>#include <nifti1_io.h></code> in your code and add the following to the library list in your makefile: <code>niftiio znz m z</code>.


<code>$G/src/nifti2mriimage/nifti2mriimage.cpp</code> demonstrates reading the header and extracting information from it, as well as reading the image data.
<code>$G/src/nifti2mriimage/nifti2mriimage.cpp</code> demonstrates reading the header and extracting information from it, as well as reading the image data.


From the command line or shell scripts, the <code>nifti_tool</code> utility is pretty powerful and can read the header in a structured way.
=== Command-Line Utilities ===
The <code>nifti_tool</code> utility can read the header in a structured way and print out tons of metadata, as well as manipulating the actual data and doing a lot more.  It's a good way to explore new data before deciding how to script with it.


=Documentation=
=== Format Conversion ===
 
<code>$G/bin/nifti2mriimage</code> converts to MRIimage.
 
== Documentation ==
<code>make install</code> puts some documentation in <code>$G/doc/nifti</code>.  However, the online documentation for NIfTI is probably even better and more useful:
<code>make install</code> puts some documentation in <code>$G/doc/nifti</code>.  However, the online documentation for NIfTI is probably even better and more useful:
* [http://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/ NIfTI-1 Header Field Description]
* [http://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/ NIfTI-1 Header Field Description]
* [http://nifti.nimh.nih.gov/nifti-1/documentation/faq NIfTI FAQ]
* [http://nifti.nimh.nih.gov/nifti-1/documentation/faq NIfTI FAQ]


=History=
== History ==
The format was created by the [http://nifti.nimh.nih.gov Neuroimaging Informatics Technology Initiative] at NIH.  It is a superset of Analyze 7.5, re-purposing empty fields in the Analyze format to support more features.  Fortunately for us, the NIfTI reference library is available in the public domain, and <code>$G/src/nifti</code> is set up to download the latest version (with <code>make download</code>), build it, and install it.  NIfTI is an actively developed format, but the NIfTI-1 specification is fixed; NIfTI-2 will be formulated and released at some point in the future.
The format was created by the [http://nifti.nimh.nih.gov Neuroimaging Informatics Technology Initiative] at NIH.  It is a superset of Analyze 7.5, re-purposing empty fields in the Analyze format to support more features.  Fortunately for us, the NIfTI reference library is available in the public domain, and <code>$G/src/nifti</code> is set up to download the latest version (with <code>make download</code>), build it, and install it.  NIfTI is an actively developed format, but the NIfTI-1 specification is fixed; NIfTI-2 will be formulated and released at some point in the future.

Revision as of 20:56, 21 August 2008

Files ending in .nii are in the NIfTI medical image format; it is becoming a standard export format for many different software packages, including FSL. .nii files combine the metadata header and image data into a single file, but NIfTI-1 is a modified form of Analyze 7.5, so it sometimes comes in .hdr/.img pairs. The NIfTI I/O library and command line tools also directly handle compressed NIfTI, with the extension .nii.gz. You can test for the format by using the is_nifti_file() function in the I/O library.

Paths

$G/src/nifti is the source code for the NIfTI I/O library, which installs to $G/lib/nifti and $G/include/nifti.

Use

Library

To use the NIfTI I/O library, simply #include <nifti1_io.h> in your code and add the following to the library list in your makefile: niftiio znz m z.

$G/src/nifti2mriimage/nifti2mriimage.cpp demonstrates reading the header and extracting information from it, as well as reading the image data.

Command-Line Utilities

The nifti_tool utility can read the header in a structured way and print out tons of metadata, as well as manipulating the actual data and doing a lot more. It's a good way to explore new data before deciding how to script with it.

Format Conversion

$G/bin/nifti2mriimage converts to MRIimage.

Documentation

make install puts some documentation in $G/doc/nifti. However, the online documentation for NIfTI is probably even better and more useful:

History

The format was created by the Neuroimaging Informatics Technology Initiative at NIH. It is a superset of Analyze 7.5, re-purposing empty fields in the Analyze format to support more features. Fortunately for us, the NIfTI reference library is available in the public domain, and $G/src/nifti is set up to download the latest version (with make download), build it, and install it. NIfTI is an actively developed format, but the NIfTI-1 specification is fixed; NIfTI-2 will be formulated and released at some point in the future.