Differences between revisions 1 and 2
Revision 1 as of 15:07:01 13-08-2012
Size: 3206
Comment: Local Merge - 'FslDev'
Revision 2 as of 13:49:40 25-11-2022
Size: 3210
Editor: PaulMcCarthy
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= NIFTI-1 Data Format and Orientation Conventions = = NIfTI-1/NIfTI-2 Data Format and Orientation Conventions =
Line 3: Line 3:
FSL now uses the new [[http://nifti.nimh.nih.gov/dfwg/|NIFTI-1]] data format by default, though it can still read and, in limited cases, write "old" Analyze files. The options are: FSL primarily uses the [[http://nifti.nimh.nih.gov/dfwg/|NIFTI-1]] data format by default. Some tools may still work with old ANALYZE files, but we are unable to offer any support for working with ANALYZE. In general, FSL tools can work with the following data formats:
Line 5: Line 5:
 * ANALYZE - traditional .hdr and .img file pair (header information and image data respectively) using the ANALYZETM 7.5 file format
 * ANALYZE_GZ - same but the files are written to disk already compressed using the gzip library (saves disk space)
 *
NIFTI_PAIR - the new NIFTI-1 format, still using a .hdr and .img file pair for each 3D/4D image
 * NIFTI - the NIFTI-1 format but in a single .nii file (which has the header information at the start of the file, followed by the image data)
 * NIFTI_GZ & NIFTI_PAIR_GZ - as above but with files written to disk already compressed.
 * `NIFTI_PAIR` - the NIFTI-1 format, using a .hdr and .img file pair for each 3D/4D image
 * `NIFTI` - the NIFTI-1 format but in a single .nii file (which has the header information at the start of the file, followed by the image data)
 * `NIFTI_GZ`, `NIFTI_PAIR_GZ` - as above but with files written to disk already compressed.
 * `NIFTI2`, `NIFTI2_GZ`, `NIFTI2_PAIR`, `NIFTI2_PAIR_GZ` - as above, but NIfTI-2 instead of NIfTI-1.
Line 11: Line 10:
By default, FSL programs use the NIFTI_GZ format, i.e. single-file NIFTI-1 compressed images. You control which NIFTI format FSL programs write using FSL setup files (see [[FslInstallation|downloading and installing]] for more details). By default, FSL programs use the `NIFTI_GZ` format, i.e. single-file NIFTI-1 compressed images. You control which NIFTI format FSL programs write using the `FSLOUTPUTTYPE` [[FslEnvironmentVariables|environment variable]].
Line 13: Line 12:
FSL can automatically read any of the above formats, regardless of what output type has been set. However, FSL programs will generally complain and quit if you have an input image present in more than one format - for example, fmridata.hdr/fmridata.img and fmridata.nii.gz present in the same directory. If you want to bypass this safety-checking you can set the environment variable FSLMULTIFILEQUIT to FALSE (see above on FSL setup files). FSL can automatically read any of the above formats, regardless of what output type has been set. However, FSL programs will generally complain and quit if you have an input image present in more than one format - for example, `fmridata.hdr`/`fmridata.img` and `fmridata.nii.gz` present in the same directory. If you want to bypass this safety-checking you can set the environment variable `FSLMULTIFILEQUIT` to `FALSE`.
Line 15: Line 14:
NIFTI allows the left-right orientation of your data to be specified in the file. This is separate from how it is displayed in FSLView. However, the FSLView labels should '''always''' be in the correct places. If they are wrong (or missing) then we suggest that the conversion to the NIfTI be investigated and fixed or a different method used such that the labels are correct. There is no point in continuing with any analysis if the initial labels are incorrect. Note that to distinguish left from right just by looking at the image is normally impossible and would require a marker (e.g. a vitamin capsule) to be present when acquiring the images. NIfTI allows the left-right orientation of your data to be specified in the file. This is separate from how it is displayed in FSLeyes. However, the FSLeyes labels should '''always''' be in the correct places. If they are wrong (or missing) then we suggest that the conversion to the NIfTI be investigated and fixed or a different method used such that the labels are correct. There is no point in continuing with any analysis if the initial labels are incorrect. Note that to distinguish left from right just by looking at the image is normally impossible and would require a marker (e.g. a vitamin capsule) to be present when acquiring the images.
Line 17: Line 16:
The data stored on disk (in the NIfTI file) can be in either "radiological" or "neurological" order, depending on information stored in the qform and sform fields of the NIfTI header. It is no longer necessary to be concerned what this order is. All FSL tools will work regardless of the order. The data stored on disk (in the NIfTI file) can be in either "radiological" or "neurological" order, depending on information stored in the qform and sform fields of the NIfTI header. It is rarely necessary to be concerned with what this order is. All FSL tools will work regardless of the order, as long as the orientation labels of your image are correct when viewed in FSLeyes.
Line 19: Line 18:
Analyze images are treated as radiologically ordered in FSL but '''should be avoided''' whenever possible as they do not allow proper orientation information to be stored. ANALYZE images are treated as radiologically ordered in FSL but '''should be avoided''' whenever possible as they do not allow proper orientation information to be stored.
Line 21: Line 20:
FSLView always displays images in radiological convention when possible. FSLeyes defaults to displaying images in radiological convention when possible.
Line 29: Line 28:
fslcpgeom can be used to copy this info (plus voxel dims) from one image to another. `fslcpgeom` can be used to copy this info (plus voxel dims) from one image to another.

NIfTI-1/NIfTI-2 Data Format and Orientation Conventions

FSL primarily uses the NIFTI-1 data format by default. Some tools may still work with old ANALYZE files, but we are unable to offer any support for working with ANALYZE. In general, FSL tools can work with the following data formats:

  • NIFTI_PAIR - the NIFTI-1 format, using a .hdr and .img file pair for each 3D/4D image

  • NIFTI - the NIFTI-1 format but in a single .nii file (which has the header information at the start of the file, followed by the image data)

  • NIFTI_GZ, NIFTI_PAIR_GZ - as above but with files written to disk already compressed.

  • NIFTI2, NIFTI2_GZ, NIFTI2_PAIR, NIFTI2_PAIR_GZ - as above, but NIfTI-2 instead of NIfTI-1.

By default, FSL programs use the NIFTI_GZ format, i.e. single-file NIFTI-1 compressed images. You control which NIFTI format FSL programs write using the FSLOUTPUTTYPE environment variable.

FSL can automatically read any of the above formats, regardless of what output type has been set. However, FSL programs will generally complain and quit if you have an input image present in more than one format - for example, fmridata.hdr/fmridata.img and fmridata.nii.gz present in the same directory. If you want to bypass this safety-checking you can set the environment variable FSLMULTIFILEQUIT to FALSE.

NIfTI allows the left-right orientation of your data to be specified in the file. This is separate from how it is displayed in FSLeyes. However, the FSLeyes labels should always be in the correct places. If they are wrong (or missing) then we suggest that the conversion to the NIfTI be investigated and fixed or a different method used such that the labels are correct. There is no point in continuing with any analysis if the initial labels are incorrect. Note that to distinguish left from right just by looking at the image is normally impossible and would require a marker (e.g. a vitamin capsule) to be present when acquiring the images.

The data stored on disk (in the NIfTI file) can be in either "radiological" or "neurological" order, depending on information stored in the qform and sform fields of the NIfTI header. It is rarely necessary to be concerned with what this order is. All FSL tools will work regardless of the order, as long as the orientation labels of your image are correct when viewed in FSLeyes.

ANALYZE images are treated as radiologically ordered in FSL but should be avoided whenever possible as they do not allow proper orientation information to be stored.

FSLeyes defaults to displaying images in radiological convention when possible.

NIFTI "sform" information (when present) is copied from the reference image when using Flirt to calculate or apply a registration.

NIFTI "qform" information (should be) transformed from the input image and not copied from the reference image.

All other programs should preserve the sform and qform information (or arbitrarily take it from one input if it is a process that combines many inputs)

fslcpgeom can be used to copy this info (plus voxel dims) from one image to another.

 

Formats (last edited 13:49:40 25-11-2022 by PaulMcCarthy)