= NIfTI-1/NIfTI-2 Data Format and Orientation Conventions = 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: * `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` [[FslEnvironmentVariables|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.