
Where x is the stored voxel value and y is the true value. NIFTIs use these fields in the following way: However, before we proceed, if you’ve already glanced at the fields stored in the NIFTI header, you’ve probably noticed there are two called scl_slope and scl_inter. To begin, add nifti_utils to the path and load both NIFTIs with load_untouch_nii():ī0_1_nii = load_untouch_nii('b0_1.nii.gz') ī0_2_nii = load_untouch_nii('b0_2.nii.gz') These data sets are simply two b0 images (non-diffusion weighted epi images) with different storage orientations. We’ll begin with two different NIFTIs, b0_1.nii.gz and b0_2.nii.gz. We’ll start from there and then use other more complex functions that help serve our specific purposes. There’s no reorientation or data scaling or any other sort of magic under the hood. This function will load the NIFTI exactly as it’s stored. nifti_utils is essentially built around the load_untouch_nii() function from this library. This is actually an extension to Tools for NIfTI and ANALYZE image.
#Niftiwrite matlab 2012 download#
fMRI), but they are not discussed here.įirstly, download nifti_utils. There are some other fields specific to certain modalities (i.e.

#Niftiwrite matlab 2012 how to#
In this article, I’ll simply discuss how the orientation is stored in the header and how to use it, as well as a couple other fields which are important to properly using and manipulating the data. There’s more information here, here, and here about the specifics of what’s contained in the header. Technically, it’s a file containing a 348 byte header followed by image data. It’s essentially: a file containing a 3D array with an associated orientation. The purpose of this article is to give a high-level introduction to “get you going”. This post will discuss the NIFTI-1 format and how to work with these files in MATLAB.
