Title: | Rigorous - 'NIfTI' + 'ANALYZE' + 'AFNI' : Input / Output |
---|---|
Description: | Functions for the input/output and visualization of medical imaging data that follow either the 'ANALYZE', 'NIfTI' or 'AFNI' formats. This package is part of the Rigorous Analytics bundle. |
Authors: | Brandon Whitcher [aut, cre], Volker Schmid [aut], Andrew Thornton [aut], Karsten Tabelow [ctb], Jon Clayden [ctb], John Muschelli [aut] |
Maintainer: | Brandon Whitcher <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 0.11.5 |
Built: | 2024-11-03 05:06:35 UTC |
Source: | https://github.com/bjw34032/oro.nifti |
The AFNI class for medical imaging data.
## S4 method for signature 'afni' show(object)
## S4 method for signature 'afni' show(object)
object |
An object of class |
Objects can be created by calls of the form
new("afni", data, dim, dimnames, ...)
.
.Data
:Object of class "array"
contains the imaging data
DATASET_RANK
:Object of class "integer"
DATASET_DIMENSIONS
:Object of class "integer"
TYPESTRING
:Object of class "character"
SCENE_DATA
:Object of class "integer"
ORIENT_SPECIFIC
:Object of class "integer"
ORIGIN
:Object of class "numeric"
DELTA
:Object of class "numeric"
TAXIS_NUMS
:Object of class "integer"
TAXIS_FLOATS
:Object of class "numeric"
TAXIS_OFFSETS
:Object of class "numeric"
IDCODE_STRING
:Object of class "character"
IDCODE_DATE
:Object of class "character"
BYTEORDER_STRING
:Object of class "character"
BRICK_STATS
:Object of class "numeric"
BRICK_TYPES
:Object of class "integer"
BRICK_FLOAT_FACS
:Object of class "numeric"
BRICK_LABS
:Object of class "character"
BRICK_STATAUX
:Object of class "numeric"
STAT_AUX
:Object of class "numeric"
HISTORY_NOTE
:Object of class "character"
NOTES_COUNT
:Object of class "integer"
NOTE_NUMBER
:Object of class "character"
TAGALIGN_MATVEC
:Object of class "numeric"
VOLREG_MATVEC
:Object of class "array"
VOLREG_ROTCOM
:Object of class "character"
VOLREG_CENTER_OLD
:Object of class "numeric"
VOLREG_CENTER_BASE
:Object of class "numeric"
VOLREG_ROTPARENT_IDCODE
:Object of class "character"
VOLREG_ROTPARENT_NAME
:Object of class "character"
VOLREG_GRIDPARENT_IDCODE
:Object of class "character"
VOLREG_GRIDPARENT_NAME
:Object of class "character"
VOLREG_INPUT_IDCODE
:Object of class "character"
VOLREG_INPUT_NAME
:Object of class "character"
VOLREG_BASE_IDCODE
:Object of class "character"
VOLREG_BASE_NAME
:Object of class "character"
VOLREG_ROTCOM_NUM
:Object of class "integer"
IDCODE_ANAT_PARENT
:Object of class "character"
TO3D_ZPAD
:Object of class "integer"
IDCODE_WARP_PARENT
:Object of class "character"
WARP_TYPE
:Object of class "integer"
WARP_DATA
:Object of class "numeric"
MARKS_XYZ
:Object of class "numeric"
MARKS_LAB
:Object of class "character"
MARKS_HELP
:Object of class "character"
MARKS_FLAGS
:Object of class "integer"
TAGSET_NUM
:Object of class "integer"
TAGSET_FLOATS
:Object of class "numeric"
TAGSET_LABELS
:Object of class "character"
LABEL_1
:Object of class "character"
LABEL_2
:Object of class "character"
DATASET_NAME
:Object of class "character"
DATASET_KEYWORDS
:Object of class "character"
BRICK_KEYWORDS
:Object of class "character"
Class "array"
, from data part.
Class "matrix"
, by class “array”, distance 2,
with explicit test and coerce.
Class "structure"
, by class “array”, distance
2.
Class "vector"
, by class “array”, distance 3,
with explicit coerce.
Class "vector"
, by class “array”, distance 5,
with explicit test and coerce.
Karsten Tabelow [email protected]
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
showClass("afni")
showClass("afni")
Constructor for Analyze class objects.
anlz(img = array(0, dim = rep(1, 4)), dim, datatype = 2, ...)
anlz(img = array(0, dim = rep(1, 4)), dim, datatype = 2, ...)
img |
is a multidimensional array of data. |
dim |
is the dimension of the data (default = |
datatype |
is an integer that denotes the type of data contained in
each voxel. See the function |
... |
allows for additional ‘slots’ to be specified. |
An object of class anlz
.
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
anlz
, nifti
,
nifti
, convert.datatype.anlz
aim <- anlz() # default
aim <- anlz() # default
The ANALYZE class for medical imaging data.
## S4 method for signature 'anlz' show(object)
## S4 method for signature 'anlz' show(object)
object |
An object of class |
Objects can be created by calls of the form
new("anlz", data, dim, dimnames, ...)
or by calling the anlz
function.
.Data
:Object of class "array"
contains the
imaging data
sizeof_hdr
:Object of class "numeric"
contains
the size of the header (= 348)
data_type
:Object of class "character"
db_name
:Object of class "character"
extents
:Object of class "numeric"
session_error
:Object of class "numeric"
regular
:Object of class "character"
hkey_un0
:Object of class "character"
dim_
:Object of class "vector"
contains the
dimensions of the imaging data
vox_units
:Object of class "character"
cal_units
:Object of class "character"
unused1
:Object of class "numeric"
datatype
:Object of class "numeric"
bitpix
:Object of class "numeric"
contains the
number of bits per voxel (pixel)
dim_un0
:Object of class "numeric"
pixdim
:Object of class "vector"
contains the
real-world dimensions of the imaging data
vox_offset
:Object of class "numeric"
funused1
:Object of class "numeric"
funused2
:Object of class "numeric"
funused3
:Object of class "numeric"
cal_max
:Object of class "numeric"
contains the
maximum display intensity
cal_min
:Object of class "numeric"
contains the
minimum display intensity
compressed
:Object of class "numeric"
verified
:Object of class "numeric"
glmax
:Object of class "numeric"
glmin
:Object of class "numeric"
descrip
:Object of class "character"
aux_file
:Object of class "character"
orient
:Object of class "character"
origin
:Object of class "numeric"
generated
:Object of class "character"
scannum
:Object of class "character"
patient_id
:Object of class "character"
exp_date
:Object of class "character"
exp_time
:Object of class "character"
hist_un0
:Object of class "character"
views
:Object of class "numeric"
vols_added
:Object of class "numeric"
start_field
:Object of class "numeric"
field_skip
:Object of class "numeric"
omax
:Object of class "numeric"
omin
:Object of class "numeric"
smax
:Object of class "numeric"
smin
:Object of class "numeric"
Class "array"
, from data part.
Class "matrix"
, by class “array”, distance 2,
with explicit test and coerce.
Class "structure"
, by class “array”, distance 2.
Class "vector"
, by class “array”, distance 3,
with explicit coerce.
Class "vector"
, by class “array”, distance 5,
with explicit test and coerce.
signature(x = "anlz")
: displays the image(s).
signature(object = "anlz")
: prints out a summary
of the imaging data.
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
showClass("anlz")
showClass("anlz")
Overloaded operators for anlz and nifti objects
## S4 method for signature 'anlz,anlz' Ops(e1, e2) ## S4 method for signature 'anlz,numeric' Ops(e1, e2) ## S4 method for signature 'numeric,anlz' Ops(e1, e2) ## S4 method for signature 'nifti,anlz' Ops(e1, e2) ## S4 method for signature 'anlz,nifti' Ops(e1, e2)
## S4 method for signature 'anlz,anlz' Ops(e1, e2) ## S4 method for signature 'anlz,numeric' Ops(e1, e2) ## S4 method for signature 'numeric,anlz' Ops(e1, e2) ## S4 method for signature 'nifti,anlz' Ops(e1, e2) ## S4 method for signature 'anlz,nifti' Ops(e1, e2)
e1 |
object |
e2 |
object |
John Muschelli [email protected]
img01 <- anlz(array(1:64, c(4,4,4,1)), datatype=4) img02 <- anlz(array(64:1, c(4,4,4,1)), datatype=4) is.anlz(img01 + img02) is.anlz(sqrt(2) * img01) is.anlz(img02 / pi)
img01 <- anlz(array(1:64, c(4,4,4,1)), datatype=4) img02 <- anlz(array(64:1, c(4,4,4,1)), datatype=4) is.anlz(img01 + img02) is.anlz(sqrt(2) * img01) is.anlz(img02 / pi)
Internal function that converts multidimensional arrays to ANALYZE class objects.
as.anlz(from, value = NULL, verbose = FALSE)
as.anlz(from, value = NULL, verbose = FALSE)
from |
is the object to be converted. |
value |
is the |
verbose |
is a logical variable (default = |
An object of class anlz
.
Andrew Thornton [email protected],
Brandon Whitcher [email protected]
Internal function that converts multidimensional arrays to NIfTI class objects.
as.nifti(from, value = NULL, verbose = FALSE)
as.nifti(from, value = NULL, verbose = FALSE)
from |
is the object to be converted. |
value |
is the |
verbose |
is a logical variable (default = |
An object of class nifti
.
Andrew Thornton [email protected].
Brandon Whitcher [email protected]
Facilitate the creation and modification of audit trails for NIfTI class objects.
oro.nifti.info(type) enableAuditTrail() getLastCallWithName(functionName) newAuditTrail() niftiExtensionToAuditTrail( nim, workingDirectory = NULL, filename = NULL, call = NULL ) niftiAuditTrailSystemNode( type = "system-info", workingDirectory = NULL, filename = NULL, call = NULL ) niftiAuditTrailSystemNodeEvent( trail, type = NULL, call = NULL, workingDirectory = NULL, filename = NULL, comment = NULL ) niftiAuditTrailCreated( history = NULL, call = NULL, workingDirectory = NULL, filename = NULL ) niftiAuditTrailEvent(trail, type = NULL, call = NULL, comment = NULL)
oro.nifti.info(type) enableAuditTrail() getLastCallWithName(functionName) newAuditTrail() niftiExtensionToAuditTrail( nim, workingDirectory = NULL, filename = NULL, call = NULL ) niftiAuditTrailSystemNode( type = "system-info", workingDirectory = NULL, filename = NULL, call = NULL ) niftiAuditTrailSystemNodeEvent( trail, type = NULL, call = NULL, workingDirectory = NULL, filename = NULL, comment = NULL ) niftiAuditTrailCreated( history = NULL, call = NULL, workingDirectory = NULL, filename = NULL ) niftiAuditTrailEvent(trail, type = NULL, call = NULL, comment = NULL)
type |
An identifier to add some meaning to the event. |
functionName |
The name of a function on the call stack. |
nim |
is an object of class |
workingDirectory |
The working directory associated with the ‘filename’. |
filename |
The filename associated with the nifti object. |
call |
A |
trail |
The |
comment |
Some textual comment |
history |
An |
The function oro.nifti.info
is used to find the ecode
or the
XML namespace
relevant to the audit trail.
The function enableAuditTrail
is turned “off” by default to
minimize package dependencies. Should one wish to turn “on” the
audit trail functionality, then one should set the option
NIfTI.audit.trail
to TRUE
and call the function
enableAuditTrail
. Setting the option NIfTI.audit.trail
to
FALSE
will disable the audit trail.
The function newAuditTrail
returns an XMLAbstractNode
representing the root node of an audit trail. This is mostly intended as an
internal function.
The function niftiExtensionToAuditTrail
takes an object representing
a NIfTI object, casts it as a niftiAuditTrail
and checks if there is
an extension (a niftiExtensionSection
) with ecode
equal to
oro.nifti.info("ecode")
; i.e. has a extension with data representing
a serialized audit trail. The function will then strip the object of this
extension parsing the serialized edata
into an audit trail and adding
a ‘read’ event to the trail.
The function niftiAuditTrailToExtension
takes a
niftiAuditTrail
and returns a niftiExtensionSection
with
edata
containing the serialized form of the audit trail after adding
a ‘saved’ event to the trail.
The function niftiAuditTrailSystemNodeEvent
adds an element with name
equal to type
to the trail
. It uses the
niftiAuditTrailSystemNode
function to create the node.
The function niftiAuditTrailSystemNode
is an internal function
creating an XMLAbstractNode
element with name type
and
attributes giving information about the R system and library. The
filename
and call
will also be added as attributes if
available.
The function niftiAuditTrailEvent
adds an element with name
event
to the trail
. The arguments type
,
filename
, call
are added as attributes and the comment
is the text value of the element.
The function niftiAuditTrailCreated
will create a new audit trail
containing a system node element created
with the child
history
with the contents history
. If the last element of the
history
given is an event
with type="processing"
, then
this node will be removed from the history
and its call
attribute will be used as the value of the call
attribute on the
created
node.
The function getLastCallWithName
will search the call stack for a
call of the function functionName
, returning last call to that
function if possible. It will default to the call of the function which
called the function which called getLastCallWithName if there was no such
call (and if there was no such call it will return the call of itself).
These functions are mostly intended to be used internally in order to document the changes that occur to NIfTI objects due to functions that are audit-trail aware. However, as the precise manner in which these functions are used is not documented anywhere else, we shall proceed to describe which functions are audit-trail aware and how they interact with the audit trail.
as.nifti
and its S4 alias as(nim, "nifti")
will always produce
niftiAuditTrail
objects if the functionality is turned on. The
function niftiAuditTrailCreated
will be used and if an exemplar
object is provided (e.g., as.nifti(array, niftiExemplar)
) then the
trail of the exemplar will be used as the history
.
readNIfTI
and writeNIfTI
also always produce
niftiAuditTrail
objects if the functionality is turned on. The
functions niftiExtensionToAuditTrail
and
niftiAuditTrailToExtension
are used internally by these functions to
facilitate this behaviour.
Andrew Thornton [email protected] and Brandon Whitcher [email protected]
## A good example of the use of these functions is shown by this ## wrapper function which takes a function fun(nim, ...) returning ## lists of arrays which are nifti-ized using as(...) options("niftiAuditTrail"=TRUE) enableAuditTrail() wrapper <- function(functionToWrap, nameOfCallingFunction, nim, ...) { if (!is(nim, "nifti")) nim <- as(nim, "nifti") if (is(nim, "niftiAuditTrail")) { ## This will force as(...) to set the call which created the ## results to the calling function's call rather than ## as(result, nifti) as it would otherwise do slot(nim, "trail") <- niftiAuditTrailEvent(slot(nim, "trail"), "processing", nameOfCallingFunction) } result <- functionToWrap(nim, ...) as(result, "nifti") <- nim return(result) } ## An example of how wrapper is used follows: functionToWrap <- function(ignored, x, y) { return (array(1, dim=c(x,y))) } ## The nifti-ized form niftiizedForm <- function(nim,...) { return(wrapper(functionToWrap, "niftiizedForm", nim, ...)) } ## Not run: if (isTRUE(getOption("niftiAuditTrail"))) { print(slot(as.nifti(functionToWrap(nifti(), 4, 4), nifti()), "trail")) print(slot(niftiizedForm(nifti(), 4, 4), "trail")) } ## End(Not run)
## A good example of the use of these functions is shown by this ## wrapper function which takes a function fun(nim, ...) returning ## lists of arrays which are nifti-ized using as(...) options("niftiAuditTrail"=TRUE) enableAuditTrail() wrapper <- function(functionToWrap, nameOfCallingFunction, nim, ...) { if (!is(nim, "nifti")) nim <- as(nim, "nifti") if (is(nim, "niftiAuditTrail")) { ## This will force as(...) to set the call which created the ## results to the calling function's call rather than ## as(result, nifti) as it would otherwise do slot(nim, "trail") <- niftiAuditTrailEvent(slot(nim, "trail"), "processing", nameOfCallingFunction) } result <- functionToWrap(nim, ...) as(result, "nifti") <- nim return(result) } ## An example of how wrapper is used follows: functionToWrap <- function(ignored, x, y) { return (array(1, dim=c(x,y))) } ## The nifti-ized form niftiizedForm <- function(nim,...) { return(wrapper(functionToWrap, "niftiizedForm", nim, ...)) } ## Not run: if (isTRUE(getOption("niftiAuditTrail"))) { print(slot(as.nifti(functionToWrap(nifti(), 4, 4), nifti()), "trail")) print(slot(niftiizedForm(nifti(), 4, 4), "trail")) } ## End(Not run)
Operators that act on the audit trail (XML) in the NIfTI header.
audit.trail(object) ## S4 method for signature 'nifti' audit.trail(object) audit.trail(object) <- value ## S4 replacement method for signature 'nifti' audit.trail(object) <- value
audit.trail(object) ## S4 method for signature 'nifti' audit.trail(object) audit.trail(object) <- value ## S4 replacement method for signature 'nifti' audit.trail(object) <- value
object |
is of class |
value |
Value to assign to trail slot |
Extract or replace NIfTI audit trail.
Andrew Thornton [email protected]
aux_file
Methods that act on the aux_file
field in the
NIfTI/ANALYZE header.
aux_file(object) ## S4 method for signature 'nifti' aux_file(object) ## S4 method for signature 'anlz' aux_file(object) aux_file(object) <- value ## S4 replacement method for signature 'nifti' aux_file(object) <- value ## S4 replacement method for signature 'anlz' aux_file(object) <- value aux.file(object) ## S4 method for signature 'nifti' aux.file(object) ## S4 method for signature 'anlz' aux.file(object) aux.file(object) <- value ## S4 replacement method for signature 'nifti' aux.file(object) <- value ## S4 replacement method for signature 'anlz' aux.file(object) <- value ## S4 method for signature 'niftiImage' aux_file(object) ## S4 replacement method for signature 'niftiImage' aux_file(object) <- value
aux_file(object) ## S4 method for signature 'nifti' aux_file(object) ## S4 method for signature 'anlz' aux_file(object) aux_file(object) <- value ## S4 replacement method for signature 'nifti' aux_file(object) <- value ## S4 replacement method for signature 'anlz' aux_file(object) <- value aux.file(object) ## S4 method for signature 'nifti' aux.file(object) ## S4 method for signature 'anlz' aux.file(object) aux.file(object) <- value ## S4 replacement method for signature 'nifti' aux.file(object) <- value ## S4 replacement method for signature 'anlz' aux.file(object) <- value ## S4 method for signature 'niftiImage' aux_file(object) ## S4 replacement method for signature 'niftiImage' aux_file(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_RL_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniRL.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) options("niftiAuditTrail"=FALSE) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniRL.nii.gz") mniRL <- readNIfTI(urlfile) aux.file(mniRL) aux.file(mniRL) <- "avg152T1_RL_nifti" aux.file(mniRL) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) aux_file(img) aux_file(img) = "hey" stopifnot(aux_file(img) == "hey")
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_RL_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniRL.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) options("niftiAuditTrail"=FALSE) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniRL.nii.gz") mniRL <- readNIfTI(urlfile) aux.file(mniRL) aux.file(mniRL) <- "avg152T1_RL_nifti" aux.file(mniRL) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) aux_file(img) aux_file(img) = "hey" stopifnot(aux_file(img) == "hey")
bitpix
Methods that act on the bitpix
field in the
NIfTI/ANALYZE header.
bitpix(object) ## S4 method for signature 'nifti' bitpix(object) ## S4 method for signature 'anlz' bitpix(object) bitpix(object) <- value ## S4 replacement method for signature 'nifti' bitpix(object) <- value ## S4 replacement method for signature 'anlz' bitpix(object) <- value ## S4 method for signature 'niftiImage' bitpix(object)
bitpix(object) ## S4 method for signature 'nifti' bitpix(object) ## S4 method for signature 'anlz' bitpix(object) bitpix(object) <- value ## S4 replacement method for signature 'nifti' bitpix(object) <- value ## S4 replacement method for signature 'anlz' bitpix(object) <- value ## S4 method for signature 'niftiImage' bitpix(object)
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) bitpix(img)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) bitpix(img)
Two volumes of medical imaging data are merged together in the superior-inferior (or $z$) direction. One assumes that there is at least one slice that overlaps between the two volumes.
blendVolumes(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'nifti,nifti' blend(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'anlz,anlz' blend(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'anlz,nifti' blend(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'nifti,anlz' blend(x, y, seqX, seqY, method = "linear")
blendVolumes(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'nifti,nifti' blend(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'anlz,anlz' blend(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'anlz,nifti' blend(x, y, seqX, seqY, method = "linear") ## S4 method for signature 'nifti,anlz' blend(x, y, seqX, seqY, method = "linear")
x , y
|
are objects of class |
seqX , seqY
|
are vectors that provide the $z$-coordinate values for the two imaging volumes. |
method |
is the type of weighing to use when combining information where
there is an overlap (default = |
A single volume that blends the voxel-wise information from x
and y
.
Merge x
and y
.
Merge x
on y
.
Merge x
on y
.
Merge x
and y
.
Brandon Whitcher [email protected]
image-methods
, overlay-methods
cal_max
Methods that act on the cal_max
field in the
NIfTI/ANALYZE header.
cal_max(object) ## S4 method for signature 'nifti' cal_max(object) ## S4 method for signature 'anlz' cal_max(object) cal_max(object) <- value ## S4 replacement method for signature 'nifti' cal_max(object) <- value ## S4 replacement method for signature 'anlz' cal_max(object) <- value cal.max(object) ## S4 method for signature 'nifti' cal.max(object) ## S4 method for signature 'anlz' cal.max(object) cal.max(object) <- value ## S4 replacement method for signature 'nifti' cal.max(object) <- value ## S4 replacement method for signature 'anlz' cal.max(object) <- value ## S4 method for signature 'niftiImage' cal.max(object) ## S4 replacement method for signature 'niftiImage' cal.max(object) <- value ## S4 method for signature 'niftiImage' cal_max(object) ## S4 replacement method for signature 'niftiImage' cal_max(object) <- value
cal_max(object) ## S4 method for signature 'nifti' cal_max(object) ## S4 method for signature 'anlz' cal_max(object) cal_max(object) <- value ## S4 replacement method for signature 'nifti' cal_max(object) <- value ## S4 replacement method for signature 'anlz' cal_max(object) <- value cal.max(object) ## S4 method for signature 'nifti' cal.max(object) ## S4 method for signature 'anlz' cal.max(object) cal.max(object) <- value ## S4 replacement method for signature 'nifti' cal.max(object) <- value ## S4 replacement method for signature 'anlz' cal.max(object) <- value ## S4 method for signature 'niftiImage' cal.max(object) ## S4 replacement method for signature 'niftiImage' cal.max(object) <- value ## S4 method for signature 'niftiImage' cal_max(object) ## S4 replacement method for signature 'niftiImage' cal_max(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) cal.max(mniLR) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) cal.max(img) cal_max(img) cal.max(img) = 2500 stopifnot(cal_max(img) == 2500) cal_max(img) = 2500 cal.min(img) cal.min(img) = 2 stopifnot(cal_min(img) == 2) cal_min(img) cal_min(img) = 0 stopifnot(cal_min(img) == 0)
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) cal.max(mniLR) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) cal.max(img) cal_max(img) cal.max(img) = 2500 stopifnot(cal_max(img) == 2500) cal_max(img) = 2500 cal.min(img) cal.min(img) = 2 stopifnot(cal_min(img) == 2) cal_min(img) cal_min(img) = 0 stopifnot(cal_min(img) == 0)
cal_min
Methods that act on the cal_min
field in the
NIfTI/ANALYZE header.
cal_min(object) ## S4 method for signature 'nifti' cal_min(object) ## S4 method for signature 'anlz' cal_min(object) cal_min(object) <- value ## S4 replacement method for signature 'nifti' cal_min(object) <- value ## S4 replacement method for signature 'anlz' cal_min(object) <- value cal.min(object) ## S4 method for signature 'nifti' cal.min(object) ## S4 method for signature 'anlz' cal.min(object) cal.min(object) <- value ## S4 replacement method for signature 'nifti' cal.min(object) <- value ## S4 replacement method for signature 'anlz' cal.min(object) <- value ## S4 method for signature 'niftiImage' cal.min(object) ## S4 replacement method for signature 'niftiImage' cal.min(object) <- value ## S4 method for signature 'niftiImage' cal_min(object) ## S4 replacement method for signature 'niftiImage' cal_min(object) <- value
cal_min(object) ## S4 method for signature 'nifti' cal_min(object) ## S4 method for signature 'anlz' cal_min(object) cal_min(object) <- value ## S4 replacement method for signature 'nifti' cal_min(object) <- value ## S4 replacement method for signature 'anlz' cal_min(object) <- value cal.min(object) ## S4 method for signature 'nifti' cal.min(object) ## S4 method for signature 'anlz' cal.min(object) cal.min(object) <- value ## S4 replacement method for signature 'nifti' cal.min(object) <- value ## S4 replacement method for signature 'anlz' cal.min(object) <- value ## S4 method for signature 'niftiImage' cal.min(object) ## S4 replacement method for signature 'niftiImage' cal.min(object) <- value ## S4 method for signature 'niftiImage' cal_min(object) ## S4 replacement method for signature 'niftiImage' cal_min(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) cal.min(mniLR)
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) cal.min(mniLR)
cal_units
Methods that act on the cal_units
field in the
NIfTI/ANALYZE header.
cal_units(object) ## S4 method for signature 'anlz' cal_units(object) cal_units(object) <- value ## S4 replacement method for signature 'anlz' cal_units(object) <- value cal.units(object) ## S4 method for signature 'anlz' cal.units(object) cal.units(object) <- value ## S4 replacement method for signature 'anlz' cal.units(object) <- value
cal_units(object) ## S4 method for signature 'anlz' cal_units(object) cal_units(object) <- value ## S4 replacement method for signature 'anlz' cal_units(object) <- value cal.units(object) ## S4 method for signature 'anlz' cal.units(object) cal.units(object) <- value ## S4 replacement method for signature 'anlz' cal.units(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Rescales image cal_max
and cal_min
slots to
be the max and min, respectively, of an object of class nifti, with
na.rm = TRUE
. This is so that when images are rendered/written,
the values correspond to those in the array (stored in .Data
slot)
are plotted on correct greyscale and no error is given by writeNIfTI
.
calibrateImage(img, infok = TRUE) cal_img(img, infok = TRUE)
calibrateImage(img, infok = TRUE) cal_img(img, infok = TRUE)
img |
is a |
infok |
is a logical value whether or not |
An object of class nifti
.
John Muschelli [email protected]
Methods for function coerce
in Package ‘methods’.
object |
is an object of class |
Class |
is the name of the class to which ‘object’ should be
coerced; i.e., |
from |
is the object to be converted. |
value |
is the |
verbose |
is a logical variable (default = |
An object of class anlz
or nifti
.
An object of class anlz
is coerced
into a NIfTI object.
An object of class array
is
coerced into an ANALYZE object.
An object of class array
is
coerced into a NIfTI object.
All objects of class array
in the
list are coerced into ANALYZE objects. All other objects are left alone.
The original list structure is retained.
All objects of class array
in the
list are coerced into NIfTI objects. All other objects are left alone. The
original list structure is retained.
Andrew Thornton [email protected],
Brandon Whitcher [email protected]
compressed
Methods that act on the compressed
field in the
NIfTI/ANALYZE header.
compressed(object) ## S4 method for signature 'anlz' compressed(object) compressed(object) <- value ## S4 replacement method for signature 'anlz' compressed(object) <- value
compressed(object) ## S4 method for signature 'anlz' compressed(object) compressed(object) <- value ## S4 replacement method for signature 'anlz' compressed(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Codes that appear in the ANALYZE header are mapped to meaningful character strings.
convert.bitpix.anlz(bitpix = NULL) convert.datatype.anlz(datatype.code = NULL) convert.orient.anlz(orientation)
convert.bitpix.anlz(bitpix = NULL) convert.datatype.anlz(datatype.code = NULL) convert.orient.anlz(orientation)
bitpix |
is the bit-per-pixel code. |
datatype.code |
defines data type. |
orientation |
defines the orientation. |
switch
statements are used to map a numeric code to the
appropriate string.
A character string.
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
convert.datatype
, convert.bitpix
,
convert.intent
, convert.form
,
convert.units
, convert.slice
## 4 = SIGNED_SHORT convert.datatype.anlz(4) ## 16 = FLOAT convert.datatype.anlz(16) ## 2 = "saggital unflipped" convert.orient.anlz(2) ## 4 = "coronal flipped" convert.orient.anlz(4)
## 4 = SIGNED_SHORT convert.datatype.anlz(4) ## 16 = FLOAT convert.datatype.anlz(16) ## 2 = "saggital unflipped" convert.orient.anlz(2) ## 4 = "coronal flipped" convert.orient.anlz(4)
Codes that appear in the ANALYZE header are mapped to meaningful character strings.
convert.bitpix(bitpix = NULL) convert.datatype(datatype.code = NULL) convert.intent(intent.code = NULL) convert.form(form.code) convert.units(units, inverse = FALSE) convert.slice(slice.code)
convert.bitpix(bitpix = NULL) convert.datatype(datatype.code = NULL) convert.intent(intent.code = NULL) convert.form(form.code) convert.units(units, inverse = FALSE) convert.slice(slice.code)
bitpix |
is the bit-per-pixel code. |
datatype.code |
defines data type. |
intent.code |
is the NIfTI intent code. |
form.code |
is the |
units |
is the units of pixdim[1..4]. |
inverse |
is a logical value that denotes the direction of unit conversion. |
slice.code |
is the slice timing order. |
switch
statements are used to map a numeric code to the
appropriate string.
A character string.
Brandon Whitcher [email protected]
Neuroimaging Informatics Technology Initiative (NIfTI)
http://nifti.nimh.nih.gov/
## 4 = SIGNED_SHORT convert.datatype.anlz(4) ## 16 = FLOAT convert.datatype.anlz(16) ## 2 = "saggital unflipped" convert.orient.anlz(2) ## 4 = "coronal flipped" convert.orient.anlz(4)
## 4 = SIGNED_SHORT convert.datatype.anlz(4) ## 16 = FLOAT convert.datatype.anlz(16) ## 2 = "saggital unflipped" convert.orient.anlz(2) ## 4 = "coronal flipped" convert.orient.anlz(4)
Codes that appear in the AFNI header are mapped to meaningful character strings.
convert.scene(scene.data, typestring)
convert.scene(scene.data, typestring)
scene.data |
defines data type. |
typestring |
defines whether func or anat data. |
switch
statements are used to map a numeric code to the appropriate
string.
A character string.
Karsten Tabelow [email protected]
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
convert.datatype.anlz
,
convert.orient.anlz
## 4 = CT for anatomic data convert.scene(4, "3DIM_HEAD_ANAT")
## 4 = CT for anatomic data convert.scene(4, "3DIM_HEAD_ANAT")
data_type
Methods that act on the data_type
field in the
NIfTI/ANALYZE header.
data_type(object) ## S4 method for signature 'nifti' data_type(object) ## S4 method for signature 'anlz' data_type(object) data_type(object) <- value ## S4 replacement method for signature 'nifti' data_type(object) <- value ## S4 replacement method for signature 'anlz' data_type(object) <- value data.type(object) ## S4 method for signature 'nifti' data.type(object) ## S4 method for signature 'anlz' data.type(object) data.type(object) <- value ## S4 replacement method for signature 'nifti' data.type(object) <- value ## S4 replacement method for signature 'anlz' data.type(object) <- value ## S4 method for signature 'niftiImage' data_type(object) ## S4 method for signature 'niftiImage' datatype(object)
data_type(object) ## S4 method for signature 'nifti' data_type(object) ## S4 method for signature 'anlz' data_type(object) data_type(object) <- value ## S4 replacement method for signature 'nifti' data_type(object) <- value ## S4 replacement method for signature 'anlz' data_type(object) <- value data.type(object) ## S4 method for signature 'nifti' data.type(object) ## S4 method for signature 'anlz' data.type(object) data.type(object) <- value ## S4 replacement method for signature 'nifti' data.type(object) <- value ## S4 replacement method for signature 'anlz' data.type(object) <- value ## S4 method for signature 'niftiImage' data_type(object) ## S4 method for signature 'niftiImage' datatype(object)
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) data_type(img) datatype(img)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) data_type(img) datatype(img)
datatype
Methods that act on the datatype
field in the
NIfTI/ANALYZE header.
datatype(object) ## S4 method for signature 'nifti' datatype(object) ## S4 method for signature 'anlz' datatype(object) datatype(object) <- value ## S4 replacement method for signature 'nifti' datatype(object) <- value ## S4 method for signature 'ANY' datatype(object) ## S4 replacement method for signature 'anlz' datatype(object) <- value
datatype(object) ## S4 method for signature 'nifti' datatype(object) ## S4 method for signature 'anlz' datatype(object) datatype(object) <- value ## S4 replacement method for signature 'nifti' datatype(object) <- value ## S4 method for signature 'ANY' datatype(object) ## S4 replacement method for signature 'anlz' datatype(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
db_name
Methods that act on the db_name
field in the
NIfTI/ANALYZE header.
db_name(object) ## S4 method for signature 'nifti' db_name(object) ## S4 method for signature 'anlz' db_name(object) db_name(object) <- value ## S4 replacement method for signature 'nifti' db_name(object) <- value ## S4 replacement method for signature 'anlz' db_name(object) <- value db.name(object) ## S4 method for signature 'nifti' db.name(object) ## S4 method for signature 'anlz' db.name(object) db.name(object) <- value ## S4 replacement method for signature 'nifti' db.name(object) <- value ## S4 replacement method for signature 'anlz' db.name(object) <- value
db_name(object) ## S4 method for signature 'nifti' db_name(object) ## S4 method for signature 'anlz' db_name(object) db_name(object) <- value ## S4 replacement method for signature 'nifti' db_name(object) <- value ## S4 replacement method for signature 'anlz' db_name(object) <- value db.name(object) ## S4 method for signature 'nifti' db.name(object) ## S4 method for signature 'anlz' db.name(object) db.name(object) <- value ## S4 replacement method for signature 'nifti' db.name(object) <- value ## S4 replacement method for signature 'anlz' db.name(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
descrip
Methods that act on the descrip
field in the
NIfTI/ANALYZE header.
descrip(object) ## S4 method for signature 'nifti' descrip(object) ## S4 method for signature 'anlz' descrip(object) descrip(object) <- value ## S4 replacement method for signature 'nifti' descrip(object) <- value ## S4 replacement method for signature 'anlz' descrip(object) <- value ## S4 method for signature 'niftiImage' descrip(object) ## S4 replacement method for signature 'niftiImage' descrip(object) <- value
descrip(object) ## S4 method for signature 'nifti' descrip(object) ## S4 method for signature 'anlz' descrip(object) descrip(object) <- value ## S4 replacement method for signature 'nifti' descrip(object) <- value ## S4 replacement method for signature 'anlz' descrip(object) <- value ## S4 method for signature 'niftiImage' descrip(object) ## S4 replacement method for signature 'niftiImage' descrip(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) descrip(mniLR) ## Not run: descrip(mniLR) <- paste(descrip(mniLR), version$version.string, sep="; ") descrip(mniLR) ## End(Not run) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) descrip(img) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) descrip(img) = "a file" descrip(img) stopifnot(descrip(img) == "a file")
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) descrip(mniLR) ## Not run: descrip(mniLR) <- paste(descrip(mniLR), version$version.string, sep="; ") descrip(mniLR) ## End(Not run) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) descrip(img) file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) descrip(img) = "a file" descrip(img) stopifnot(descrip(img) == "a file")
dim_
Methods that act on the dim_
field in the
NIfTI/ANALYZE header.
dim_(object) ## S4 method for signature 'nifti' dim_(object) ## S4 method for signature 'anlz' dim_(object) dim_(object) <- value ## S4 replacement method for signature 'nifti' dim_(object) <- value ## S4 replacement method for signature 'anlz' dim_(object) <- value ## S4 method for signature 'ANY' dim_(object)
dim_(object) ## S4 method for signature 'nifti' dim_(object) ## S4 method for signature 'anlz' dim_(object) dim_(object) <- value ## S4 replacement method for signature 'nifti' dim_(object) <- value ## S4 replacement method for signature 'anlz' dim_(object) <- value ## S4 method for signature 'ANY' dim_(object)
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
dim_info
Methods that act on the dim_info
field in the
NIfTI/ANALYZE header.
dim_info(object) ## S4 method for signature 'nifti' dim_info(object) dim_info(object) <- value ## S4 replacement method for signature 'nifti' dim_info(object) <- value
dim_info(object) ## S4 method for signature 'nifti' dim_info(object) dim_info(object) <- value ## S4 replacement method for signature 'nifti' dim_info(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
dim_un0
Methods that act on the dim_un0
field in the
NIfTI/ANALYZE header.
dim_un0(object) ## S4 method for signature 'anlz' dim_un0(object) dim_un0(object) <- value ## S4 replacement method for signature 'anlz' dim_un0(object) <- value
dim_un0(object) ## S4 method for signature 'anlz' dim_un0(object) dim_un0(object) <- value ## S4 replacement method for signature 'anlz' dim_un0(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Drops a dimension of an image that has one-dimension and
sets respective values to 0 in pixdim
or 1 in dim
.
dropImageDimension(img, onlylast = TRUE, warn = TRUE) drop_img_dim(img, onlylast = TRUE, warn = TRUE)
dropImageDimension(img, onlylast = TRUE, warn = TRUE) drop_img_dim(img, onlylast = TRUE, warn = TRUE)
img |
nifti object |
onlylast |
is a logical variable (default = |
warn |
produces a text output if the number of dimensions is under three. |
Object of class nifti
nim <- nifti(array(rnorm(10^3), dim = rep(10, 3))) nim2 <- nifti(array(rnorm(10^3), dim = c(10, 10, 1, 10))) dropImageDimension(nim2) dropImageDimension(nim2, onlylast = FALSE) nim3 <- nifti(array(rnorm(10^3), dim = c(10, 10, 10, 1))) dropImageDimension(nim3) dropImageDimension(nim3, onlylast = FALSE) # the same as above nim4 <- nifti(array(rnorm(10^3), dim = c(10, 10, 10, 1, 10))) dim(nim4[,,,1,]) dim(nim4[,,,1,,drop=TRUE]) dropImageDimension(nim4) nim5 <- nifti(array(rnorm(10^4), dim = c(1, 10, 10, 10, 1, 10))) dropImageDimension(nim5) dropImageDimension(nim5, onlylast = FALSE) nim6 <- nifti(array(rnorm(10^3), dim = c(1, 10, 10, 10, 1, 1))) dropImageDimension(nim6) ## Not run: ## 27 scans of Colin Holmes (MNI) brain co-registered and averaged ## NIfTI two-file format URL <- "http://imaging.mrc-cbu.cam.ac.uk/downloads/Colin/colin_1mm.tgz" urlfile <- file.path(tempdir(), "colin_1mm.tgz") download.file(URL, dest=urlfile, quiet=TRUE) untar(urlfile, exdir=tempdir()) colin <- readNIfTI(file.path(tempdir(), "colin_1mm")) dim(colin) dim_(colin) pixdim(colin) # this will error writeNIfTI(colin, filename = tempfile()) colin <- dropImageDimension(colin) writeNIfTI(colin, filename = tempfile()) ## End(Not run)
nim <- nifti(array(rnorm(10^3), dim = rep(10, 3))) nim2 <- nifti(array(rnorm(10^3), dim = c(10, 10, 1, 10))) dropImageDimension(nim2) dropImageDimension(nim2, onlylast = FALSE) nim3 <- nifti(array(rnorm(10^3), dim = c(10, 10, 10, 1))) dropImageDimension(nim3) dropImageDimension(nim3, onlylast = FALSE) # the same as above nim4 <- nifti(array(rnorm(10^3), dim = c(10, 10, 10, 1, 10))) dim(nim4[,,,1,]) dim(nim4[,,,1,,drop=TRUE]) dropImageDimension(nim4) nim5 <- nifti(array(rnorm(10^4), dim = c(1, 10, 10, 10, 1, 10))) dropImageDimension(nim5) dropImageDimension(nim5, onlylast = FALSE) nim6 <- nifti(array(rnorm(10^3), dim = c(1, 10, 10, 10, 1, 1))) dropImageDimension(nim6) ## Not run: ## 27 scans of Colin Holmes (MNI) brain co-registered and averaged ## NIfTI two-file format URL <- "http://imaging.mrc-cbu.cam.ac.uk/downloads/Colin/colin_1mm.tgz" urlfile <- file.path(tempdir(), "colin_1mm.tgz") download.file(URL, dest=urlfile, quiet=TRUE) untar(urlfile, exdir=tempdir()) colin <- readNIfTI(file.path(tempdir(), "colin_1mm")) dim(colin) dim_(colin) pixdim(colin) # this will error writeNIfTI(colin, filename = tempfile()) colin <- dropImageDimension(colin) writeNIfTI(colin, filename = tempfile()) ## End(Not run)
exp_date
Methods that act on the exp_date
field in the
NIfTI/ANALYZE header.
exp_date(object) ## S4 method for signature 'anlz' exp_date(object) exp_date(object) <- value ## S4 replacement method for signature 'anlz' exp_date(object) <- value
exp_date(object) ## S4 method for signature 'anlz' exp_date(object) exp_date(object) <- value ## S4 replacement method for signature 'anlz' exp_date(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
exp_time
Methods that act on the exp_time
field in the
NIfTI/ANALYZE header.
exp_time(object) ## S4 method for signature 'anlz' exp_time(object) exp_time(object) <- value ## S4 replacement method for signature 'anlz' exp_time(object) <- value
exp_time(object) ## S4 method for signature 'anlz' exp_time(object) exp_time(object) <- value ## S4 replacement method for signature 'anlz' exp_time(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
extender
Methods that act on the extender
field in the
NIfTI/ANALYZE header.
extender(object) ## S4 method for signature 'nifti' extender(object) extender(object) <- value ## S4 replacement method for signature 'nifti' extender(object) <- value
extender(object) ## S4 method for signature 'nifti' extender(object) extender(object) <- value ## S4 replacement method for signature 'nifti' extender(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
extents
Methods that act on the extents
field in the
NIfTI/ANALYZE header.
extents(object) ## S4 method for signature 'nifti' extents(object) ## S4 method for signature 'anlz' extents(object) extents(object) <- value ## S4 replacement method for signature 'nifti' extents(object) <- value ## S4 replacement method for signature 'anlz' extents(object) <- value
extents(object) ## S4 method for signature 'nifti' extents(object) ## S4 method for signature 'anlz' extents(object) extents(object) <- value ## S4 replacement method for signature 'nifti' extents(object) <- value ## S4 replacement method for signature 'anlz' extents(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
field_skip
Methods that act on the field_skip
field in the
NIfTI/ANALYZE header.
field_skip(object) ## S4 method for signature 'anlz' field_skip(object) field_skip(object) <- value ## S4 replacement method for signature 'anlz' field_skip(object) <- value field.skip(object) ## S4 method for signature 'anlz' field.skip(object) field.skip(object) <- value ## S4 replacement method for signature 'anlz' field.skip(object) <- value
field_skip(object) ## S4 method for signature 'anlz' field_skip(object) field_skip(object) <- value ## S4 replacement method for signature 'anlz' field_skip(object) <- value field.skip(object) ## S4 method for signature 'anlz' field.skip(object) field.skip(object) <- value ## S4 replacement method for signature 'anlz' field.skip(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
funused1
Methods that act on the funused1
field in the
NIfTI/ANALYZE header.
funused1(object) ## S4 method for signature 'anlz' funused1(object) funused1(object) <- value ## S4 replacement method for signature 'anlz' funused1(object) <- value
funused1(object) ## S4 method for signature 'anlz' funused1(object) funused1(object) <- value ## S4 replacement method for signature 'anlz' funused1(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
funused2
Methods that act on the funused2
field in the
NIfTI/ANALYZE header.
funused2(object) ## S4 method for signature 'anlz' funused2(object) funused2(object) <- value ## S4 replacement method for signature 'anlz' funused2(object) <- value
funused2(object) ## S4 method for signature 'anlz' funused2(object) funused2(object) <- value ## S4 replacement method for signature 'anlz' funused2(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
funused3
Methods that act on the funused3
field in the
NIfTI/ANALYZE header.
funused3(object) ## S4 method for signature 'anlz' funused3(object) funused3(object) <- value ## S4 replacement method for signature 'anlz' funused3(object) <- value
funused3(object) ## S4 method for signature 'anlz' funused3(object) funused3(object) <- value ## S4 replacement method for signature 'anlz' funused3(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
generated
Methods that act on the generated
field in the
NIfTI/ANALYZE header.
generated(object) ## S4 method for signature 'anlz' generated(object) generated(object) <- value ## S4 replacement method for signature 'anlz' generated(object) <- value
generated(object) ## S4 method for signature 'anlz' generated(object) generated(object) <- value ## S4 replacement method for signature 'anlz' generated(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
glmax
Methods that act on the glmax
field in the
NIfTI/ANALYZE header.
glmax(object) ## S4 method for signature 'nifti' glmax(object) ## S4 method for signature 'anlz' glmax(object) glmax(object) <- value ## S4 replacement method for signature 'nifti' glmax(object) <- value ## S4 replacement method for signature 'anlz' glmax(object) <- value
glmax(object) ## S4 method for signature 'nifti' glmax(object) ## S4 method for signature 'anlz' glmax(object) glmax(object) <- value ## S4 replacement method for signature 'nifti' glmax(object) <- value ## S4 replacement method for signature 'anlz' glmax(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
glmin
Methods that act on the glmin
field in the
NIfTI/ANALYZE header.
glmin(object) ## S4 method for signature 'nifti' glmin(object) ## S4 method for signature 'anlz' glmin(object) glmin(object) <- value ## S4 replacement method for signature 'nifti' glmin(object) <- value ## S4 replacement method for signature 'anlz' glmin(object) <- value
glmin(object) ## S4 method for signature 'nifti' glmin(object) ## S4 method for signature 'anlz' glmin(object) glmin(object) <- value ## S4 replacement method for signature 'nifti' glmin(object) <- value ## S4 replacement method for signature 'anlz' glmin(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
hist_un0
Methods that act on the hist_un0
field in the
NIfTI/ANALYZE header.
hist_un0(object) ## S4 method for signature 'anlz' hist_un0(object) hist_un0(object) <- value ## S4 replacement method for signature 'anlz' hist_un0(object) <- value
hist_un0(object) ## S4 method for signature 'anlz' hist_un0(object) hist_un0(object) <- value ## S4 replacement method for signature 'anlz' hist_un0(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
hkey_un0
Methods that act on the hkey_un0
field in the
NIfTI/ANALYZE header.
hkey_un0(object) ## S4 method for signature 'anlz' hkey_un0(object) hkey_un0(object) <- value ## S4 replacement method for signature 'anlz' hkey_un0(object) <- value hkey.un0(object) ## S4 method for signature 'anlz' hkey.un0(object) hkey.un0(object) <- value ## S4 replacement method for signature 'anlz' hkey.un0(object) <- value
hkey_un0(object) ## S4 method for signature 'anlz' hkey_un0(object) hkey_un0(object) <- value ## S4 replacement method for signature 'anlz' hkey_un0(object) <- value hkey.un0(object) ## S4 method for signature 'anlz' hkey.un0(object) hkey.un0(object) <- value ## S4 replacement method for signature 'anlz' hkey.un0(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
The hotmetal color table patterned after the one used in Matlab.
hotmetal(n = 64)
hotmetal(n = 64)
n |
is the number of color levels (default = 64). |
Based on the tim.colors
function in the fields package. The
hotmetal
function has been modified to break any dependence on code
in the fields package. Spline interpolation (interpSpline
) is
used when the number of requested colors is not the default.
A vector of character strings giving the colors in hexadecimal format.
terrain.colors
, tim.colors
,
topo.colors
hotmetal(10) image(outer(1:20,1:20,"+"), col=hotmetal(75), main="hotmetal")
hotmetal(10) image(outer(1:20,1:20,"+"), col=hotmetal(75), main="hotmetal")
Produce “lightbox” layout of images for nifti
, anlz
and
afni
objects.
## S4 method for signature 'nifti' image( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", ... ) ## S4 method for signature 'anlz' image( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", ... ) ## S4 method for signature 'afni' image(x, ...)
## S4 method for signature 'nifti' image( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", ... ) ## S4 method for signature 'anlz' image( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", ... ) ## S4 method for signature 'afni' image(x, ...)
x |
is an object of class |
z |
is the slice to be displayed (ignored when |
w |
is the time point to be displayed (4D arrays only). |
col |
is grayscale (by default). |
plane |
is the plane of acquisition to be displayed (choices are ‘axial’, ‘coronal’, ‘sagittal’). |
plot.type |
allows the choice between all slices being displayed, in a matrix (left-to-right, top-to-bottom), or a single slice. |
zlim |
is set to |
xlab |
is set to “” since all margins are set to zero. |
ylab |
is set to “” since all margins are set to zero. |
axes |
is set to |
oma |
is the size of the outer margins in the |
mar |
is the number of lines of margin in the |
bg |
is the background color in the |
... |
other arguments to the |
Uses the S3 generic function image
, with medical-image friendly
settings, to display nifti
, anlz
and afni
class objects
in a “lightbox” layout.
Generic function: see
image
.
Produce images for
x
.
Produce images for x
.
Produce images for x
.
Brandon Whitcher [email protected]
orthographic-methods
, overlay-methods
.Data
Methods that act on the .Data
field in the
NIfTI/ANALYZE header.
img_data(object) ## S4 method for signature 'nifti' img_data(object) ## S4 method for signature 'anlz' img_data(object) ## S4 method for signature 'character' img_data(object) ## S4 method for signature 'ANY' img_data(object) img_data(object) <- value ## S4 replacement method for signature 'nifti' img_data(object) <- value ## S4 replacement method for signature 'anlz' img_data(object) <- value
img_data(object) ## S4 method for signature 'nifti' img_data(object) ## S4 method for signature 'anlz' img_data(object) ## S4 method for signature 'character' img_data(object) ## S4 method for signature 'ANY' img_data(object) img_data(object) <- value ## S4 replacement method for signature 'nifti' img_data(object) <- value ## S4 replacement method for signature 'anlz' img_data(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Multiplies the number of slices by the voxel resolution for each direction.
img_length(img, units = c("mm", "cm"))
img_length(img, units = c("mm", "cm"))
img |
Image object, any method with |
units |
output unit, either cubic mm or cubic cm. |
Scalar numeric, one number, in mm or cm.
nim <- nifti(array(rnorm(10^3), dim = c(5, 2, 100)), pixdim = c(1, 0.5, 0.2, 1)) img_length(nim)
nim <- nifti(array(rnorm(10^3), dim = c(5, 2, 100)), pixdim = c(1, 0.5, 0.2, 1)) img_length(nim)
...
integerTranslation(nim, data, verbose = FALSE) invertIntegerTranslation(nim, verbose = FALSE)
integerTranslation(nim, data, verbose = FALSE) invertIntegerTranslation(nim, verbose = FALSE)
nim |
is an object of class |
data |
is ... |
verbose |
is a logical variable (default = |
...
...
Andrew Thornton [email protected]
intent_code
Methods that act on the intent_code
field in the
NIfTI/ANALYZE header.
intent_code(object) ## S4 method for signature 'nifti' intent_code(object) intent_code(object) <- value ## S4 replacement method for signature 'nifti' intent_code(object) <- value intent.code(object) ## S4 method for signature 'nifti' intent.code(object) intent.code(object) <- value ## S4 replacement method for signature 'nifti' intent.code(object) <- value ## S4 method for signature 'niftiImage' intent_code(object) ## S4 replacement method for signature 'niftiImage' intent_code(object) <- value
intent_code(object) ## S4 method for signature 'nifti' intent_code(object) intent_code(object) <- value ## S4 replacement method for signature 'nifti' intent_code(object) <- value intent.code(object) ## S4 method for signature 'nifti' intent.code(object) intent.code(object) <- value ## S4 replacement method for signature 'nifti' intent.code(object) <- value ## S4 method for signature 'niftiImage' intent_code(object) ## S4 replacement method for signature 'niftiImage' intent_code(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) intent_code(img) intent_code(img) = 4 stopifnot(intent_code(img) == 4)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) intent_code(img) intent_code(img) = 4 stopifnot(intent_code(img) == 4)
intent_name
Methods that act on the intent_name
field in the
NIfTI/ANALYZE header.
intent_name(object) ## S4 method for signature 'nifti' intent_name(object) intent_name(object) <- value ## S4 replacement method for signature 'nifti' intent_name(object) <- value intent.name(object) ## S4 method for signature 'nifti' intent.name(object) intent.name(object) <- value ## S4 replacement method for signature 'nifti' intent.name(object) <- value ## S4 method for signature 'niftiImage' intent_name(object) ## S4 replacement method for signature 'niftiImage' intent_name(object) <- value
intent_name(object) ## S4 method for signature 'nifti' intent_name(object) intent_name(object) <- value ## S4 replacement method for signature 'nifti' intent_name(object) <- value intent.name(object) ## S4 method for signature 'nifti' intent.name(object) intent.name(object) <- value ## S4 replacement method for signature 'nifti' intent.name(object) <- value ## S4 method for signature 'niftiImage' intent_name(object) ## S4 replacement method for signature 'niftiImage' intent_name(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) intent_name(img) intent_name(img) = "hey" stopifnot(intent_name(img) == "hey")
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) intent_name(img) intent_name(img) = "hey" stopifnot(intent_name(img) == "hey")
intent_p1
Methods that act on the intent_p1
field in the
NIfTI/ANALYZE header.
intent_p1(object) ## S4 method for signature 'nifti' intent_p1(object) intent_p1(object) <- value ## S4 replacement method for signature 'nifti' intent_p1(object) <- value intent.p1(object) ## S4 method for signature 'nifti' intent.p1(object) intent.p1(object) <- value ## S4 replacement method for signature 'nifti' intent.p1(object) <- value ## S4 method for signature 'niftiImage' intent_p1(object) ## S4 replacement method for signature 'niftiImage' intent_p1(object) <- value
intent_p1(object) ## S4 method for signature 'nifti' intent_p1(object) intent_p1(object) <- value ## S4 replacement method for signature 'nifti' intent_p1(object) <- value intent.p1(object) ## S4 method for signature 'nifti' intent.p1(object) intent.p1(object) <- value ## S4 replacement method for signature 'nifti' intent.p1(object) <- value ## S4 method for signature 'niftiImage' intent_p1(object) ## S4 replacement method for signature 'niftiImage' intent_p1(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) intent_p1(img) intent_p1(img) = 2 stopifnot(intent_p1(img) == 2) intent_p2(img) intent_p2(img) = 2 stopifnot(intent_p2(img) == 2) intent_p3(img) intent_p3(img) = 2 stopifnot(intent_p3(img) == 2)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) intent_p1(img) intent_p1(img) = 2 stopifnot(intent_p1(img) == 2) intent_p2(img) intent_p2(img) = 2 stopifnot(intent_p2(img) == 2) intent_p3(img) intent_p3(img) = 2 stopifnot(intent_p3(img) == 2)
intent_p2
Methods that act on the intent_p2
field in the
NIfTI/ANALYZE header.
intent_p2(object) ## S4 method for signature 'nifti' intent_p2(object) intent_p2(object) <- value ## S4 replacement method for signature 'nifti' intent_p2(object) <- value intent.p2(object) ## S4 method for signature 'nifti' intent.p2(object) intent.p2(object) <- value ## S4 replacement method for signature 'nifti' intent.p2(object) <- value ## S4 method for signature 'niftiImage' intent_p2(object) ## S4 replacement method for signature 'niftiImage' intent_p2(object) <- value
intent_p2(object) ## S4 method for signature 'nifti' intent_p2(object) intent_p2(object) <- value ## S4 replacement method for signature 'nifti' intent_p2(object) <- value intent.p2(object) ## S4 method for signature 'nifti' intent.p2(object) intent.p2(object) <- value ## S4 replacement method for signature 'nifti' intent.p2(object) <- value ## S4 method for signature 'niftiImage' intent_p2(object) ## S4 replacement method for signature 'niftiImage' intent_p2(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
intent_p3
Methods that act on the intent_p3
field in the
NIfTI/ANALYZE header.
intent_p3(object) ## S4 method for signature 'nifti' intent_p3(object) intent_p3(object) <- value ## S4 replacement method for signature 'nifti' intent_p3(object) <- value intent.p3(object) ## S4 method for signature 'nifti' intent.p3(object) intent.p3(object) <- value ## S4 replacement method for signature 'nifti' intent.p3(object) <- value ## S4 method for signature 'niftiImage' intent_p3(object) ## S4 replacement method for signature 'niftiImage' intent_p3(object) <- value
intent_p3(object) ## S4 method for signature 'nifti' intent_p3(object) intent_p3(object) <- value ## S4 replacement method for signature 'nifti' intent_p3(object) <- value intent.p3(object) ## S4 method for signature 'nifti' intent.p3(object) intent.p3(object) <- value ## S4 replacement method for signature 'nifti' intent.p3(object) <- value ## S4 method for signature 'niftiImage' intent_p3(object) ## S4 replacement method for signature 'niftiImage' intent_p3(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Check whether object is of class afni
.
is.afni(x)
is.afni(x)
x |
is an object to be checked. |
Logical indicating whether object is of class
afni
.
Karsten Tabelow [email protected]
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
Check whether object is of class anlz
.
is.anlz(x)
is.anlz(x)
x |
is an object to be checked. |
Logical indicating whether object is of class
anlz
.
Karsten Tabelow [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
Check whether object is of class nifti
.
is.nifti(x) is.niftiExtension(x)
is.nifti(x) is.niftiExtension(x)
x |
is an object to be checked. |
Logical indicating whether object is of class
nifti
.
Karsten Tabelow [email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
magic
Methods that act on the magic
field in the
NIfTI/ANALYZE header.
magic(object) ## S4 method for signature 'nifti' magic(object) magic(object) <- value ## S4 replacement method for signature 'nifti' magic(object) <- value ## S4 method for signature 'niftiImage' magic(object) ## S4 replacement method for signature 'niftiImage' magic(object) <- value
magic(object) ## S4 method for signature 'nifti' magic(object) magic(object) <- value ## S4 replacement method for signature 'nifti' magic(object) <- value ## S4 method for signature 'niftiImage' magic(object) ## S4 replacement method for signature 'niftiImage' magic(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) magic(img) magic(img) = "ni1" stopifnot(magic(img) == "ni1") magic(img) = "n+1" stopifnot(magic(img) == "n+1") magic(img) = "r" # bad magic stopifnot(magic(img) == "")
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) magic(img) magic(img) = "ni1" stopifnot(magic(img) == "ni1") magic(img) = "n+1" stopifnot(magic(img) == "n+1") magic(img) = "r" # bad magic stopifnot(magic(img) == "")
Constructor for NIfTI class objects.
nifti( img = array(0, dim = rep(1, 4)), dim, datatype = 2, cal.min = NULL, cal.max = NULL, pixdim = NULL, ... )
nifti( img = array(0, dim = rep(1, 4)), dim, datatype = 2, cal.min = NULL, cal.max = NULL, pixdim = NULL, ... )
img |
is a multidimensional array of data. |
dim |
is the dimension of the data (default = |
datatype |
is an integer that denotes the type of data contained in
each voxel. See |
cal.min |
allows user-specified minimum value in the array (visualization purposes only). |
cal.max |
allows user-specified minimum value in the array (visualization purposes only). |
pixdim |
allows user-specified pixel dimension vector (length = 8). |
... |
allows for additional ‘slots’ to be specified. |
An object of class nifti
.
Brandon Whitcher [email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
options("niftiAuditTrail"=FALSE) nim <- nifti() # default nim nim <- nifti(datatype=4) # 2-byte integers nim
options("niftiAuditTrail"=FALSE) nim <- nifti() # default nim nim <- nifti(datatype=4) # 2-byte integers nim
Methods for function [<-
in Package 'base'
Replaces the data at the provided co-ordinates with the value provided and updates the header.
Replaces the data at the provided co-ordinates with the value provided and updates the header.
Replaces the data row i of the provided nifti object with the value provided and updates the header.
Replaces the data row i of the provided nifti object with the value provided and updates the header.
Replaces the data of the provided nifti object with the array provided and updates the header.
The NIfTI class for medical imaging data.
## S4 method for signature 'nifti' show(object)
## S4 method for signature 'nifti' show(object)
object |
An object of class |
Objects can be created by calls of the form
new("nifti", data, dim, dimnames, ...)
or by calling the nifti
function.
.Data
:Object of class "array"
contains the
imaging data
sizeof_hdr
:Object of class "numeric"
contains
the size of the header (= 348)
data_type
:Object of class "character"
db_name
:Object of class "character"
extents
:Object of class "numeric"
session_error
:Object of class "numeric"
regular
:Object of class "character"
dim_info
:Object of class "numeric"
contains
MRI slice ordering
dim_
:Object of class "vector"
contains the
dimensions of the imaging data
intent_p1
:Object of class "numeric"
intent_p2
:Object of class "numeric"
intent_p3
:Object of class "numeric"
intent_code
:Object of class "numeric"
datatype
:Object of class "numeric"
bitpix
:Object of class "numeric"
contains the
number of bits per voxel (pixel)
slice_start
:Object of class "numeric"
pixdim
:Object of class "vector"
contains the
real-world dimensions of the imaging data
vox_offset
:Object of class "numeric"
contains
the voxel offset (= 352 when no extensions exist)
scl_slope
:Object of class "numeric"
scl_inter
:Object of class "numeric"
slice_end
:Object of class "numeric"
slice_code
:Object of class "numeric"
xyzt_units
:Object of class "numeric"
cal_max
:Object of class "numeric"
contains the
maximum display intensity
cal_min
:Object of class "numeric"
contains the
minimum display intensity
slice_duration
:Object of class "numeric"
toffset
:Object of class "numeric"
glmax
:Object of class "numeric"
glmin
:Object of class "numeric"
descrip
:Object of class "character"
aux_file
:Object of class "character"
qform_code
:Object of class "numeric"
sform_code
:Object of class "numeric"
quatern_b
:Object of class "numeric"
quatern_c
:Object of class "numeric"
quatern_d
:Object of class "numeric"
qoffset_x
:Object of class "numeric"
qoffset_y
:Object of class "numeric"
qoffset_z
:Object of class "numeric"
srow_x
:Object of class "vector"
srow_y
:Object of class "vector"
srow_z
:Object of class "vector"
intent_name
:Object of class "character"
magic
:Object of class "character"
extender
:Object of class "vector"
reoriented
:Object of class "logical"
Class "array"
, from data part.
Class "matrix"
, by class “array”, distance 2,
with explicit test and coerce.
Class "structure"
, by class “array”, distance
2.
Class "vector"
, by class “array”, distance 3,
with explicit coerce.
Class "vector"
, by class “array”, distance 5,
with explicit test and coerce.
signature(x = "nifti")
: displays the image(s).
signature(x = "nifti")
: displays the image(s).
signature(x = "nifti", y = "nifti")
: displays
the image(s).
signature(object = "nifti")
: prints out a summary
of the imaging data.
Brandon Whitcher [email protected],
Andrew Thornton
[email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
anlz
, niftiExtension
,
niftiAuditTrail
showClass("nifti")
showClass("nifti")
Overloaded operators for nifti objects
## S4 method for signature 'nifti,nifti' Ops(e1, e2) ## S4 method for signature 'nifti,numeric' Ops(e1, e2) ## S4 method for signature 'numeric,nifti' Ops(e1, e2)
## S4 method for signature 'nifti,nifti' Ops(e1, e2) ## S4 method for signature 'nifti,numeric' Ops(e1, e2) ## S4 method for signature 'numeric,nifti' Ops(e1, e2)
e1 |
is an object of class |
e2 |
is an object of class |
John Muschelli [email protected]
img01 <- nifti(array(1:64, c(4,4,4,1)), datatype=4) img02 <- nifti(array(64:1, c(4,4,4,1)), datatype=4) is.nifti(img01 + img02) is.nifti(sqrt(2) * img01) is.nifti(img02 / pi)
img01 <- nifti(array(1:64, c(4,4,4,1)), datatype=4) img02 <- nifti(array(64:1, c(4,4,4,1)), datatype=4) is.nifti(img01 + img02) is.nifti(sqrt(2) * img01) is.nifti(img02 / pi)
An extension of the NIfTI class that adds an audit trail in XML format.
Objects can be created by calls of the form
new("niftiAuditTrail", data, dim, dimnames, ...)
.
signature(object = "niftiAuditTrail")
: prints out a
summary of the imaging data.
Andrew Thornton [email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
showClass("niftiAuditTrail")
showClass("niftiAuditTrail")
An extension of the NIfTI class that allows “extensions” that conform to the NIfTI data standard.
Objects can be created by calls of the form
new("niftiExtension", data, dim, dimnames, ...)
.
Andrew Thornton [email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
showClass("niftiExtension")
showClass("niftiExtension")
A niftiExtensionSection
contains the fields that conform
to the NIfTI standard regarding header extensions. A niftiExtension
is composed of one or more of these objects.
Objects can be created by calls of the form
new("niftiExtensionSection", data, dim, dimnames, ...)
.
Brandon Whitcher [email protected],
Andrew Thornton
[email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
showClass("niftiExtensionSection")
showClass("niftiExtensionSection")
Converts a niftiImage from RNifti to a nifti object from the oro.nifti package
nii2oro(image)
nii2oro(image)
image |
|
Object of class nifti
Functions to extract the higher dimensions from ANALYZE/NIfTI data.
nsli(x) NSLI(x) ntim(x) NTIM(x)
nsli(x) NSLI(x) ntim(x) NTIM(x)
x |
is a three- or four-dimensional array (e.g., read in from an ANALYZE/NIfTI file). |
Simple calls to dim
to replicate the functionality of nrow
and
ncol
for higher dimensions of an array that are commonly required
when manipulating medical imaging data.
Third (slice) or fourth (time) dimension of the array.
Brandon Whitcher [email protected]
omax
Methods that act on the omax
field in the
NIfTI/ANALYZE header.
omax(object) ## S4 method for signature 'anlz' omax(object) omax(object) <- value ## S4 replacement method for signature 'anlz' omax(object) <- value
omax(object) ## S4 method for signature 'anlz' omax(object) omax(object) <- value ## S4 replacement method for signature 'anlz' omax(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
omin
Methods that act on the omin
field in the
NIfTI/ANALYZE header.
omin(object) ## S4 method for signature 'anlz' omin(object) omin(object) <- value ## S4 replacement method for signature 'anlz' omin(object) <- value
omin(object) ## S4 method for signature 'anlz' omin(object) omin(object) <- value ## S4 replacement method for signature 'anlz' omin(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
onefile
Specification for NIfTIChanges the magic
and vox_offset
slots to be
consistent with the onefile option in writeNIfTI
. As of
version 0.4.0, oro.nifti
did not support the "ni1"
magic type
for output.
onefile(img)
onefile(img)
img |
is a |
Object of class nifti
.
John Muschelli [email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
orient
Methods that act on the orient
field in the
NIfTI/ANALYZE header.
orient(object) ## S4 method for signature 'anlz' orient(object) orient(object) <- value ## S4 replacement method for signature 'anlz' orient(object) <- value
orient(object) ## S4 method for signature 'anlz' orient(object) orient(object) <- value ## S4 replacement method for signature 'anlz' orient(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Methods that act on the “qform” and “sform” information in the NIfTI header.
sform(object) ## S4 method for signature 'nifti' sform(object) qform(object) ## S4 method for signature 'nifti' qform(object)
sform(object) ## S4 method for signature 'nifti' sform(object) qform(object) ## S4 method for signature 'nifti' qform(object)
object |
is an object of class |
Extract or replace NIfTI description.
Brandon Whitcher [email protected]
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) sform(mniLR)
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) sform(mniLR)
origin
Methods that act on the origin
field in the
NIfTI/ANALYZE header.
origin(object) ## S4 method for signature 'nifti' origin(object) ## S4 method for signature 'anlz' origin(object) ## S4 method for signature 'ANY' origin(object) origin(object) <- value ## S4 replacement method for signature 'anlz' origin(object) <- value ## S4 replacement method for signature 'nifti' origin(object) <- value
origin(object) ## S4 method for signature 'nifti' origin(object) ## S4 method for signature 'anlz' origin(object) ## S4 method for signature 'ANY' origin(object) origin(object) <- value ## S4 replacement method for signature 'anlz' origin(object) <- value ## S4 replacement method for signature 'nifti' origin(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
fname = system.file("nifti", "mniRL.nii.gz", package = "oro.nifti") img = readNIfTI(fname) oimg = origin(img) stopifnot(all(oimg == c(-90, -126, -72))) zero_img = img origin(zero_img) = rep(0, 3) stopifnot(all(origin(zero_img) == 0))
fname = system.file("nifti", "mniRL.nii.gz", package = "oro.nifti") img = readNIfTI(fname) oimg = origin(img) stopifnot(all(oimg == c(-90, -126, -72))) zero_img = img origin(zero_img) = rep(0, 3) stopifnot(all(origin(zero_img) == 0))
Converts a nifti from oro.nifti to a niftiImage object from the RNifti package
oro2nii(image, verbose = FALSE)
oro2nii(image, verbose = FALSE)
image |
|
verbose |
print messages, passed to |
Object of class niftiImage
Produce orthographic display for nifti
, anlz
and afni
objects.
orthographic.nifti( x, y = NULL, xyz = NULL, w = 1, col = gray(0:64/64), col.y = hotmetal(), zlim = NULL, zlim.y = NULL, crosshairs = TRUE, col.crosshairs = "red", xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", text = NULL, text.color = "white", text.cex = 2, ... ) orthographic(x, ...) ## S4 method for signature 'nifti' orthographic( x, y = NULL, xyz = NULL, w = 1, col = gray(0:64/64), col.y = hotmetal(), zlim = NULL, zlim.y = NULL, crosshairs = TRUE, col.crosshairs = "red", xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", text = NULL, text.color = "white", text.cex = 2, ... ) ## S4 method for signature 'anlz' orthographic( x, y = NULL, xyz = NULL, w = 1, col = gray(0:64/64), col.y = hotmetal(), zlim = NULL, zlim.y = NULL, crosshairs = TRUE, col.crosshairs = "red", xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", text = NULL, text.color = "white", text.cex = 2, ... ) ## S4 method for signature 'array' orthographic(x, ...) ## S4 method for signature 'afni' orthographic(x, ...)
orthographic.nifti( x, y = NULL, xyz = NULL, w = 1, col = gray(0:64/64), col.y = hotmetal(), zlim = NULL, zlim.y = NULL, crosshairs = TRUE, col.crosshairs = "red", xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", text = NULL, text.color = "white", text.cex = 2, ... ) orthographic(x, ...) ## S4 method for signature 'nifti' orthographic( x, y = NULL, xyz = NULL, w = 1, col = gray(0:64/64), col.y = hotmetal(), zlim = NULL, zlim.y = NULL, crosshairs = TRUE, col.crosshairs = "red", xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", text = NULL, text.color = "white", text.cex = 2, ... ) ## S4 method for signature 'anlz' orthographic( x, y = NULL, xyz = NULL, w = 1, col = gray(0:64/64), col.y = hotmetal(), zlim = NULL, zlim.y = NULL, crosshairs = TRUE, col.crosshairs = "red", xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", text = NULL, text.color = "white", text.cex = 2, ... ) ## S4 method for signature 'array' orthographic(x, ...) ## S4 method for signature 'afni' orthographic(x, ...)
x |
is an object of class |
y |
is an object of class |
xyz |
is the coordinate for the center of the crosshairs. |
w |
is the time point to be displayed (4D arrays only). |
col |
is grayscale (by default). |
col.y |
is hotmetal (by default). |
zlim |
is the minimum and maximum ‘z’ values passed into
|
zlim.y |
is the minimum and maximum ‘z’ values passed into
|
crosshairs |
is a logical value for the presence of crosshairs in all three orthogonal planes (default = TRUE). |
col.crosshairs |
is the color of the crosshairs (default = red). |
xlab |
is set to "" since all margins are set to zero. |
ylab |
is set to "" since all margins are set to zero. |
axes |
is set to |
oma |
is the size of the outer margins in the |
mar |
is the number of lines of margin in the |
bg |
is the background color in the |
text |
allows the user to specify text to appear in the fourth (unused) pane. |
text.color |
is the color of the user-specified text (default = “white”. |
text.cex |
is the size of the user-specified text (default = 2). |
... |
other arguments to the |
Produce orthographic display
for x
.
Produce orthographic display for x
.
Produce orthographic display for x
.
Produce orthographic display for x
.
Brandon Whitcher [email protected]
image-methods
, overlay-methods
fname = system.file( file.path("nifti", "mniRL.nii.gz"), package = "oro.nifti") eve = readNIfTI(fname) orthographic(eve) image(eve, z = 45) image(eve, z = 45, plot.type = "single") image(eve, z = c(45, 50), plot.type = "single")
fname = system.file( file.path("nifti", "mniRL.nii.gz"), package = "oro.nifti") eve = readNIfTI(fname) orthographic(eve) image(eve, z = 45) image(eve, z = 45, plot.type = "single") image(eve, z = c(45, 50), plot.type = "single")
Methods for function overlay
overlay.nifti( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) overlay(x, y, ...) ## S4 method for signature 'nifti,missing' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'nifti,nifti' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'anlz,anlz' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'anlz,nifti' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'nifti,anlz' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'array,array' overlay(x, y, ...) ## S4 method for signature 'array,nifti' overlay(x, y, ...) ## S4 method for signature 'nifti,array' overlay(x, y, ...) ## S4 method for signature 'array,anlz' overlay(x, y, ...) ## S4 method for signature 'anlz,array' overlay(x, y, ...) ## S4 method for signature 'afni,afni' overlay(x, y, ...) ## S4 method for signature 'afni,array' overlay(x, y, ...)
overlay.nifti( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) overlay(x, y, ...) ## S4 method for signature 'nifti,missing' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'nifti,nifti' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'anlz,anlz' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'anlz,nifti' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'nifti,anlz' overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), plot.type = c("multiple", "single"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = FALSE, ... ) ## S4 method for signature 'array,array' overlay(x, y, ...) ## S4 method for signature 'array,nifti' overlay(x, y, ...) ## S4 method for signature 'nifti,array' overlay(x, y, ...) ## S4 method for signature 'array,anlz' overlay(x, y, ...) ## S4 method for signature 'anlz,array' overlay(x, y, ...) ## S4 method for signature 'afni,afni' overlay(x, y, ...) ## S4 method for signature 'afni,array' overlay(x, y, ...)
x , y
|
is an object of class |
z |
is the slice to be displayed (ignored when |
w |
is the time point to be displayed (4D arrays only). |
col.x |
is grayscale (by default). |
col.y |
is hotmetal (by default). |
zlim.x , zlim.y
|
are set to |
plane |
is the plane of acquisition to be displayed (choices are ‘axial’, ‘coronal’, ‘sagittal’). |
plot.type |
allows the choice between all slices being displayed, in a matrix (left-to-right, top-to-bottom), or a single slice. |
xlab |
is set to “” since all margins are set to zero. |
ylab |
is set to “” since all margins are set to zero. |
axes |
is set to |
oma |
is the size of the outer margins in the |
mar |
is the number of lines of margin in the |
bg |
is the background color in the |
NA.x |
Set any values of 0 in |
NA.y |
Set any values of 0 in |
... |
other arguments to the |
The image
command is used multiple times to simultaneously visualize
one of the three orthogonal planes in two multidimensional arrays, one on
top of the other, for medical imaging data.
Produce overlay of y
on x
.
Produce overlay of y
on x
.
Produce overlay of y
on x
.
Brandon Whitcher [email protected]
image-methods
, overlay-methods
patient_id
Methods that act on the patient_id
field in the
NIfTI/ANALYZE header.
patient_id(object) ## S4 method for signature 'anlz' patient_id(object) patient_id(object) <- value ## S4 replacement method for signature 'anlz' patient_id(object) <- value patient.id(object) ## S4 method for signature 'anlz' patient.id(object) patient.id(object) <- value ## S4 replacement method for signature 'anlz' patient.id(object) <- value
patient_id(object) ## S4 method for signature 'anlz' patient_id(object) patient_id(object) <- value ## S4 replacement method for signature 'anlz' patient_id(object) <- value patient.id(object) ## S4 method for signature 'anlz' patient.id(object) patient.id(object) <- value ## S4 replacement method for signature 'anlz' patient.id(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Given an orthogonal permutation matrix , an array of
dimensions and a one-dimensional representation of data. It will return a
transformed array with the transformed dimensions.
performPermutation(T, real.dimensions, data, verbose = FALSE)
performPermutation(T, real.dimensions, data, verbose = FALSE)
T |
is an orthogonal matrix. |
real.dimensions |
is a one-dimensional array, representing the length of dimensions in data. |
data |
is a one-dimensional representation of the data to be transformed. |
verbose |
is a logical variable (default = |
This function is mainly used by the reorient
function
to transform nifti data into neuroradiological convention.
Andrew Thornton [email protected]
pixdim
Methods that act on the pixdim
field in the
NIfTI/ANALYZE header.
pixdim(object) ## S4 method for signature 'nifti' pixdim(object) ## S4 method for signature 'ANY' pixdim(object) ## S4 method for signature 'anlz' pixdim(object) pixdim(object) <- value ## S4 replacement method for signature 'nifti' pixdim(object) <- value ## S4 replacement method for signature 'anlz' pixdim(object) <- value ## S4 replacement method for signature 'ANY' pixdim(object) <- value
pixdim(object) ## S4 method for signature 'nifti' pixdim(object) ## S4 method for signature 'ANY' pixdim(object) ## S4 method for signature 'anlz' pixdim(object) pixdim(object) <- value ## S4 replacement method for signature 'nifti' pixdim(object) <- value ## S4 replacement method for signature 'anlz' pixdim(object) <- value ## S4 replacement method for signature 'ANY' pixdim(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) pixdim(mniLR)
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_LR_nifti.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") download.file(url, urlfile, quiet=TRUE) ## End(Not run) urlfile <- file.path(system.file("nifti", package="oro.nifti"), "mniLR.nii.gz") mniLR <- readNIfTI(urlfile) pixdim(mniLR)
qform_code
Methods that act on the qform_code
field in the
NIfTI/ANALYZE header.
qform_code(object) ## S4 method for signature 'nifti' qform_code(object) qform_code(object) <- value ## S4 replacement method for signature 'nifti' qform_code(object) <- value qform.code(object) ## S4 method for signature 'nifti' qform.code(object) qform.code(object) <- value ## S4 replacement method for signature 'nifti' qform.code(object) <- value ## S4 method for signature 'niftiImage' qform_code(object) ## S4 replacement method for signature 'niftiImage' qform_code(object) <- value
qform_code(object) ## S4 method for signature 'nifti' qform_code(object) qform_code(object) <- value ## S4 replacement method for signature 'nifti' qform_code(object) <- value qform.code(object) ## S4 method for signature 'nifti' qform.code(object) qform.code(object) <- value ## S4 replacement method for signature 'nifti' qform.code(object) <- value ## S4 method for signature 'niftiImage' qform_code(object) ## S4 replacement method for signature 'niftiImage' qform_code(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qform_code(img) qform_code(img) = 8 stopifnot(qform_code(img) == 8)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qform_code(img) qform_code(img) = 8 stopifnot(qform_code(img) == 8)
qoffset_x
Methods that act on the qoffset_x
field in the
NIfTI/ANALYZE header.
qoffset_x(object) ## S4 method for signature 'nifti' qoffset_x(object) qoffset_x(object) <- value ## S4 replacement method for signature 'nifti' qoffset_x(object) <- value qoffset.x(object) ## S4 method for signature 'nifti' qoffset.x(object) qoffset.x(object) <- value ## S4 replacement method for signature 'nifti' qoffset.x(object) <- value ## S4 method for signature 'niftiImage' qoffset_x(object) ## S4 replacement method for signature 'niftiImage' qoffset_x(object) <- value
qoffset_x(object) ## S4 method for signature 'nifti' qoffset_x(object) qoffset_x(object) <- value ## S4 replacement method for signature 'nifti' qoffset_x(object) <- value qoffset.x(object) ## S4 method for signature 'nifti' qoffset.x(object) qoffset.x(object) <- value ## S4 replacement method for signature 'nifti' qoffset.x(object) <- value ## S4 method for signature 'niftiImage' qoffset_x(object) ## S4 replacement method for signature 'niftiImage' qoffset_x(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qoffset_x(img) qoffset_x(img) = 10 stopifnot(qoffset_x(img) == 10)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qoffset_x(img) qoffset_x(img) = 10 stopifnot(qoffset_x(img) == 10)
qoffset_y
Methods that act on the qoffset_y
field in the
NIfTI/ANALYZE header.
qoffset_y(object) ## S4 method for signature 'nifti' qoffset_y(object) qoffset_y(object) <- value ## S4 replacement method for signature 'nifti' qoffset_y(object) <- value qoffset.y(object) ## S4 method for signature 'nifti' qoffset.y(object) qoffset.y(object) <- value ## S4 replacement method for signature 'nifti' qoffset.y(object) <- value ## S4 method for signature 'niftiImage' qoffset_y(object) ## S4 replacement method for signature 'niftiImage' qoffset_y(object) <- value
qoffset_y(object) ## S4 method for signature 'nifti' qoffset_y(object) qoffset_y(object) <- value ## S4 replacement method for signature 'nifti' qoffset_y(object) <- value qoffset.y(object) ## S4 method for signature 'nifti' qoffset.y(object) qoffset.y(object) <- value ## S4 replacement method for signature 'nifti' qoffset.y(object) <- value ## S4 method for signature 'niftiImage' qoffset_y(object) ## S4 replacement method for signature 'niftiImage' qoffset_y(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qoffset_y(img) qoffset_y(img) = 10 stopifnot(qoffset_y(img) == 10)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qoffset_y(img) qoffset_y(img) = 10 stopifnot(qoffset_y(img) == 10)
qoffset_z
Methods that act on the qoffset_z
field in the
NIfTI/ANALYZE header.
qoffset_z(object) ## S4 method for signature 'nifti' qoffset_z(object) qoffset_z(object) <- value ## S4 replacement method for signature 'nifti' qoffset_z(object) <- value qoffset.z(object) ## S4 method for signature 'nifti' qoffset.z(object) qoffset.z(object) <- value ## S4 replacement method for signature 'nifti' qoffset.z(object) <- value ## S4 method for signature 'niftiImage' qoffset_z(object) ## S4 replacement method for signature 'niftiImage' qoffset_z(object) <- value
qoffset_z(object) ## S4 method for signature 'nifti' qoffset_z(object) qoffset_z(object) <- value ## S4 replacement method for signature 'nifti' qoffset_z(object) <- value qoffset.z(object) ## S4 method for signature 'nifti' qoffset.z(object) qoffset.z(object) <- value ## S4 replacement method for signature 'nifti' qoffset.z(object) <- value ## S4 method for signature 'niftiImage' qoffset_z(object) ## S4 replacement method for signature 'niftiImage' qoffset_z(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qoffset_z(img) qoffset_z(img) = 10 stopifnot(qoffset_z(img) == 10)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) qoffset_z(img) qoffset_z(img) = 10 stopifnot(qoffset_z(img) == 10)
quatern_b
Methods that act on the quatern_b
field in the
NIfTI/ANALYZE header.
quatern_b(object) ## S4 method for signature 'nifti' quatern_b(object) quatern_b(object) <- value ## S4 replacement method for signature 'nifti' quatern_b(object) <- value quatern.b(object) ## S4 method for signature 'nifti' quatern.b(object) quatern.b(object) <- value ## S4 replacement method for signature 'nifti' quatern.b(object) <- value ## S4 method for signature 'niftiImage' quatern_b(object) ## S4 replacement method for signature 'niftiImage' quatern_b(object) <- value
quatern_b(object) ## S4 method for signature 'nifti' quatern_b(object) quatern_b(object) <- value ## S4 replacement method for signature 'nifti' quatern_b(object) <- value quatern.b(object) ## S4 method for signature 'nifti' quatern.b(object) quatern.b(object) <- value ## S4 replacement method for signature 'nifti' quatern.b(object) <- value ## S4 method for signature 'niftiImage' quatern_b(object) ## S4 replacement method for signature 'niftiImage' quatern_b(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) quatern_b(img) quatern_b(img) = 3 stopifnot(quatern_b(img) == 3) quatern_c(img) quatern_c(img) = 3 stopifnot(quatern_c(img) == 3) quatern_d(img) quatern_d(img) = 3 stopifnot(quatern_d(img) == 3)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) quatern_b(img) quatern_b(img) = 3 stopifnot(quatern_b(img) == 3) quatern_c(img) quatern_c(img) = 3 stopifnot(quatern_c(img) == 3) quatern_d(img) quatern_d(img) = 3 stopifnot(quatern_d(img) == 3)
quatern_c
Methods that act on the quatern_c
field in the
NIfTI/ANALYZE header.
quatern_c(object) ## S4 method for signature 'nifti' quatern_c(object) quatern_c(object) <- value ## S4 replacement method for signature 'nifti' quatern_c(object) <- value quatern.c(object) ## S4 method for signature 'nifti' quatern.c(object) quatern.c(object) <- value ## S4 replacement method for signature 'nifti' quatern.c(object) <- value ## S4 method for signature 'niftiImage' quatern_c(object) ## S4 replacement method for signature 'niftiImage' quatern_c(object) <- value
quatern_c(object) ## S4 method for signature 'nifti' quatern_c(object) quatern_c(object) <- value ## S4 replacement method for signature 'nifti' quatern_c(object) <- value quatern.c(object) ## S4 method for signature 'nifti' quatern.c(object) quatern.c(object) <- value ## S4 replacement method for signature 'nifti' quatern.c(object) <- value ## S4 method for signature 'niftiImage' quatern_c(object) ## S4 replacement method for signature 'niftiImage' quatern_c(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
quatern_d
Methods that act on the quatern_d
field in the
NIfTI/ANALYZE header.
quatern_d(object) ## S4 method for signature 'nifti' quatern_d(object) quatern_d(object) <- value ## S4 replacement method for signature 'nifti' quatern_d(object) <- value quatern.d(object) ## S4 method for signature 'nifti' quatern.d(object) quatern.d(object) <- value ## S4 replacement method for signature 'nifti' quatern.d(object) <- value ## S4 method for signature 'niftiImage' quatern_d(object) ## S4 replacement method for signature 'niftiImage' quatern_d(object) <- value
quatern_d(object) ## S4 method for signature 'nifti' quatern_d(object) quatern_d(object) <- value ## S4 replacement method for signature 'nifti' quatern_d(object) <- value quatern.d(object) ## S4 method for signature 'nifti' quatern.d(object) quatern.d(object) <- value ## S4 replacement method for signature 'nifti' quatern.d(object) <- value ## S4 method for signature 'niftiImage' quatern_d(object) ## S4 replacement method for signature 'niftiImage' quatern_d(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
The affine/rotation matrix is calculated from the quaternion
parameters.
quaternion2rotation(b, c, d, tol = 1e-07) quaternion2mat44(nim, tol = 1e-07)
quaternion2rotation(b, c, d, tol = 1e-07) quaternion2mat44(nim, tol = 1e-07)
b |
is the quaternion |
c |
is the quaternion |
d |
is the quaternion |
tol |
is a very small value used to judge if a number is essentially zero. |
nim |
is an object of class |
The quaternion representation is chosen for its compactness in representing
rotations. The orientation of the axes relative to the
axes in 3D space is specified using a unit quaternion
, where
. The
values are all that is needed, since we require that
be non-negative.
The
values are stored in the (
quatern_b
,
quatern_c
, quatern_d
) fields.
The (proper) rotation matrix or
affine matrix.
Brandon Whitcher [email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
## This R matrix is represented by quaternion [a,b,c,d] = [0,1,0,0] ## (which encodes a 180 degree rotation about the x-axis). (R <- quaternion2rotation(1, 0, 0))
## This R matrix is represented by quaternion [a,b,c,d] = [0,1,0,0] ## (which encodes a 180 degree rotation about the x-axis). (R <- quaternion2rotation(1, 0, 0))
These functions read in the header information and
multidimensional array from a binary file in AFNI format into a
afni
-class object.
readAFNI(fname, vol = NULL, verbose = FALSE, warn = -1, call = NULL)
readAFNI(fname, vol = NULL, verbose = FALSE, warn = -1, call = NULL)
fname |
is the file name of the AFNI file. |
vol |
vector of brick numbers to be read from file. |
verbose |
is a logical variable (default = |
warn |
is a number to regulate the display of warnings (default
= -1). See |
call |
keeps track of the current function call for use in the AFNI extension. |
The readAFNI
function utilizes internal methods readBin
and
readLines
to efficiently extract information from the header and
binary file(s). Compression is allowed on the BRIK file using gzip.
Current acceptable data types include
DT SIGNED SHORT (16 bits per voxel)
DT FLOAT (32 bits per voxel)
DT COMPLEX (128 bits per voxel)
object of class afni
Karsten Tabelow [email protected]
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
## Not run: ## Taken from the AFNI Matlab Library ## http://afni.nimh.nih.gov/pub/dist/data/afni_matlab_data.tgz afni.path <- system.file("afni", package="oro.nifti") orig <- readAFNI(file.path(afni.path, "ARzs_CW_avvr.DEL+orig")) image(orig, zlim=c(0.5,256), oma=rep(2,4)) orthographic(orig, zlim=c(0.5,256), oma=rep(2,4)) ## Taken from the AFNI installation TT <- readAFNI(file.path(afni.path, "TT_N27_EZ_LR+tlrc")) image(TT, zlim=c(0.5,256), oma=rep(2,4)) orthographic(TT, zlim=c(0.5,256), oma=rep(2,4)) ## End(Not run)
## Not run: ## Taken from the AFNI Matlab Library ## http://afni.nimh.nih.gov/pub/dist/data/afni_matlab_data.tgz afni.path <- system.file("afni", package="oro.nifti") orig <- readAFNI(file.path(afni.path, "ARzs_CW_avvr.DEL+orig")) image(orig, zlim=c(0.5,256), oma=rep(2,4)) orthographic(orig, zlim=c(0.5,256), oma=rep(2,4)) ## Taken from the AFNI installation TT <- readAFNI(file.path(afni.path, "TT_N27_EZ_LR+tlrc")) image(TT, zlim=c(0.5,256), oma=rep(2,4)) orthographic(TT, zlim=c(0.5,256), oma=rep(2,4)) ## End(Not run)
These functions read in the header information and multi-dimensional array from a binary file in Analyze 7.5 format.
readANALYZE(fname, SPM = FALSE, verbose = FALSE, warn = -1)
readANALYZE(fname, SPM = FALSE, verbose = FALSE, warn = -1)
fname |
Pathname of the Analyze pair of files .img and .hdr without the suffix. |
SPM |
is a logical variable (default = |
verbose |
is a logical variable (default = |
warn |
is a number to regulate the display of warnings (default = -1).
See |
The internal functions readBin
and rawToChar
are utilized in
order to efficiently extract information from a binary file. The types of
data are limited to 1- and 2-byte integers, 4-byte floats and 8-byte
doubles.
An object of class anlz
is produced.
Brandon Whitcher [email protected],
Volker Schmid
[email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
## avg152T1 anlz.path <- system.file("anlz", package="oro.nifti") mni152 <- readANALYZE(file.path(anlz.path, "avg152T1")) image(mni152, oma=rep(2,4)) orthographic(mni152, oma=rep(2,4))
## avg152T1 anlz.path <- system.file("anlz", package="oro.nifti") mni152 <- readANALYZE(file.path(anlz.path, "avg152T1")) image(mni152, oma=rep(2,4)) orthographic(mni152, oma=rep(2,4))
These functions read in the header information and multidimensional array
from a binary file in NIfTI-1 format into a nifti
-class
object.
readNIfTI( fname, verbose = FALSE, warn = -1, reorient = TRUE, call = NULL, read_data = TRUE, rescale_data = TRUE ) nifti_header(fname, verbose = FALSE, warn = -1)
readNIfTI( fname, verbose = FALSE, warn = -1, reorient = TRUE, call = NULL, read_data = TRUE, rescale_data = TRUE ) nifti_header(fname, verbose = FALSE, warn = -1)
fname |
is the file name of the NIfTI file(s). |
verbose |
is a logical variable (default = |
warn |
is a number to regulate the display of warnings (default = -1).
See |
reorient |
is a logical variable (default = |
call |
keeps track of the current function call for use in the NIfTI extension. |
read_data |
Should the data be read in? If this is FALSE, then an array of NAs are given instead of the true data. Useful if you are simply interested in the header. |
rescale_data |
Should the data be rescaled using the slope and intercept values? If so, slope and intercept will be reset |
The readNIfTI
function utilizes internal methods readBin
and
readChar
to efficiently extract information from the binary file(s).
Current acceptable data types include
BINARY (1 bit per voxel)
SIGNED SHORT (16 bits per voxel)
SINGED INT (32 bits per voxel)
FLOAT (32 bits per voxel)
DOUBLE (64 bits per voxel)
UNSIGNED SHORT (16 bits per voxel)
UNSIGNED INT (32 bits per voxel)
An object of class nifti
.
Brandon Whitcher [email protected],
Volker Schmid
[email protected],
Andrew Thornton
[email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/filtered_func_data.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "filtered_func_data") download.file(url, urlfile, quiet=TRUE) ## End(Not run) ## The NIfTI file provided here contains the first 18 volumes (10%) ## of the original data set urlfile <- file.path(system.file("nifti", package="oro.nifti"), "filtered_func_data") (ffd <- readNIfTI(urlfile)) image(ffd, oma=rep(2,4)) orthographic(ffd, oma=rep(2,4)) ## Not run: ## 27 scans of Colin Holmes (MNI) brain co-registered and averaged ## NIfTI two-file format URL <- "http://imaging.mrc-cbu.cam.ac.uk/downloads/Colin/colin_1mm.tgz" urlfile <- file.path(tempdir(), "colin_1mm.tgz") download.file(URL, dest=urlfile, quiet=TRUE) untar(urlfile, exdir=tempdir()) colin <- readNIfTI(file.path(tempdir(), "colin_1mm")) image(colin, oma=rep(2,4)) orthographic(colin, oma=rep(2,4)) ## End(Not run)
## Not run: url <- "http://nifti.nimh.nih.gov/nifti-1/data/filtered_func_data.nii.gz" urlfile <- file.path(system.file("nifti", package="oro.nifti"), "filtered_func_data") download.file(url, urlfile, quiet=TRUE) ## End(Not run) ## The NIfTI file provided here contains the first 18 volumes (10%) ## of the original data set urlfile <- file.path(system.file("nifti", package="oro.nifti"), "filtered_func_data") (ffd <- readNIfTI(urlfile)) image(ffd, oma=rep(2,4)) orthographic(ffd, oma=rep(2,4)) ## Not run: ## 27 scans of Colin Holmes (MNI) brain co-registered and averaged ## NIfTI two-file format URL <- "http://imaging.mrc-cbu.cam.ac.uk/downloads/Colin/colin_1mm.tgz" urlfile <- file.path(tempdir(), "colin_1mm.tgz") download.file(URL, dest=urlfile, quiet=TRUE) untar(urlfile, exdir=tempdir()) colin <- readNIfTI(file.path(tempdir(), "colin_1mm")) image(colin, oma=rep(2,4)) orthographic(colin, oma=rep(2,4)) ## End(Not run)
regular
Methods that act on the regular
field in the
NIfTI/ANALYZE header.
regular(object) ## S4 method for signature 'nifti' regular(object) ## S4 method for signature 'anlz' regular(object) regular(object) <- value ## S4 replacement method for signature 'nifti' regular(object) <- value ## S4 replacement method for signature 'anlz' regular(object) <- value
regular(object) ## S4 method for signature 'nifti' regular(object) ## S4 method for signature 'anlz' regular(object) regular(object) <- value ## S4 replacement method for signature 'nifti' regular(object) <- value ## S4 replacement method for signature 'anlz' regular(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Transforms in the NIfTI header are parsed and normalized versions of these transforms are applied.
reorient(nim, data, verbose = FALSE, invert = FALSE, tol = 1e-07) inverseReorient(nim, verbose = FALSE)
reorient(nim, data, verbose = FALSE, invert = FALSE, tol = 1e-07) inverseReorient(nim, verbose = FALSE)
nim |
is an object of class |
data |
is an array associated with |
verbose |
is a logical variable (default = |
invert |
stores the inverse transform. |
tol |
is a very small value used to judge if a number is essentially zero. |
This function utilizes the performPermutation
function
internally.
Andrew Thornton [email protected],
Brandon Whitcher [email protected]
Forces image scl_slope
to 1 and scl_inter
to be 0 of slots of class nifti
. This is so that when images are
rendered/written, the values correspond to those in the array (stored in the
.Data
slot) and are not scaled.
resetSlopeIntercept(img) zero_trans(img)
resetSlopeIntercept(img) zero_trans(img)
img |
is a |
An object of the same type passed.
John Muschelli [email protected]
Simple function(s) that remove file extensions commonly found when using NIfTI-1 or ANALYZE format files.
rmniigz(x) rmnii(x) rmgz(x) rmhdrgz(x) rmhdr(x) rmimggz(x) rmimg(x)
rmniigz(x) rmnii(x) rmgz(x) rmhdrgz(x) rmhdr(x) rmimggz(x) rmimg(x)
x |
is the file name. |
The file name without offending suffix.
Brandon Whitcher [email protected]
scannum
Methods that act on the scannum
field in the
NIfTI/ANALYZE header.
scannum(object) ## S4 method for signature 'anlz' scannum(object) scannum(object) <- value ## S4 replacement method for signature 'anlz' scannum(object) <- value
scannum(object) ## S4 method for signature 'anlz' scannum(object) scannum(object) <- value ## S4 replacement method for signature 'anlz' scannum(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
scl_inter
Methods that act on the scl_inter
field in the
NIfTI/ANALYZE header.
scl_inter(object) ## S4 method for signature 'nifti' scl_inter(object) scl_inter(object) <- value ## S4 replacement method for signature 'nifti' scl_inter(object) <- value scl.inter(object) ## S4 method for signature 'nifti' scl.inter(object) scl.inter(object) <- value ## S4 replacement method for signature 'nifti' scl.inter(object) <- value ## S4 method for signature 'niftiImage' scl_inter(object) ## S4 method for signature 'niftiImage' scl.inter(object)
scl_inter(object) ## S4 method for signature 'nifti' scl_inter(object) scl_inter(object) <- value ## S4 replacement method for signature 'nifti' scl_inter(object) <- value scl.inter(object) ## S4 method for signature 'nifti' scl.inter(object) scl.inter(object) <- value ## S4 replacement method for signature 'nifti' scl.inter(object) <- value ## S4 method for signature 'niftiImage' scl_inter(object) ## S4 method for signature 'niftiImage' scl.inter(object)
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) scl_inter(img) scl.inter(img)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) scl_inter(img) scl.inter(img)
scl_slope
Methods that act on the scl_slope
field in the
NIfTI/ANALYZE header.
scl_slope(object) ## S4 method for signature 'nifti' scl_slope(object) scl_slope(object) <- value ## S4 replacement method for signature 'nifti' scl_slope(object) <- value scl.slope(object) ## S4 method for signature 'nifti' scl.slope(object) scl.slope(object) <- value ## S4 replacement method for signature 'nifti' scl.slope(object) <- value ## S4 method for signature 'niftiImage' scl_slope(object) ## S4 method for signature 'niftiImage' scl.slope(object)
scl_slope(object) ## S4 method for signature 'nifti' scl_slope(object) scl_slope(object) <- value ## S4 replacement method for signature 'nifti' scl_slope(object) <- value scl.slope(object) ## S4 method for signature 'nifti' scl.slope(object) scl.slope(object) <- value ## S4 replacement method for signature 'nifti' scl.slope(object) <- value ## S4 method for signature 'niftiImage' scl_slope(object) ## S4 method for signature 'niftiImage' scl.slope(object)
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) scl_slope(img) scl.slope(img)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) scl_slope(img) scl.slope(img)
session_error
Methods that act on the session_error
field in the
NIfTI/ANALYZE header.
session_error(object) ## S4 method for signature 'nifti' session_error(object) ## S4 method for signature 'anlz' session_error(object) session_error(object) <- value ## S4 replacement method for signature 'nifti' session_error(object) <- value ## S4 replacement method for signature 'anlz' session_error(object) <- value session.error(object) ## S4 method for signature 'nifti' session.error(object) ## S4 method for signature 'anlz' session.error(object) session.error(object) <- value ## S4 replacement method for signature 'nifti' session.error(object) <- value ## S4 replacement method for signature 'anlz' session.error(object) <- value
session_error(object) ## S4 method for signature 'nifti' session_error(object) ## S4 method for signature 'anlz' session_error(object) session_error(object) <- value ## S4 replacement method for signature 'nifti' session_error(object) <- value ## S4 replacement method for signature 'anlz' session_error(object) <- value session.error(object) ## S4 method for signature 'nifti' session.error(object) ## S4 method for signature 'anlz' session.error(object) session.error(object) <- value ## S4 replacement method for signature 'nifti' session.error(object) <- value ## S4 replacement method for signature 'anlz' session.error(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
sform_code
Methods that act on the sform_code
field in the
NIfTI/ANALYZE header.
sform_code(object) ## S4 method for signature 'nifti' sform_code(object) sform_code(object) <- value ## S4 replacement method for signature 'nifti' sform_code(object) <- value sform.code(object) ## S4 method for signature 'nifti' sform.code(object) sform.code(object) <- value ## S4 replacement method for signature 'nifti' sform.code(object) <- value ## S4 method for signature 'niftiImage' sform_code(object) ## S4 replacement method for signature 'niftiImage' sform_code(object) <- value
sform_code(object) ## S4 method for signature 'nifti' sform_code(object) sform_code(object) <- value ## S4 replacement method for signature 'nifti' sform_code(object) <- value sform.code(object) ## S4 method for signature 'nifti' sform.code(object) sform.code(object) <- value ## S4 replacement method for signature 'nifti' sform.code(object) <- value ## S4 method for signature 'niftiImage' sform_code(object) ## S4 replacement method for signature 'niftiImage' sform_code(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) sform_code(img) sform_code(img) = 4 stopifnot(sform_code(img) == 4)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) sform_code(img) sform_code(img) = 4 stopifnot(sform_code(img) == 4)
sizeof_hdr
Methods that act on the sizeof_hdr
field in the
NIfTI/ANALYZE header.
sizeof_hdr(object) ## S4 method for signature 'nifti' sizeof_hdr(object) ## S4 method for signature 'anlz' sizeof_hdr(object) sizeof.hdr(object) ## S4 method for signature 'nifti' sizeof.hdr(object) ## S4 method for signature 'anlz' sizeof.hdr(object) sizeof_hdr(object) <- value ## S4 replacement method for signature 'nifti' sizeof_hdr(object) <- value ## S4 replacement method for signature 'anlz' sizeof_hdr(object) <- value
sizeof_hdr(object) ## S4 method for signature 'nifti' sizeof_hdr(object) ## S4 method for signature 'anlz' sizeof_hdr(object) sizeof.hdr(object) ## S4 method for signature 'nifti' sizeof.hdr(object) ## S4 method for signature 'anlz' sizeof.hdr(object) sizeof_hdr(object) <- value ## S4 replacement method for signature 'nifti' sizeof_hdr(object) <- value ## S4 replacement method for signature 'anlz' sizeof_hdr(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
slice_code
Methods that act on the slice_code
field in the
NIfTI/ANALYZE header.
slice_code(object) ## S4 method for signature 'nifti' slice_code(object) slice_code(object) <- value ## S4 replacement method for signature 'nifti' slice_code(object) <- value slice.code(object) ## S4 method for signature 'nifti' slice.code(object) slice.code(object) <- value ## S4 replacement method for signature 'nifti' slice.code(object) <- value ## S4 method for signature 'niftiImage' slice_code(object) ## S4 replacement method for signature 'niftiImage' slice_code(object) <- value
slice_code(object) ## S4 method for signature 'nifti' slice_code(object) slice_code(object) <- value ## S4 replacement method for signature 'nifti' slice_code(object) <- value slice.code(object) ## S4 method for signature 'nifti' slice.code(object) slice.code(object) <- value ## S4 replacement method for signature 'nifti' slice.code(object) <- value ## S4 method for signature 'niftiImage' slice_code(object) ## S4 replacement method for signature 'niftiImage' slice_code(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_code(img) slice_code(img) = 8 stopifnot(slice_code(img) == 8)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_code(img) slice_code(img) = 8 stopifnot(slice_code(img) == 8)
slice_duration
Methods that act on the slice_duration
field in the
NIfTI/ANALYZE header.
slice_duration(object) ## S4 method for signature 'nifti' slice_duration(object) slice_duration(object) <- value ## S4 replacement method for signature 'nifti' slice_duration(object) <- value slice.duration(object) ## S4 method for signature 'nifti' slice.duration(object) slice.duration(object) <- value ## S4 replacement method for signature 'nifti' slice.duration(object) <- value ## S4 method for signature 'niftiImage' slice_duration(object) ## S4 replacement method for signature 'niftiImage' slice_duration(object) <- value
slice_duration(object) ## S4 method for signature 'nifti' slice_duration(object) slice_duration(object) <- value ## S4 replacement method for signature 'nifti' slice_duration(object) <- value slice.duration(object) ## S4 method for signature 'nifti' slice.duration(object) slice.duration(object) <- value ## S4 replacement method for signature 'nifti' slice.duration(object) <- value ## S4 method for signature 'niftiImage' slice_duration(object) ## S4 replacement method for signature 'niftiImage' slice_duration(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_duration(img) slice_duration(img) = 8 stopifnot(slice_duration(img) == 8)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_duration(img) slice_duration(img) = 8 stopifnot(slice_duration(img) == 8)
slice_end
Methods that act on the slice_end
field in the
NIfTI/ANALYZE header.
slice_end(object) ## S4 method for signature 'nifti' slice_end(object) slice_end(object) <- value ## S4 replacement method for signature 'nifti' slice_end(object) <- value slice.end(object) ## S4 method for signature 'nifti' slice.end(object) slice.end(object) <- value ## S4 replacement method for signature 'nifti' slice.end(object) <- value ## S4 method for signature 'niftiImage' slice_end(object) ## S4 replacement method for signature 'niftiImage' slice_end(object) <- value ## S4 method for signature 'niftiImage' slice.end(object) ## S4 replacement method for signature 'niftiImage' slice.end(object) <- value
slice_end(object) ## S4 method for signature 'nifti' slice_end(object) slice_end(object) <- value ## S4 replacement method for signature 'nifti' slice_end(object) <- value slice.end(object) ## S4 method for signature 'nifti' slice.end(object) slice.end(object) <- value ## S4 replacement method for signature 'nifti' slice.end(object) <- value ## S4 method for signature 'niftiImage' slice_end(object) ## S4 replacement method for signature 'niftiImage' slice_end(object) <- value ## S4 method for signature 'niftiImage' slice.end(object) ## S4 replacement method for signature 'niftiImage' slice.end(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_end(img) slice_end(img) = 4 stopifnot(slice_end(img) == 4) slice.end(img) slice.end(img) = 0
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_end(img) slice_end(img) = 4 stopifnot(slice_end(img) == 4) slice.end(img) slice.end(img) = 0
Methods for function slice_overlay
slice_overlay.nifti( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) slice_overlay(x, y, ...) ## S4 method for signature 'nifti,missing' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'nifti,nifti' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'anlz,anlz' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'anlz,nifti' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'nifti,anlz' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'array,array' slice_overlay(x, y, ...) ## S4 method for signature 'array,nifti' slice_overlay(x, y, ...) ## S4 method for signature 'nifti,array' slice_overlay(x, y, ...) ## S4 method for signature 'array,anlz' slice_overlay(x, y, ...) ## S4 method for signature 'anlz,array' slice_overlay(x, y, ...) ## S4 method for signature 'afni,afni' slice_overlay(x, y, ...) ## S4 method for signature 'afni,array' slice_overlay(x, y, ...)
slice_overlay.nifti( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) slice_overlay(x, y, ...) ## S4 method for signature 'nifti,missing' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'nifti,nifti' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'anlz,anlz' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'anlz,nifti' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'nifti,anlz' slice_overlay( x, y, z = 1, w = 1, col.x = gray(0:64/64), col.y = hotmetal(), zlim.x = NULL, zlim.y = NULL, plane = c("axial", "coronal", "sagittal"), xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", NA.x = FALSE, NA.y = TRUE, useRaster = TRUE, ... ) ## S4 method for signature 'array,array' slice_overlay(x, y, ...) ## S4 method for signature 'array,nifti' slice_overlay(x, y, ...) ## S4 method for signature 'nifti,array' slice_overlay(x, y, ...) ## S4 method for signature 'array,anlz' slice_overlay(x, y, ...) ## S4 method for signature 'anlz,array' slice_overlay(x, y, ...) ## S4 method for signature 'afni,afni' slice_overlay(x, y, ...) ## S4 method for signature 'afni,array' slice_overlay(x, y, ...)
x , y
|
is an object of class |
z |
is the slice to be displayed (ignored when |
w |
is the time point to be displayed (4D arrays only). |
col.x |
is grayscale (by default). |
col.y |
is hotmetal (by default). |
zlim.x , zlim.y
|
are set to |
plane |
is the plane of acquisition to be displayed (choices are ‘axial’, ‘coronal’, ‘sagittal’). |
xlab |
is set to “” since all margins are set to zero. |
ylab |
is set to “” since all margins are set to zero. |
axes |
is set to |
oma |
is the size of the outer margins in the |
mar |
is the number of lines of margin in the |
bg |
is the background color in the |
NA.x |
Set any values of 0 in |
NA.y |
Set any values of 0 in |
useRaster |
if |
... |
other arguments to the |
The image
command is used multiple times to simultaneously visualize
one of the three orthogonal planes in two multidimensional arrays, one on
top of the other, for medical imaging data.
Produce slice_overlay of y
on x
.
Produce slice_overlay of y
on x
.
Produce slice_overlay of y
on x
.
Brandon Whitcher [email protected]
image-methods
, slice_overlay-methods
slice_start
Methods that act on the slice_start
field in the
NIfTI/ANALYZE header.
slice_start(object) ## S4 method for signature 'nifti' slice_start(object) slice_start(object) <- value ## S4 replacement method for signature 'nifti' slice_start(object) <- value slice.start(object) ## S4 method for signature 'nifti' slice.start(object) slice.start(object) <- value ## S4 replacement method for signature 'nifti' slice.start(object) <- value ## S4 method for signature 'niftiImage' slice_start(object) ## S4 replacement method for signature 'niftiImage' slice_start(object) <- value ## S4 method for signature 'niftiImage' slice.start(object) ## S4 replacement method for signature 'niftiImage' slice.start(object) <- value
slice_start(object) ## S4 method for signature 'nifti' slice_start(object) slice_start(object) <- value ## S4 replacement method for signature 'nifti' slice_start(object) <- value slice.start(object) ## S4 method for signature 'nifti' slice.start(object) slice.start(object) <- value ## S4 replacement method for signature 'nifti' slice.start(object) <- value ## S4 method for signature 'niftiImage' slice_start(object) ## S4 replacement method for signature 'niftiImage' slice_start(object) <- value ## S4 method for signature 'niftiImage' slice.start(object) ## S4 replacement method for signature 'niftiImage' slice.start(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_start(img) slice_start(img) = 4 stopifnot(slice_start(img) == 4) slice.start(img) slice.start(img) = 0
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) slice_start(img) slice_start(img) = 4 stopifnot(slice_start(img) == 4) slice.start(img) slice.start(img) = 0
Produce “lightbox” layout of slices for nifti
, anlz
and
afni
objects.
slice(x, ...) ## S4 method for signature 'nifti' slice( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", useRaster = TRUE, ... ) ## S4 method for signature 'anlz' slice( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", useRaster = TRUE, ... ) ## S4 method for signature 'array' slice(x, ...) ## S4 method for signature 'afni' slice(x, ...)
slice(x, ...) ## S4 method for signature 'nifti' slice( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", useRaster = TRUE, ... ) ## S4 method for signature 'anlz' slice( x, z = 1, w = 1, col = gray(0:64/64), plane = c("axial", "coronal", "sagittal"), zlim = NULL, xlab = "", ylab = "", axes = FALSE, oma = rep(0, 4), mar = rep(0, 4), bg = "black", useRaster = TRUE, ... ) ## S4 method for signature 'array' slice(x, ...) ## S4 method for signature 'afni' slice(x, ...)
x |
is an object of class |
... |
other arguments to the |
z |
is the slice to be displayed (ignored when |
w |
is the time point to be displayed (4D arrays only). |
col |
is grayscale (by default). |
plane |
is the plane of acquisition to be displayed (choices are ‘axial’, ‘coronal’, ‘sagittal’). |
zlim |
is set to |
xlab |
is set to “” since all margins are set to zero. |
ylab |
is set to “” since all margins are set to zero. |
axes |
is set to |
oma |
is the size of the outer margins in the |
mar |
is the number of lines of margin in the |
bg |
is the background color in the |
useRaster |
if |
Uses the S3 generic function slice
, with medical-image friendly
settings, to display nifti
, anlz
and afni
class objects
in a “lightbox” layout.
Generic function: see
image
.
Produce images for
x
.
Produce images for x
.
Produce images for x
.
Brandon Whitcher [email protected]
orthographic-methods
, image-methods
smax
Methods that act on the smax
field in the
NIfTI/ANALYZE header.
smax(object) ## S4 method for signature 'anlz' smax(object) smax(object) <- value ## S4 replacement method for signature 'anlz' smax(object) <- value
smax(object) ## S4 method for signature 'anlz' smax(object) smax(object) <- value ## S4 replacement method for signature 'anlz' smax(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
smin
Methods that act on the smin
field in the
NIfTI/ANALYZE header.
smin(object) ## S4 method for signature 'anlz' smin(object) smin(object) <- value ## S4 replacement method for signature 'anlz' smin(object) <- value
smin(object) ## S4 method for signature 'anlz' smin(object) smin(object) <- value ## S4 replacement method for signature 'anlz' smin(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
srow_x
Methods that act on the srow_x
field in the
NIfTI/ANALYZE header.
srow_x(object) ## S4 method for signature 'nifti' srow_x(object) srow_x(object) <- value ## S4 replacement method for signature 'nifti' srow_x(object) <- value srow.x(object) ## S4 method for signature 'nifti' srow.x(object) srow.x(object) <- value ## S4 replacement method for signature 'nifti' srow.x(object) <- value ## S4 method for signature 'niftiImage' srow_x(object) ## S4 replacement method for signature 'niftiImage' srow_x(object) <- value
srow_x(object) ## S4 method for signature 'nifti' srow_x(object) srow_x(object) <- value ## S4 replacement method for signature 'nifti' srow_x(object) <- value srow.x(object) ## S4 method for signature 'nifti' srow.x(object) srow.x(object) <- value ## S4 replacement method for signature 'nifti' srow.x(object) <- value ## S4 method for signature 'niftiImage' srow_x(object) ## S4 replacement method for signature 'niftiImage' srow_x(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) srow_x(img) srow_x(img) = rep(0, 4) stopifnot(srow_x(img) == rep(0, 4)) srow_y(img) srow_y(img) = rep(0, 4) stopifnot(srow_y(img) == rep(0, 4)) srow_z(img) srow_z(img) = rep(0, 4) stopifnot(srow_z(img) == rep(0, 4))
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) srow_x(img) srow_x(img) = rep(0, 4) stopifnot(srow_x(img) == rep(0, 4)) srow_y(img) srow_y(img) = rep(0, 4) stopifnot(srow_y(img) == rep(0, 4)) srow_z(img) srow_z(img) = rep(0, 4) stopifnot(srow_z(img) == rep(0, 4))
srow_y
Methods that act on the srow_y
field in the
NIfTI/ANALYZE header.
srow_y(object) ## S4 method for signature 'nifti' srow_y(object) srow_y(object) <- value ## S4 replacement method for signature 'nifti' srow_y(object) <- value srow.y(object) ## S4 method for signature 'nifti' srow.y(object) srow.y(object) <- value ## S4 replacement method for signature 'nifti' srow.y(object) <- value ## S4 method for signature 'niftiImage' srow_y(object) ## S4 replacement method for signature 'niftiImage' srow_y(object) <- value
srow_y(object) ## S4 method for signature 'nifti' srow_y(object) srow_y(object) <- value ## S4 replacement method for signature 'nifti' srow_y(object) <- value srow.y(object) ## S4 method for signature 'nifti' srow.y(object) srow.y(object) <- value ## S4 replacement method for signature 'nifti' srow.y(object) <- value ## S4 method for signature 'niftiImage' srow_y(object) ## S4 replacement method for signature 'niftiImage' srow_y(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
srow_z
Methods that act on the srow_z
field in the
NIfTI/ANALYZE header.
srow_z(object) ## S4 method for signature 'nifti' srow_z(object) srow_z(object) <- value ## S4 replacement method for signature 'nifti' srow_z(object) <- value srow.z(object) ## S4 method for signature 'nifti' srow.z(object) srow.z(object) <- value ## S4 replacement method for signature 'nifti' srow.z(object) <- value ## S4 method for signature 'niftiImage' srow_z(object) ## S4 replacement method for signature 'niftiImage' srow_z(object) <- value
srow_z(object) ## S4 method for signature 'nifti' srow_z(object) srow_z(object) <- value ## S4 replacement method for signature 'nifti' srow_z(object) <- value srow.z(object) ## S4 method for signature 'nifti' srow.z(object) srow.z(object) <- value ## S4 replacement method for signature 'nifti' srow.z(object) <- value ## S4 method for signature 'niftiImage' srow_z(object) ## S4 replacement method for signature 'niftiImage' srow_z(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
start_field
Methods that act on the start_field
field in the
NIfTI/ANALYZE header.
start_field(object) ## S4 method for signature 'anlz' start_field(object) start_field(object) <- value ## S4 replacement method for signature 'anlz' start_field(object) <- value
start_field(object) ## S4 method for signature 'anlz' start_field(object) start_field(object) <- value ## S4 replacement method for signature 'anlz' start_field(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
A pleasing rainbow style color table patterned after that used in Matlab.
tim.colors(n = 64)
tim.colors(n = 64)
n |
is the number of color levels (default = 64). |
Based on the tim.colors
function in the fields package.
The tim.colors
function here has been modified to break any dependence
on code in the fields package. Spline interpolation
(interpSpline
) is used when the number of requested colors is not the
default.
A vector of character strings giving the colors in hexadecimal format.
Tim Hoar (GSP-NCAR); modified by Brandon Whitcher
hotmetal
, topo.colors
,
terrain.colors
tim.colors(10) image(outer(1:20, 1:20, "+"), col=tim.colors(75), main="tim.colors")
tim.colors(10) image(outer(1:20, 1:20, "+"), col=tim.colors(75), main="tim.colors")
toffset
Methods that act on the toffset
field in the
NIfTI/ANALYZE header.
toffset(object) ## S4 method for signature 'nifti' toffset(object) toffset(object) <- value ## S4 replacement method for signature 'nifti' toffset(object) <- value ## S4 method for signature 'niftiImage' toffset(object) ## S4 replacement method for signature 'niftiImage' toffset(object) <- value
toffset(object) ## S4 method for signature 'nifti' toffset(object) toffset(object) <- value ## S4 replacement method for signature 'nifti' toffset(object) <- value ## S4 method for signature 'niftiImage' toffset(object) ## S4 replacement method for signature 'niftiImage' toffset(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) toffset(img) toffset(img) = 8 stopifnot(toffset(img) == 8)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) toffset(img) toffset(img) = 8 stopifnot(toffset(img) == 8)
Translates a voxel index into the continuous coordinate space defined by the NIfTI qform and sform information.
translateCoordinate(i, nim, verbose = FALSE)
translateCoordinate(i, nim, verbose = FALSE)
i |
An index vector in |
nim |
An object of class |
verbose |
Provide detailed output to the user. |
This function takes as input a nifti
object and an index
vector in the voxel space of the object and translates that voxel index
into the continuous coordinate space defined by the object's qform and
sform.
Please note:
By default the index i
varies most rapidly, etc.
The ANALYZE 7.5 coordinate system is
+x | = | Left |
+y | = | Anterior |
+z | = | Superior |
(A left-handed co-ordinate system).
The three methods below give the locations of the voxel centres in the x,y,z system. In many cases programs will want to display the data on other grids. In which case the program will be required to convert the desired (x,y,z) values in to voxel values using the inverse transformation.
Method 2 uses a factor qfac
which is either -1 or 1.
qfac
is stored in pixdim[0]
. If pixdim[0]
!= 1 or
-1, which should not occur, we assume 1.
The units of the xyzt
are set in xyzt_units
field.
A nifti
-class object with translated coordinates.
Andrew Thornton [email protected]
ffd <- readNIfTI(file.path(system.file("nifti", package="oro.nifti"), "filtered_func_data")) xyz <- c(1,1,1) translateCoordinate(xyz, ffd, verbose=TRUE) xyz <- trunc(dim(ffd)[1:3]/2) translateCoordinate(xyz, ffd, verbose=TRUE)
ffd <- readNIfTI(file.path(system.file("nifti", package="oro.nifti"), "filtered_func_data")) xyz <- c(1,1,1) translateCoordinate(xyz, ffd, verbose=TRUE) xyz <- trunc(dim(ffd)[1:3]/2) translateCoordinate(xyz, ffd, verbose=TRUE)
unused1
Methods that act on the unused1
field in the
NIfTI/ANALYZE header.
unused1(object) ## S4 method for signature 'anlz' unused1(object) unused1(object) <- value ## S4 replacement method for signature 'anlz' unused1(object) <- value
unused1(object) ## S4 method for signature 'anlz' unused1(object) unused1(object) <- value ## S4 replacement method for signature 'anlz' unused1(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
verified
Methods that act on the verified
field in the
NIfTI/ANALYZE header.
verified(object) ## S4 method for signature 'anlz' verified(object) verified(object) <- value ## S4 replacement method for signature 'anlz' verified(object) <- value
verified(object) ## S4 method for signature 'anlz' verified(object) verified(object) <- value ## S4 replacement method for signature 'anlz' verified(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
views
Methods that act on the views
field in the
NIfTI/ANALYZE header.
views(object) ## S4 method for signature 'anlz' views(object) views(object) <- value ## S4 replacement method for signature 'anlz' views(object) <- value
views(object) ## S4 method for signature 'anlz' views(object) views(object) <- value ## S4 replacement method for signature 'anlz' views(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
vols_added
Methods that act on the vols_added
field in the
NIfTI/ANALYZE header.
vols_added(object) ## S4 method for signature 'anlz' vols_added(object) vols_added(object) <- value ## S4 replacement method for signature 'anlz' vols_added(object) <- value vols.added(object) ## S4 method for signature 'anlz' vols.added(object) vols.added(object) <- value ## S4 replacement method for signature 'anlz' vols.added(object) <- value
vols_added(object) ## S4 method for signature 'anlz' vols_added(object) vols_added(object) <- value ## S4 replacement method for signature 'anlz' vols_added(object) <- value vols.added(object) ## S4 method for signature 'anlz' vols.added(object) vols.added(object) <- value ## S4 replacement method for signature 'anlz' vols.added(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
vox_offset
Methods that act on the vox_offset
field in the
NIfTI/ANALYZE header.
vox_offset(object) ## S4 method for signature 'nifti' vox_offset(object) ## S4 method for signature 'anlz' vox_offset(object) vox_offset(object) <- value ## S4 replacement method for signature 'nifti' vox_offset(object) <- value ## S4 replacement method for signature 'anlz' vox_offset(object) <- value vox.offset(object) ## S4 method for signature 'nifti' vox.offset(object) ## S4 method for signature 'anlz' vox.offset(object) vox.offset(object) <- value ## S4 replacement method for signature 'nifti' vox.offset(object) <- value ## S4 replacement method for signature 'anlz' vox.offset(object) <- value ## S4 method for signature 'niftiImage' vox_offset(object) ## S4 method for signature 'niftiImage' vox.offset(object)
vox_offset(object) ## S4 method for signature 'nifti' vox_offset(object) ## S4 method for signature 'anlz' vox_offset(object) vox_offset(object) <- value ## S4 replacement method for signature 'nifti' vox_offset(object) <- value ## S4 replacement method for signature 'anlz' vox_offset(object) <- value vox.offset(object) ## S4 method for signature 'nifti' vox.offset(object) ## S4 method for signature 'anlz' vox.offset(object) vox.offset(object) <- value ## S4 replacement method for signature 'nifti' vox.offset(object) <- value ## S4 replacement method for signature 'anlz' vox.offset(object) <- value ## S4 method for signature 'niftiImage' vox_offset(object) ## S4 method for signature 'niftiImage' vox.offset(object)
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) vox_offset(img) img = RNifti::readNifti(file) vox.offset(img)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) vox_offset(img) img = RNifti::readNifti(file) vox.offset(img)
vox_units
Methods that act on the vox_units
field in the
NIfTI/ANALYZE header.
vox_units(object) ## S4 method for signature 'anlz' vox_units(object) vox_units(object) <- value ## S4 replacement method for signature 'anlz' vox_units(object) <- value vox.units(object) ## S4 method for signature 'anlz' vox.units(object) vox.units(object) <- value ## S4 replacement method for signature 'anlz' vox.units(object) <- value
vox_units(object) ## S4 method for signature 'anlz' vox_units(object) vox_units(object) <- value ## S4 replacement method for signature 'anlz' vox_units(object) <- value vox.units(object) ## S4 method for signature 'anlz' vox.units(object) vox.units(object) <- value ## S4 replacement method for signature 'anlz' vox.units(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Grabs the pixdim and takes the correct elements
voxdim(img)
voxdim(img)
img |
nifti object |
Vector of length 3
nim <- nifti(array(rnorm(10^3), dim = c(5, 2, 100)), pixdim = c(1, 0.5, 0.2, 1)) voxdim(nim)
nim <- nifti(array(rnorm(10^3), dim = c(5, 2, 100)), pixdim = c(1, 0.5, 0.2, 1)) voxdim(nim)
Grabs the 3 voxel dimensions and takes the product
voxres(img, units = c("mm", "cm"))
voxres(img, units = c("mm", "cm"))
img |
nifti object |
units |
output unit, either cubic mm or cubic cm. |
Scalar numeric, one number, in cubic mm or cubic cm (cc/mL).
This function saves a afni-class object to HEAD/BRIK pair in AFNI format.
writeAFNI(nim, ...) ## S4 method for signature 'afni' writeAFNI(nim, fname, verbose = FALSE, warn = -1)
writeAFNI(nim, ...) ## S4 method for signature 'afni' writeAFNI(nim, fname, verbose = FALSE, warn = -1)
nim |
is an object of class |
... |
Additional variables defined by the method. |
fname |
is the path and file name to save the AFNI file (.HEAD/BRIK) without the suffix. |
verbose |
is a logical variable (default = |
warn |
is a number to regulate the display of warnings (default = -1).
See |
The writeAFNI
function utilizes the internal writeBin
and writeLines
command to write information to header/binary file
pair.
Current acceptable data types include
DT SIGNED SHORT (16 bits per voxel)
DT FLOAT (32 bits per voxel)
DT COMPLEX (128 bits per voxel)
Nothing.
Write AFNI volume to disk.
Not implemented.
Karsten Tabelow [email protected]
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
## Taken from the AFNI Matlab Library ## http://afni.nimh.nih.gov/pub/dist/data/afni_matlab_data.tgz afni.path <- system.file("afni", package="oro.nifti") orig <- readAFNI(file.path(afni.path, "ARzs_CW_avvr.DEL+orig")) fname = file.path(tempdir(), "test-afni-image") writeAFNI(orig, fname, verbose=TRUE) data <- readAFNI(fname, verbose=TRUE) image(orig, zlim=c(0.5,256), oma=rep(2,4), bg="white") image(data, zlim=c(0.5,256), oma=rep(2,4), bg="white") abs.err <- abs(data - orig) image(as(abs.err, "nifti"), zlim=range(0,1), oma=rep(2,4), bg="white")
## Taken from the AFNI Matlab Library ## http://afni.nimh.nih.gov/pub/dist/data/afni_matlab_data.tgz afni.path <- system.file("afni", package="oro.nifti") orig <- readAFNI(file.path(afni.path, "ARzs_CW_avvr.DEL+orig")) fname = file.path(tempdir(), "test-afni-image") writeAFNI(orig, fname, verbose=TRUE) data <- readAFNI(fname, verbose=TRUE) image(orig, zlim=c(0.5,256), oma=rep(2,4), bg="white") image(data, zlim=c(0.5,256), oma=rep(2,4), bg="white") abs.err <- abs(data - orig) image(as(abs.err, "nifti"), zlim=range(0,1), oma=rep(2,4), bg="white")
This function saves an Analyze-class object to a single binary file in Analyze format.
## S4 method for signature 'anlz' writeANALYZE( aim, filename, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 )
## S4 method for signature 'anlz' writeANALYZE( aim, filename, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 )
aim |
is an object of class |
filename |
is the path and file name to save the Analyze file pair (.hdr,img) without the suffixes. |
gzipped |
is a character string that enables exportation of compressed
(.gz) files (default = |
verbose |
is a logical variable (default = |
warn |
is a number to regulate the display of warnings (default = -1).
See |
compression |
The amount of compression to be applied when writing a
file when |
The writeANALYZE
function utilizes the internal writeBin
and
writeChar
command to write information to a binary file.
Nothing.
Write ANALYZE volume to disk.
Brandon Whitcher [email protected]
Analyze 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
norm <- dnorm(seq(-5, 5, length=32), sd=2) norm <- (norm-min(norm)) / max(norm-min(norm)) img <- outer(outer(norm, norm), norm) img <- round(255*img) img[17:32,,] <- 255 - img[17:32,,] img.anlz <- anlz(img) # create Analyze object fname = file.path(tempdir(), "test-anlz-image-uint8") writeANALYZE(img.anlz, fname, verbose=TRUE) ## These files should be viewable in, for example, FSLview ## Make sure you adjust the min/max values for proper visualization data <- readANALYZE(fname, verbose=TRUE) image(img.anlz, oma=rep(2,4), bg="white") image(data, oma=rep(2,4), bg="white") abs.err <- abs(data - img.anlz) image(as(abs.err, "anlz"), zlim=range(img.anlz), oma=rep(2,4), bg="white") ## Not run: ## Loop through all possible data types datatypes <- list(code=c(2, 4, 8, 16, 64), name=c("uint8", "int16", "int32", "float", "double")) equal <- vector("list") for (i in 1:length(datatypes$code)) { fname <- paste("test-anlz-image-", datatypes$name[i], sep="") fname = file.path(tempdir(), fname) rm(img.anlz) img.anlz <- anlz(img, datatype=datatypes$code[i]) writeANALYZE(img.anlz, fname) equal[[i]] <- all(readANALYZE(fname) == img) } names(equal) <- datatypes$name unlist(equal) ## End(Not run)
norm <- dnorm(seq(-5, 5, length=32), sd=2) norm <- (norm-min(norm)) / max(norm-min(norm)) img <- outer(outer(norm, norm), norm) img <- round(255*img) img[17:32,,] <- 255 - img[17:32,,] img.anlz <- anlz(img) # create Analyze object fname = file.path(tempdir(), "test-anlz-image-uint8") writeANALYZE(img.anlz, fname, verbose=TRUE) ## These files should be viewable in, for example, FSLview ## Make sure you adjust the min/max values for proper visualization data <- readANALYZE(fname, verbose=TRUE) image(img.anlz, oma=rep(2,4), bg="white") image(data, oma=rep(2,4), bg="white") abs.err <- abs(data - img.anlz) image(as(abs.err, "anlz"), zlim=range(img.anlz), oma=rep(2,4), bg="white") ## Not run: ## Loop through all possible data types datatypes <- list(code=c(2, 4, 8, 16, 64), name=c("uint8", "int16", "int32", "float", "double")) equal <- vector("list") for (i in 1:length(datatypes$code)) { fname <- paste("test-anlz-image-", datatypes$name[i], sep="") fname = file.path(tempdir(), fname) rm(img.anlz) img.anlz <- anlz(img, datatype=datatypes$code[i]) writeANALYZE(img.anlz, fname) equal[[i]] <- all(readANALYZE(fname) == img) } names(equal) <- datatypes$name unlist(equal) ## End(Not run)
This function saves a NIfTI-class object to a single binary file in NIfTI format.
## S4 method for signature 'nifti' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 ) ## S4 method for signature 'niftiExtension' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 ) ## S4 method for signature 'anlz' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 ) ## S4 method for signature 'array' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 )
## S4 method for signature 'nifti' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 ) ## S4 method for signature 'niftiExtension' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 ) ## S4 method for signature 'anlz' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 ) ## S4 method for signature 'array' writeNIfTI( nim, filename, onefile = TRUE, gzipped = TRUE, verbose = FALSE, warn = -1, compression = 9 )
nim |
is an object of class |
filename |
is the path and file name to save the NIfTI file (.nii) without the suffix. |
onefile |
is a logical value that allows the scanning of single-file
(.nii) or dual-file format (.hdr and .img) NIfTI files (default =
|
gzipped |
is a character string that enables exportation of compressed
(.gz) files (default = |
verbose |
is a logical variable (default = |
warn |
is a number to regulate the display of warnings (default = -1).
See |
compression |
The amount of compression to be applied when writing a
file when |
The writeNIfTI
function utilizes the internal writeBin
and
writeChar
command to write information to a binary file.
Current acceptable data types include
DT BINARY (1 bit per voxel)
DT SIGNED SHORT (16 bits per voxel)
DT SINGED INT (32 bits per voxel)
DT FLOAT (32 bits per voxel)
DT DOUBLE (64 bits per voxel)
DT UNSIGNED SHORT (16 bits per voxel)
Nothing.
Convert ANALYZE object
to class nifti
and write the NIfTI volume to disk.
Convert array to class nifti
and write the NIfTI volume to
disk.
Write NIfTI volume to disk.
Brandon Whitcher [email protected],
Volker Schmid
[email protected]
NIfTI-1
http://nifti.nimh.nih.gov/
norm <- dnorm(seq(-5, 5, length=32), sd=2) norm <- (norm-min(norm)) / max(norm-min(norm)) img <- outer(outer(norm, norm), norm) img <- round(255 * img) img[17:32,,] <- 255 - img[17:32,,] img.nifti <- nifti(img) # create NIfTI object fname = file.path(tempdir(), "test-nifti-image-uint8") writeNIfTI(img.nifti, fname, verbose=TRUE) ## These files should be viewable in, for example, FSLview ## Make sure you adjust the min/max values for proper visualization data <- readNIfTI(fname, verbose=TRUE) image(img.nifti, oma=rep(2,4), bg="white") image(data, oma=rep(2,4), bg="white") abs.err <- abs(data - img.nifti) image(as(abs.err, "nifti"), zlim=range(img.nifti), oma=rep(2,4), bg="white") ## Not run: ## Loop through all possible data types datatypes <- list(code=c(2, 4, 8, 16, 64), name=c("uint8", "int16", "int32", "float", "double")) equal <- vector("list") for (i in 1:length(datatypes$code)) { fname <- paste("test-nifti-image-", datatypes$name[i], sep="") fname = file.path(tempdir(), fname) rm(img.nifti) img.nifti <- nifti(img, datatype=datatypes$code[i]) writeNIfTI(img.nifti, fname, verbose=TRUE) equal[[i]] <- all(readNIfTI(fname) == img) } names(equal) <- datatypes$name unlist(equal) ## End(Not run)
norm <- dnorm(seq(-5, 5, length=32), sd=2) norm <- (norm-min(norm)) / max(norm-min(norm)) img <- outer(outer(norm, norm), norm) img <- round(255 * img) img[17:32,,] <- 255 - img[17:32,,] img.nifti <- nifti(img) # create NIfTI object fname = file.path(tempdir(), "test-nifti-image-uint8") writeNIfTI(img.nifti, fname, verbose=TRUE) ## These files should be viewable in, for example, FSLview ## Make sure you adjust the min/max values for proper visualization data <- readNIfTI(fname, verbose=TRUE) image(img.nifti, oma=rep(2,4), bg="white") image(data, oma=rep(2,4), bg="white") abs.err <- abs(data - img.nifti) image(as(abs.err, "nifti"), zlim=range(img.nifti), oma=rep(2,4), bg="white") ## Not run: ## Loop through all possible data types datatypes <- list(code=c(2, 4, 8, 16, 64), name=c("uint8", "int16", "int32", "float", "double")) equal <- vector("list") for (i in 1:length(datatypes$code)) { fname <- paste("test-nifti-image-", datatypes$name[i], sep="") fname = file.path(tempdir(), fname) rm(img.nifti) img.nifti <- nifti(img, datatype=datatypes$code[i]) writeNIfTI(img.nifti, fname, verbose=TRUE) equal[[i]] <- all(readNIfTI(fname) == img) } names(equal) <- datatypes$name unlist(equal) ## End(Not run)
xyzt_units
Methods that act on the xyzt_units
field in the
NIfTI/ANALYZE header.
xyzt_units(object) ## S4 method for signature 'nifti' xyzt_units(object) xyzt_units(object) <- value ## S4 replacement method for signature 'nifti' xyzt_units(object) <- value xyzt.units(object) ## S4 method for signature 'nifti' xyzt.units(object) xyzt.units(object) <- value ## S4 replacement method for signature 'nifti' xyzt.units(object) <- value ## S4 method for signature 'niftiImage' xyzt_units(object) ## S4 replacement method for signature 'niftiImage' xyzt_units(object) <- value
xyzt_units(object) ## S4 method for signature 'nifti' xyzt_units(object) xyzt_units(object) <- value ## S4 replacement method for signature 'nifti' xyzt_units(object) <- value xyzt.units(object) ## S4 method for signature 'nifti' xyzt.units(object) xyzt.units(object) <- value ## S4 replacement method for signature 'nifti' xyzt.units(object) <- value ## S4 method for signature 'niftiImage' xyzt_units(object) ## S4 replacement method for signature 'niftiImage' xyzt_units(object) <- value
object |
is an object of class |
value |
is the value to assign to the |
See documentation on the ANALYZE and/or NIfTI data standards for more details.
John Muschelli [email protected],
Brandon Whitcher [email protected]
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) xyzt_units(img) xyzt_units(img) = 8 stopifnot(xyzt_units(img) == 8)
file = system.file("extdata", "example.nii.gz", package = "RNifti") img = RNifti::readNifti(file) xyzt_units(img) xyzt_units(img) = 8 stopifnot(xyzt_units(img) == 8)
Units of spatial and temporal dimensions, and MRI-specific spatial and temporal information.
xyzt2space(xyzt) xyzt2time(xyzt) space.time2xyzt(ss, tt) dim2freq(di) dim2phase(di) dim2slice(di)
xyzt2space(xyzt) xyzt2time(xyzt) space.time2xyzt(ss, tt) dim2freq(di) dim2phase(di) dim2slice(di)
xyzt |
represents the units of pixdim[1..4] in the NIfTI header. |
ss |
is the character string of spatial units. Valid strings are: “Unknown”, “meter”, “mm” and “micron”. |
tt |
is the character string of temporal units. Valid strings are: “sec”, “msec”, “usec”, “Hz”, “ppm” and “rads”. |
di |
represents MRI slice ordering in the NIfTI header. |
The functions xyzt2space
and xyzt2time
can be used to mask off
the undesired bits from the xyzt_units fields, leaving “pure”
space and time codes.
http://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/nifti1fields_pages/xyzt_units.html
The functions dim2freq
, dim2phase
, and dim2slice
can be
used to extract values from the dim_info byte.
http://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/nifti1fields_pages/dim_info.html
For diminfo: the frequency, phase and slice dimensions encode which spatial dimension (1,2, or 3) corresponds to which acquisition dimension for MRI data. For xyzt_units: the codes are used to indicate the units of pixdim. Dimensions 1,2,3 are for x,y,z; dimension 4 is for time (t).
B. Whitcher [email protected]
Neuroimaging Informatics Technology Initiative (NIfTI)
http://nifti.nimh.nih.gov/