Skip to content

Julia module for reading/writing NIfTI MRI files

License

Notifications You must be signed in to change notification settings

avmi/NIfTI.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NIfTI.jl

Build Status

Usage

To read a NIfTI file:

using NIfTI
ni = niread("my.nii")
ni = niread("my.nii.gz") # gzipped NIfTI files are detected automatically

The header is in nii.header; NIfTI extensions are in nii.extensions; the raw volume is in nii.raw.

To mmap the NIfTI file:

ni = niread("my.nii", mmap=true)

To get the TR and voxel size:

vsize = voxel_size(ni.header)    # In mm
tr = time_step(ni.header)        # In ms

To get the value of the volume along a given dimension:

d = vox(ni, x, y, z, t)       # Scaled by slope and intercept given in header, zero-based indexes
d = ni[x, y, z, t]            # Scaled by slope and intercept given in header, one-based indexes
d = ni.raw[x, y, z, t]        # Unscaled, one-based indexes

Colons works everywhere, even with vox

To write a volume:

niwrite("my.nii", ni)

It is also possible to construct a new volume from scratch; see the NIVolume constructor in the source for documentation.

About

Julia module for reading/writing NIfTI MRI files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%