writeNIfTI() is fully compatible with FSLView

January 21, 2010

(This article was first published on dcemri, and kindly contributed to R-bloggers)

With the NIfTI-1 header extensions the world is your oyster.  We decided that one use for such a capability is to keep an audit trail of all operations performed on the image data volume.  This is a key feature in the dcemriS4 package.  There are three main components to a NIfTI-1 header extension: esize, ecode and edata.  At first we arbitrarily set ecode = 1002 and further developed the software.  Turns out, FSLView is quite strict about the numbers used in ecode and it failed to accept our NIfTI-1 header extensions saved from R.  Looking at the file nifti1_io.h, the following ecodes have been defined:

Advice from the FSL team (thanks: Matt Webster and Dave Flitney) was for us to use ecode = 6 (ASCII) since the audit trail is text in XML format.  Now one can produce an example data volume

We now have a file “img_nifti.nii.gz” that is available to us and using a utility in FSL we can investigate the attributes of this file

% $FSLDIR/bin/fslhd img_nifti | grep 'vox_offset'

vox_offset 1168

and reading the file back into R allows us to interrogate the ecode via its S4 slot

To leave a comment for the author, please follow the link and comment on their blog: dcemri.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)