Skip to content

Julia module for reading/writing NIfTI MRI files

License

Notifications You must be signed in to change notification settings

jamesthesnake/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: #e

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.

abide

To mmap the NIfTI file:

update JULIA

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, for voxel image processing

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

Packages

No packages published

Languages

  • Julia 97.0%
  • Python 3.0%