init.nii: Initialize Empty NIfTI File

Description Usage Arguments Author(s) Examples

View source: R/init.nii.R

Description

This function is used to initialize an empty NIfTI file. It creates the file volume-by-volume rather than a bulk array write operation such that massive arrays do not need to be loaded into memory

Usage

1
2
3
4
5
6
7
init.nii(new.nii,
         ref.nii=NULL,
         dims,
         pixdim=NULL,
         orient=NULL,
         datatype=16,
         init.value=NA)

Arguments

new.nii

Full file path for the file to be written, must have .nii extension

ref.nii

Full file path for reference image to use same space

dims

a numeric vector specifying the image dimensions, e.g., c(X,Y,Z,T)

pixdim

An 8 element numeric vector specifying the pixel dimensions image to be created. Should be in the format (a,x,y,z,t,b,c,d), the output from info.nii("example_file.nii", "pixdim") is the correct format

orient

A named list with the following elements, qform_code [integer(1)], sform_code [integer(1)], quatern_b [numeric(1)], quatern_c [numeric(1)], quatern_d [numeric(1)], qoffset_x [numeric(1)], qoffset_y [numeric(1)], qoffset_z [numeric(1)], srow_x [numeric(3)], srow_y [numeric(3)], srow_z [numeric(3)]

datatype

a numeric value indicating the type of tdata to be used in the new NII file, default=16

init.value

value to use for all voxels to initialize NIfTI file, default=NA

Author(s)

Timothy R. Koscik <timothy-koscik@uiowa.edu>

Examples

1
2
3
4
## Not run: 
init.nii(new.nii = "~/example_image.nii", ref.nii = "~/reference_image.nii")    

## End(Not run)

TKoscik/tk.nifti documentation built on June 6, 2021, 2:30 a.m.