Version: | 0.11.4 |
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. |
Depends: | R (≥ 2.14.0) |
Suggests: | XML, testthat, covr, knitr, rmarkdown, rticles |
Imports: | stats, bitops, splines, graphics, grDevices, methods, utils, abind, RNifti (≥ 0.9.0) |
Enhances: | fmri, oro.dicom |
License: | BSD_3_clause + file LICENSE |
BugReports: | https://github.com/bjw34032/oro.nifti/issues |
URL: | https://rigorousanalytics.blogspot.com |
Collate: | 'auditTrail.R' 'niftiS4.R' 'analyzeS4.R' 'afniS4.R' 'is.R' 'nifti_assign.R' 'coerce.R' 'writeS4.R' 'convert_anlz.R' 'convert_nifti.R' 'cal_img.R' 'drop_img_dim.R' 'hotmetal.R' 'miscellaneous.R' 'plot.R' 'slice.R' 'slice_overlay.R' 'blend.R' 'readS4.R' 'remove.R' 'tim_colors.R' 'transform.R' 'wrappers.R' 'onefile.R' 'voxdim.R' 'anlz_Operators.R' 'Operators.R' 'zero_trans.R' 'aux_file.R' 'cal_max.R' 'cal_min.R' 'descrip.R' 'glmax.R' 'glmin.R' 'pixdim.R' 'qform_code.R' 'scl_inter.R' 'scl_slope.R' 'sform_code.R' 'vox_offset.R' 'bitpix.R' 'data_type.R' 'datatype.R' 'db_name.R' 'dim_.R' 'dim_info.R' 'extender.R' 'extents.R' 'img_data.R' 'intent_code.R' 'intent_name.R' 'intent_p1.R' 'intent_p2.R' 'intent_p3.R' 'magic.R' 'qoffset_x.R' 'qoffset_y.R' 'qoffset_z.R' 'quatern_b.R' 'quatern_c.R' 'quatern_d.R' 'quaternion.R' 'regular.R' 'session_error.R' 'sizeof_hdr.R' 'slice_code.R' 'slice_duration.R' 'slice_end.R' 'slice_start.R' 'srow_x.R' 'srow_y.R' 'srow_z.R' 'toffset.R' 'xyzt_units.R' 'cal_units.R' 'compressed.R' 'dim_un0.R' 'exp_date.R' 'exp_time.R' 'field_skip.R' 'funused1.R' 'funused2.R' 'funused3.R' 'generated.R' 'hist_un0.R' 'hkey_un0.R' 'niftiImage_class.R' 'nii2oro.R' 'oro2nii.R' 'omax.R' 'omin.R' 'orient.R' 'origin.R' 'patient_id.R' 'scannum.R' 'smax.R' 'smin.R' 'start_field.R' 'unused1.R' 'verified.R' 'views.R' 'vols_added.R' 'vox_units.R' 'voxres.R' 'img_length.R' 'zzz.R' 'zzz_niftiImage.R' |
RoxygenNote: | 7.2.1 |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2022-08-10 04:09:52 UTC; johnmuschelli |
Author: | Brandon Whitcher [aut, cre], Volker Schmid [aut], Andrew Thornton [aut], Karsten Tabelow [ctb], Jon Clayden [ctb], John Muschelli [aut] |
Maintainer: | Brandon Whitcher <bwhitcher@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2022-08-10 16:10:02 UTC |
Facilitate the Creation and Modification of Audit Trails
Description
Facilitate the creation and modification of audit trails for NIfTI class objects.
Usage
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)
Arguments
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 |
Details
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).
Note
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.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net and Brandon Whitcher bwhitcher@gmail.com
Examples
## 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)
Convert ANALYZE Codes
Description
Codes that appear in the ANALYZE header are mapped to meaningful character strings.
Usage
convert.bitpix.anlz(bitpix = NULL)
convert.datatype.anlz(datatype.code = NULL)
convert.orient.anlz(orientation)
Arguments
bitpix |
is the bit-per-pixel code. |
datatype.code |
defines data type. |
orientation |
defines the orientation. |
Details
switch
statements are used to map a numeric code to the
appropriate string.
Value
A character string.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
See Also
convert.datatype
, convert.bitpix
,
convert.intent
, convert.form
,
convert.units
, convert.slice
Examples
## 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)
Convert NIfTI Codes
Description
Codes that appear in the ANALYZE header are mapped to meaningful character strings.
Usage
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)
Arguments
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. |
Details
switch
statements are used to map a numeric code to the
appropriate string.
Value
A character string.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
References
Neuroimaging Informatics Technology Initiative (NIfTI)
http://nifti.nimh.nih.gov/
Examples
## 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)
Class "afni"
Description
The AFNI class for medical imaging data.
Usage
## S4 method for signature 'afni'
show(object)
Arguments
object |
An object of class |
Objects from the Class
Objects can be created by calls of the form
new("afni", data, dim, dimnames, ...)
.
Slots
.Data
:Object of class
"array"
contains the imaging dataDATASET_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"
Extends
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.
Author(s)
Karsten Tabelow karsten.tabelow@wias-berlin.de
References
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
See Also
Examples
showClass("afni")
Constructor for Analyze
Description
Constructor for Analyze class objects.
Usage
anlz(img = array(0, dim = rep(1, 4)), dim, datatype = 2, ...)
Arguments
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. |
Value
An object of class anlz
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
See Also
anlz
, nifti
,
nifti
, convert.datatype.anlz
Examples
aim <- anlz() # default
Class "anlz"
Description
The ANALYZE class for medical imaging data.
Usage
## S4 method for signature 'anlz'
show(object)
Arguments
object |
An object of class |
Objects from the Class
Objects can be created by calls of the form
new("anlz", data, dim, dimnames, ...)
or by calling the anlz
function.
Slots
.Data
:Object of class
"array"
contains the imaging datasizeof_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 datavox_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 datavox_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 intensitycal_min
:Object of class
"numeric"
contains the minimum display intensitycompressed
: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"
Extends
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.
Methods
- image
signature(x = "anlz")
: displays the image(s).- show
signature(object = "anlz")
: prints out a summary of the imaging data.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
See Also
Examples
showClass("anlz")
Operations for Objects in the ANALYZE and NIfTI classes
Description
Overloaded operators for anlz and nifti objects
Usage
## 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)
Arguments
e1 |
object |
e2 |
object |
Author(s)
John Muschelli muschellij2@gmail.com
Examples
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)
as.anlz
Description
Internal function that converts multidimensional arrays to ANALYZE class objects.
Usage
as.anlz(from, value = NULL, verbose = FALSE)
Arguments
from |
is the object to be converted. |
value |
is the |
verbose |
is a logical variable (default = |
Value
An object of class anlz
.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net,
Brandon Whitcher bwhitcher@gmail.com
as.nifti
Description
Internal function that converts multidimensional arrays to NIfTI class objects.
Usage
as.nifti(from, value = NULL, verbose = FALSE)
Arguments
from |
is the object to be converted. |
value |
is the |
verbose |
is a logical variable (default = |
Value
An object of class nifti
.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net.
Brandon Whitcher bwhitcher@gmail.com
Extract or Replace NIfTI Audit Trail
Description
Operators that act on the audit trail (XML) in the NIfTI header.
Usage
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
Arguments
object |
is of class |
value |
Value to assign to trail slot |
Methods
- object = "nifti"
Extract or replace NIfTI audit trail.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net
Extract Image Attribute aux_file
Description
Methods that act on the aux_file
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
## 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")
Extract Image Attribute bitpix
Description
Methods that act on the bitpix
field in the
NIfTI/ANALYZE header.
Usage
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)
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
file = system.file("extdata", "example.nii.gz", package = "RNifti")
img = RNifti::readNifti(file)
bitpix(img)
Merge Two NIfTI or ANALYZE Volumes
Description
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.
Usage
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")
Arguments
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 = |
Value
A single volume that blends the voxel-wise information from x
and y
.
Methods
- x = "nifti", y = "nifti"
Merge
x
andy
.- x = "anlz", y = "anlz"
Merge
x
ony
.- x = "nifti", y = "anlz"
Merge
x
ony
.- x = "anlz", y = "nifti"
Merge
x
andy
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
See Also
image-methods
, overlay-methods
Extract Image Attribute cal_max
Description
Methods that act on the cal_max
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
## 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)
Extract Image Attribute cal_min
Description
Methods that act on the cal_min
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
## 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)
Extract Image Attribute cal_units
Description
Methods that act on the cal_units
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Set Minimum/Maximum Values for NIfTI data
Description
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
.
Usage
calibrateImage(img, infok = TRUE)
cal_img(img, infok = TRUE)
Arguments
img |
is a |
infok |
is a logical value whether or not |
Value
An object of class nifti
.
Author(s)
John Muschelli muschellij2@gmail.com
Force an Object to Belong to the ANALYZE or NIfTI Class
Description
Methods for function coerce
in Package ‘methods’.
Arguments
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 = |
Value
An object of class anlz
or nifti
.
Methods
- from = "anlz", to = "nifti"
An object of class
anlz
is coerced into a NIfTI object.- from = "array", to = "anlz"
An object of class
array
is coerced into an ANALYZE object.- from = "array", to = "nifti"
An object of class
array
is coerced into a NIfTI object.- from = "list", to = "anlz"
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.- from = "list", to = "nifti"
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.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net,
Brandon Whitcher bwhitcher@gmail.com
See Also
Extract Image Attribute compressed
Description
Methods that act on the compressed
field in the
NIfTI/ANALYZE header.
Usage
compressed(object)
## S4 method for signature 'anlz'
compressed(object)
compressed(object) <- value
## S4 replacement method for signature 'anlz'
compressed(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Convert AFNI data codes
Description
Codes that appear in the AFNI header are mapped to meaningful character strings.
Usage
convert.scene(scene.data, typestring)
Arguments
scene.data |
defines data type. |
typestring |
defines whether func or anat data. |
Details
switch
statements are used to map a numeric code to the appropriate
string.
Value
A character string.
Author(s)
Karsten Tabelow karsten.tabelow@wias-berlin.de
References
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
See Also
convert.datatype.anlz
,
convert.orient.anlz
Examples
## 4 = CT for anatomic data
convert.scene(4, "3DIM_HEAD_ANAT")
Extract Image Attribute data_type
Description
Methods that act on the data_type
field in the
NIfTI/ANALYZE header.
Usage
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)
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
file = system.file("extdata", "example.nii.gz", package = "RNifti")
img = RNifti::readNifti(file)
data_type(img)
datatype(img)
Extract Image Attribute datatype
Description
Methods that act on the datatype
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute db_name
Description
Methods that act on the db_name
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute descrip
Description
Methods that act on the descrip
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
## 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")
Extract Image Attribute dim_
Description
Methods that act on the dim_
field in the
NIfTI/ANALYZE header.
Usage
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)
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute dim_info
Description
Methods that act on the dim_info
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute dim_un0
Description
Methods that act on the dim_un0
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Drop Image Dimension
Description
Drops a dimension of an image that has one-dimension and
sets respective values to 0 in pixdim
or 1 in dim
.
Usage
dropImageDimension(img, onlylast = TRUE, warn = TRUE)
drop_img_dim(img, onlylast = TRUE, warn = TRUE)
Arguments
img |
nifti object |
onlylast |
is a logical variable (default = |
warn |
produces a text output if the number of dimensions is under three. |
Value
Object of class nifti
Examples
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)
Extract Image Attribute exp_date
Description
Methods that act on the exp_date
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute exp_time
Description
Methods that act on the exp_time
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute extender
Description
Methods that act on the extender
field in the
NIfTI/ANALYZE header.
Usage
extender(object)
## S4 method for signature 'nifti'
extender(object)
extender(object) <- value
## S4 replacement method for signature 'nifti'
extender(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute extents
Description
Methods that act on the extents
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute field_skip
Description
Methods that act on the field_skip
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute funused1
Description
Methods that act on the funused1
field in the
NIfTI/ANALYZE header.
Usage
funused1(object)
## S4 method for signature 'anlz'
funused1(object)
funused1(object) <- value
## S4 replacement method for signature 'anlz'
funused1(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute funused2
Description
Methods that act on the funused2
field in the
NIfTI/ANALYZE header.
Usage
funused2(object)
## S4 method for signature 'anlz'
funused2(object)
funused2(object) <- value
## S4 replacement method for signature 'anlz'
funused2(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute funused3
Description
Methods that act on the funused3
field in the
NIfTI/ANALYZE header.
Usage
funused3(object)
## S4 method for signature 'anlz'
funused3(object)
funused3(object) <- value
## S4 replacement method for signature 'anlz'
funused3(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute generated
Description
Methods that act on the generated
field in the
NIfTI/ANALYZE header.
Usage
generated(object)
## S4 method for signature 'anlz'
generated(object)
generated(object) <- value
## S4 replacement method for signature 'anlz'
generated(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute glmax
Description
Methods that act on the glmax
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute glmin
Description
Methods that act on the glmin
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute hist_un0
Description
Methods that act on the hist_un0
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute hkey_un0
Description
Methods that act on the hkey_un0
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Hot Metal Color Table
Description
The hotmetal color table patterned after the one used in Matlab.
Usage
hotmetal(n = 64)
Arguments
n |
is the number of color levels (default = 64). |
Details
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.
Value
A vector of character strings giving the colors in hexadecimal format.
See Also
terrain.colors
, tim.colors
,
topo.colors
Examples
hotmetal(10)
image(outer(1:20,1:20,"+"), col=hotmetal(75), main="hotmetal")
Methods for Function ‘image’
Description
Produce “lightbox” layout of images for nifti
, anlz
and
afni
objects.
Usage
## 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, ...)
Arguments
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 |
Details
Uses the S3 generic function image
, with medical-image friendly
settings, to display nifti
, anlz
and afni
class objects
in a “lightbox” layout.
Methods
- x = "ANY"
Generic function: see
image
.- x = "nifti"
Produce images for
x
.- x = "anlz"
Produce images for
x
.- x = "afni"
Produce images for
x
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
See Also
orthographic-methods
, overlay-methods
Extract Image Attribute .Data
Description
Methods that act on the .Data
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Gets Image Length in Each Dimension
Description
Multiplies the number of slices by the voxel resolution for each direction.
Usage
img_length(img, units = c("mm", "cm"))
Arguments
img |
Image object, any method with |
units |
output unit, either cubic mm or cubic cm. |
Value
Scalar numeric, one number, in mm or cm.
Examples
nim <- nifti(array(rnorm(10^3), dim = c(5, 2, 100)),
pixdim = c(1, 0.5, 0.2, 1))
img_length(nim)
integerTranslation
Description
...
Usage
integerTranslation(nim, data, verbose = FALSE)
invertIntegerTranslation(nim, verbose = FALSE)
Arguments
nim |
is an object of class |
data |
is ... |
verbose |
is a logical variable (default = |
Details
...
Value
...
Author(s)
Andrew Thornton zeripath@users.sourceforge.net
Extract Image Attribute intent_code
Description
Methods that act on the intent_code
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute intent_name
Description
Methods that act on the intent_name
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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")
Extract Image Attribute intent_p1
Description
Methods that act on the intent_p1
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute intent_p2
Description
Methods that act on the intent_p2
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute intent_p3
Description
Methods that act on the intent_p3
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
"internalImage" class
Description
"internalImage" class
check object
Description
Check whether object is of class afni
.
Usage
is.afni(x)
Arguments
x |
is an object to be checked. |
Value
Logical indicating whether object is of class
afni
.
Author(s)
Karsten Tabelow karsten.tabelow@wias-berlin.de
References
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
See Also
check object
Description
Check whether object is of class anlz
.
Usage
is.anlz(x)
Arguments
x |
is an object to be checked. |
Value
Logical indicating whether object is of class
anlz
.
Author(s)
Karsten Tabelow karsten.tabelow@wias-berlin.de
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
See Also
check object
Description
Check whether object is of class nifti
.
Usage
is.nifti(x)
is.niftiExtension(x)
Arguments
x |
is an object to be checked. |
Value
Logical indicating whether object is of class
nifti
.
Author(s)
Karsten Tabelow karsten.tabelow@wias-berlin.de
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
Extract Image Attribute magic
Description
Methods that act on the magic
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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
Description
Constructor for NIfTI class objects.
Usage
nifti(
img = array(0, dim = rep(1, 4)),
dim,
datatype = 2,
cal.min = NULL,
cal.max = NULL,
pixdim = NULL,
...
)
Arguments
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. |
Value
An object of class nifti
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
Examples
options("niftiAuditTrail"=FALSE)
nim <- nifti() # default
nim
nim <- nifti(datatype=4) # 2-byte integers
nim
Class "nifti"
Description
The NIfTI class for medical imaging data.
Usage
## S4 method for signature 'nifti'
show(object)
Arguments
object |
An object of class |
Objects from the Class
Objects can be created by calls of the form
new("nifti", data, dim, dimnames, ...)
or by calling the nifti
function.
Slots
.Data
:Object of class
"array"
contains the imaging datasizeof_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 orderingdim_
:Object of class
"vector"
contains the dimensions of the imaging dataintent_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 datavox_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 intensitycal_min
:Object of class
"numeric"
contains the minimum display intensityslice_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"
Extends
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.
Methods
- image
signature(x = "nifti")
: displays the image(s).- orthographic
signature(x = "nifti")
: displays the image(s).- overlay
signature(x = "nifti", y = "nifti")
: displays the image(s).- show
signature(object = "nifti")
: prints out a summary of the imaging data.
Author(s)
Brandon Whitcher bwhitcher@gmail.com,
Andrew Thornton
zeripath@users.sourcefore.net
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
anlz
, niftiExtension
,
niftiAuditTrail
Examples
showClass("nifti")
Operations for NIfTI Objects
Description
Overloaded operators for nifti objects
Usage
## 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)
Arguments
e1 |
is an object of class |
e2 |
is an object of class |
Author(s)
John Muschelli muschellij2@gmail.com
Examples
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)
Class "niftiAuditTrail"
Description
An extension of the NIfTI class that adds an audit trail in XML format.
Objects from the Class
Objects can be created by calls of the form
new("niftiAuditTrail", data, dim, dimnames, ...)
.
Methods
- show
signature(object = "niftiAuditTrail")
: prints out a summary of the imaging data.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
Examples
showClass("niftiAuditTrail")
Class "niftiExtension"
Description
An extension of the NIfTI class that allows “extensions” that conform to the NIfTI data standard.
Objects from the Class
Objects can be created by calls of the form
new("niftiExtension", data, dim, dimnames, ...)
.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
Examples
showClass("niftiExtension")
Class "niftiExtensionSection"
Description
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 from the Class
Objects can be created by calls of the form
new("niftiExtensionSection", data, dim, dimnames, ...)
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com,
Andrew Thornton
zeripath@users.sourcefore.net
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
Examples
showClass("niftiExtensionSection")
"niftiImage" class
Description
"niftiImage" class
Methods for Function [<- in Package 'base'
Description
Methods for function [<-
in Package 'base'
Methods
- x = "nifti", i = "ANY", j = "ANY", value = "ANY"
Replaces the data at the provided co-ordinates with the value provided and updates the header.
- x = "nifti", i = "numeric", j = "numeric", value = "ANY"
Replaces the data at the provided co-ordinates with the value provided and updates the header.
- x = "nifti", i = "ANY", j = "missing", value = "ANY"
Replaces the data row i of the provided nifti object with the value provided and updates the header.
- x = "nifti", i = "numeric", j = "missing", value = "ANY"
Replaces the data row i of the provided nifti object with the value provided and updates the header.
- x = "nifti", i = "missing", j = "missing", value = "array"
Replaces the data of the provided nifti object with the array provided and updates the header.
Convert RNifti niftiImage to oro.nifti nifti object
Description
Converts a niftiImage from RNifti to a nifti object from the oro.nifti package
Usage
nii2oro(image)
Arguments
image |
|
Value
Object of class nifti
Dimension Accessor Functions
Description
Functions to extract the higher dimensions from ANALYZE/NIfTI data.
Usage
nsli(x)
NSLI(x)
ntim(x)
NTIM(x)
Arguments
x |
is a three- or four-dimensional array (e.g., read in from an ANALYZE/NIfTI file). |
Details
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.
Value
Third (slice) or fourth (time) dimension of the array.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
See Also
Extract Image Attribute omax
Description
Methods that act on the omax
field in the
NIfTI/ANALYZE header.
Usage
omax(object)
## S4 method for signature 'anlz'
omax(object)
omax(object) <- value
## S4 replacement method for signature 'anlz'
omax(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute omin
Description
Methods that act on the omin
field in the
NIfTI/ANALYZE header.
Usage
omin(object)
## S4 method for signature 'anlz'
omin(object)
omin(object) <- value
## S4 replacement method for signature 'anlz'
omin(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Creates the onefile
Specification for NIfTI
Description
Changes 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.
Usage
onefile(img)
Arguments
img |
is a |
Value
Object of class nifti
.
Author(s)
John Muschelli muschellij2@gmail.com
References
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute orient
Description
Methods that act on the orient
field in the
NIfTI/ANALYZE header.
Usage
orient(object)
## S4 method for signature 'anlz'
orient(object)
orient(object) <- value
## S4 replacement method for signature 'anlz'
orient(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract NIfTI 3D Image Orientation
Description
Methods that act on the “qform” and “sform” information in the NIfTI header.
Usage
sform(object)
## S4 method for signature 'nifti'
sform(object)
qform(object)
## S4 method for signature 'nifti'
qform(object)
Arguments
object |
is an object of class |
Methods
- object = "nifti"
Extract or replace NIfTI description.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
Examples
## 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)
Extract Image Attribute origin
Description
Methods that act on the origin
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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))
Convert oro.nifti nifti to RNifti niftiImage object
Description
Converts a nifti from oro.nifti to a niftiImage object from the RNifti package
Usage
oro2nii(image, verbose = FALSE)
Arguments
image |
|
verbose |
print messages, passed to |
Value
Object of class niftiImage
Methods for Function ‘orthographic’ in Package ‘dcemriS4’
Description
Produce orthographic display for nifti
, anlz
and afni
objects.
Usage
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, ...)
Arguments
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 |
Methods
- x = "afni"
Produce orthographic display for
x
.- x = "anlz"
Produce orthographic display for
x
.- x = "array"
Produce orthographic display for
x
.- x = "nifti"
Produce orthographic display for
x
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
See Also
image-methods
, overlay-methods
Examples
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
Description
Methods for function overlay
Usage
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, ...)
Arguments
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 |
Details
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.
Methods
- x = "nifti", y = "nifti"
Produce overlay of
y
onx
.- x = "anlz", y = "anlz"
Produce overlay of
y
onx
.- x = "afni", y = "afni"
Produce overlay of
y
onx
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
See Also
image-methods
, overlay-methods
Extract Image Attribute patient_id
Description
Methods that act on the patient_id
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Transform array with orthogonal permutation matrix
Description
Given an orthogonal permutation matrix T
, an array of
dimensions and a one-dimensional representation of data. It will return a
transformed array with the transformed dimensions.
Usage
performPermutation(T, real.dimensions, data, verbose = FALSE)
Arguments
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 = |
Details
This function is mainly used by the reorient
function
to transform nifti data into neuroradiological convention.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net
See Also
Extract Image Attribute pixdim
Description
Methods that act on the pixdim
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
## 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)
Extract Image Attribute qform_code
Description
Methods that act on the qform_code
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute qoffset_x
Description
Methods that act on the qoffset_x
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute qoffset_y
Description
Methods that act on the qoffset_y
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute qoffset_z
Description
Methods that act on the qoffset_z
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute quatern_b
Description
Methods that act on the quatern_b
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute quatern_c
Description
Methods that act on the quatern_c
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute quatern_d
Description
Methods that act on the quatern_d
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Convert Quaternion into a Rotation Matrix
Description
The affine/rotation matrix R
is calculated from the quaternion
parameters.
Usage
quaternion2rotation(b, c, d, tol = 1e-07)
quaternion2mat44(nim, tol = 1e-07)
Arguments
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 |
Details
The quaternion representation is chosen for its compactness in representing
rotations. The orientation of the (x,y,z)
axes relative to the
(i,j,k)
axes in 3D space is specified using a unit quaternion
[a,b,c,d]
, where a^2+b^2+c^2+d^2=1
. The
(b,c,d)
values are all that is needed, since we require that
a=[1-(b^2+c^2+d^2)]^{1/2}
be non-negative.
The (b,c,d)
values are stored in the (quatern_b
,
quatern_c
, quatern_d
) fields.
Value
The (proper) 3{\times}3
rotation matrix or
4{\times}4
affine matrix.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
References
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
## 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))
readAFNI
Description
These functions read in the header information and
multidimensional array from a binary file in AFNI format into a
afni
-class object.
Usage
readAFNI(fname, vol = NULL, verbose = FALSE, warn = -1, call = NULL)
Arguments
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. |
Details
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
- list("INT16")
DT SIGNED SHORT (16 bits per voxel)
- list("FLOAT32")
DT FLOAT (32 bits per voxel)
- list("COMPLEX128")
DT COMPLEX (128 bits per voxel)
Value
object of class afni
Author(s)
Karsten Tabelow karsten.tabelow@wias-berlin.de
References
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
See Also
Examples
## 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)
readANALYZE
Description
These functions read in the header information and multi-dimensional array from a binary file in Analyze 7.5 format.
Usage
readANALYZE(fname, SPM = FALSE, verbose = FALSE, warn = -1)
Arguments
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 |
Details
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.
Value
An object of class anlz
is produced.
Author(s)
Brandon Whitcher bwhitcher@gmail.com,
Volker Schmid
volkerschmid@users.sourceforge.net
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
See Also
Examples
## 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))
readNIfTI
Description
These functions read in the header information and multidimensional array
from a binary file in NIfTI-1 format into a nifti
-class
object.
Usage
readNIfTI(
fname,
verbose = FALSE,
warn = -1,
reorient = TRUE,
call = NULL,
read_data = TRUE,
rescale_data = TRUE
)
nifti_header(fname, verbose = FALSE, warn = -1)
Arguments
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 |
Details
The readNIfTI
function utilizes internal methods readBin
and
readChar
to efficiently extract information from the binary file(s).
Current acceptable data types include
- list("UINT8")
BINARY (1 bit per voxel)
- list("INT16")
SIGNED SHORT (16 bits per voxel)
- list("INT32")
SINGED INT (32 bits per voxel)
- list("FLOAT32")
FLOAT (32 bits per voxel)
- list("DOUBLE64")
DOUBLE (64 bits per voxel)
- list("UINT16")
UNSIGNED SHORT (16 bits per voxel)
- list("UINT32")
UNSIGNED INT (32 bits per voxel)
Value
An object of class nifti
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com,
Volker Schmid
volkerschmid@users.sourceforge.net,
Andrew Thornton
zeripath@users.sourceforge.net
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
Examples
## 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)
Extract Image Attribute regular
Description
Methods that act on the regular
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Reorient Image using NIfTI header
Description
Transforms in the NIfTI header are parsed and normalized versions of these transforms are applied.
Usage
reorient(nim, data, verbose = FALSE, invert = FALSE, tol = 1e-07)
inverseReorient(nim, verbose = FALSE)
Arguments
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. |
Details
This function utilizes the performPermutation
function
internally.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net,
Brandon Whitcher bwhitcher@gmail.com
See Also
Change Intercept to 0 and Slope to 1 in NIfTI Object
Description
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.
Usage
resetSlopeIntercept(img)
zero_trans(img)
Arguments
img |
is a |
Value
An object of the same type passed.
Author(s)
John Muschelli muschellij2@gmail.com
Remove File Extensions Around the NIfTI/ANALYZE Formats
Description
Simple function(s) that remove file extensions commonly found when using NIfTI-1 or ANALYZE format files.
Usage
rmniigz(x)
rmnii(x)
rmgz(x)
rmhdrgz(x)
rmhdr(x)
rmimggz(x)
rmimg(x)
Arguments
x |
is the file name. |
Value
The file name without offending suffix.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
Extract Image Attribute scannum
Description
Methods that act on the scannum
field in the
NIfTI/ANALYZE header.
Usage
scannum(object)
## S4 method for signature 'anlz'
scannum(object)
scannum(object) <- value
## S4 replacement method for signature 'anlz'
scannum(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute scl_inter
Description
Methods that act on the scl_inter
field in the
NIfTI/ANALYZE header.
Usage
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)
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
file = system.file("extdata", "example.nii.gz", package = "RNifti")
img = RNifti::readNifti(file)
scl_inter(img)
scl.inter(img)
Extract Image Attribute scl_slope
Description
Methods that act on the scl_slope
field in the
NIfTI/ANALYZE header.
Usage
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)
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
file = system.file("extdata", "example.nii.gz", package = "RNifti")
img = RNifti::readNifti(file)
scl_slope(img)
scl.slope(img)
Extract Image Attribute session_error
Description
Methods that act on the session_error
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute sform_code
Description
Methods that act on the sform_code
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute sizeof_hdr
Description
Methods that act on the sizeof_hdr
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Methods for Function ‘slice’
Description
Produce “lightbox” layout of slices for nifti
, anlz
and
afni
objects.
Usage
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, ...)
Arguments
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 |
Details
Uses the S3 generic function slice
, with medical-image friendly
settings, to display nifti
, anlz
and afni
class objects
in a “lightbox” layout.
Methods
- x = "ANY"
Generic function: see
image
.- x = "nifti"
Produce images for
x
.- x = "anlz"
Produce images for
x
.- x = "afni"
Produce images for
x
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
See Also
orthographic-methods
, image-methods
Extract Image Attribute slice_code
Description
Methods that act on the slice_code
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute slice_duration
Description
Methods that act on the slice_duration
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)
Extract Image Attribute slice_end
Description
Methods that act on the slice_end
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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
Description
Methods for function slice_overlay
Usage
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, ...)
Arguments
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 |
Details
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.
Methods
- x = "nifti", y = "nifti"
Produce slice_overlay of
y
onx
.- x = "anlz", y = "anlz"
Produce slice_overlay of
y
onx
.- x = "afni", y = "afni"
Produce slice_overlay of
y
onx
.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
See Also
image-methods
, slice_overlay-methods
Extract Image Attribute slice_start
Description
Methods that act on the slice_start
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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
Extract Image Attribute smax
Description
Methods that act on the smax
field in the
NIfTI/ANALYZE header.
Usage
smax(object)
## S4 method for signature 'anlz'
smax(object)
smax(object) <- value
## S4 replacement method for signature 'anlz'
smax(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute smin
Description
Methods that act on the smin
field in the
NIfTI/ANALYZE header.
Usage
smin(object)
## S4 method for signature 'anlz'
smin(object)
smin(object) <- value
## S4 replacement method for signature 'anlz'
smin(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute srow_x
Description
Methods that act on the srow_x
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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))
Extract Image Attribute srow_y
Description
Methods that act on the srow_y
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute srow_z
Description
Methods that act on the srow_z
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute start_field
Description
Methods that act on the start_field
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Tim's Useful Color Table
Description
A pleasing rainbow style color table patterned after that used in Matlab.
Usage
tim.colors(n = 64)
Arguments
n |
is the number of color levels (default = 64). |
Details
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.
Value
A vector of character strings giving the colors in hexadecimal format.
Author(s)
Tim Hoar (GSP-NCAR); modified by Brandon Whitcher
See Also
hotmetal
, topo.colors
,
terrain.colors
Examples
tim.colors(10)
image(outer(1:20, 1:20, "+"), col=tim.colors(75), main="tim.colors")
Extract Image Attribute toffset
Description
Methods that act on the toffset
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
file = system.file("extdata", "example.nii.gz", package = "RNifti")
img = RNifti::readNifti(file)
toffset(img)
toffset(img) = 8
stopifnot(toffset(img) == 8)
Translate Voxel Coordinates
Description
Translates a voxel index into the continuous coordinate space defined by the NIfTI qform and sform information.
Usage
translateCoordinate(i, nim, verbose = FALSE)
Arguments
i |
An index vector in |
nim |
An object of class |
verbose |
Provide detailed output to the user. |
Details
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 inpixdim[0]
. Ifpixdim[0]
!= 1 or -1, which should not occur, we assume 1.The units of the
xyzt
are set inxyzt_units
field.
Value
A nifti
-class object with translated coordinates.
Author(s)
Andrew Thornton zeripath@users.sourceforge.net
Examples
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)
Extract Image Attribute unused1
Description
Methods that act on the unused1
field in the
NIfTI/ANALYZE header.
Usage
unused1(object)
## S4 method for signature 'anlz'
unused1(object)
unused1(object) <- value
## S4 replacement method for signature 'anlz'
unused1(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute verified
Description
Methods that act on the verified
field in the
NIfTI/ANALYZE header.
Usage
verified(object)
## S4 method for signature 'anlz'
verified(object)
verified(object) <- value
## S4 replacement method for signature 'anlz'
verified(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute views
Description
Methods that act on the views
field in the
NIfTI/ANALYZE header.
Usage
views(object)
## S4 method for signature 'anlz'
views(object)
views(object) <- value
## S4 replacement method for signature 'anlz'
views(object) <- value
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute vols_added
Description
Methods that act on the vols_added
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Extract Image Attribute vox_offset
Description
Methods that act on the vox_offset
field in the
NIfTI/ANALYZE header.
Usage
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)
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
file = system.file("extdata", "example.nii.gz", package = "RNifti")
img = RNifti::readNifti(file)
vox_offset(img)
img = RNifti::readNifti(file)
vox.offset(img)
Extract Image Attribute vox_units
Description
Methods that act on the vox_units
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Gets Voxel Dimensions
Description
Grabs the pixdim and takes the correct elements
Usage
voxdim(img)
Arguments
img |
nifti object |
Value
Vector of length 3
Examples
nim <- nifti(array(rnorm(10^3), dim = c(5, 2, 100)),
pixdim = c(1, 0.5, 0.2, 1))
voxdim(nim)
Gets Voxel Resolution
Description
Grabs the 3 voxel dimensions and takes the product
Usage
voxres(img, units = c("mm", "cm"))
Arguments
img |
nifti object |
units |
output unit, either cubic mm or cubic cm. |
Value
Scalar numeric, one number, in cubic mm or cubic cm (cc/mL).
writeAFNI
Description
This function saves a afni-class object to HEAD/BRIK pair in AFNI format.
Usage
writeAFNI(nim, ...)
## S4 method for signature 'afni'
writeAFNI(nim, fname, verbose = FALSE, warn = -1)
Arguments
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 |
Details
The writeAFNI
function utilizes the internal writeBin
and writeLines
command to write information to header/binary file
pair.
Current acceptable data types include
- INT16"
DT SIGNED SHORT (16 bits per voxel)
- FLOAT32"
DT FLOAT (32 bits per voxel)
- "COMPLEX128"
DT COMPLEX (128 bits per voxel)
Value
Nothing.
Methods
- nim = "afni"
Write AFNI volume to disk.
- nim = "ANY"
Not implemented.
Author(s)
Karsten Tabelow karsten.tabelow@wias-berlin.de
References
AFNI
http://afni.nimh.nih.gov/pub/dist/src/README.attributes
See Also
Examples
## 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")
writeANALYZE
Description
This function saves an Analyze-class object to a single binary file in Analyze format.
Usage
## S4 method for signature 'anlz'
writeANALYZE(
aim,
filename,
gzipped = TRUE,
verbose = FALSE,
warn = -1,
compression = 9
)
Arguments
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 |
Details
The writeANALYZE
function utilizes the internal writeBin
and
writeChar
command to write information to a binary file.
Value
Nothing.
Methods
- object = "anlz"
Write ANALYZE volume to disk.
Author(s)
Brandon Whitcher bwhitcher@gmail.com
References
Analyze 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
See Also
Examples
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)
writeNIfTI
Description
This function saves a NIfTI-class object to a single binary file in NIfTI format.
Usage
## 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
)
Arguments
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 |
Details
The writeNIfTI
function utilizes the internal writeBin
and
writeChar
command to write information to a binary file.
Current acceptable data types include
- list("UINT8")
DT BINARY (1 bit per voxel)
- list("INT16")
DT SIGNED SHORT (16 bits per voxel)
- list("INT32")
DT SINGED INT (32 bits per voxel)
- list("FLOAT32")
DT FLOAT (32 bits per voxel)
- list("DOUBLE64")
DT DOUBLE (64 bits per voxel)
- list("UINT16")
DT UNSIGNED SHORT (16 bits per voxel)
Value
Nothing.
Methods
- object = "anlz"
Convert ANALYZE object to class
nifti
and write the NIfTI volume to disk.- object = "array"
Convert array to class
nifti
and write the NIfTI volume to disk.- object = "nifti"
Write NIfTI volume to disk.
Author(s)
Brandon Whitcher bwhitcher@gmail.com,
Volker Schmid
volkerschmid@users.sourceforge.net
References
NIfTI-1
http://nifti.nimh.nih.gov/
See Also
Examples
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)
Bitwise Conversion Subroutines
Description
Units of spatial and temporal dimensions, and MRI-specific spatial and temporal information.
Usage
xyzt2space(xyzt)
xyzt2time(xyzt)
space.time2xyzt(ss, tt)
dim2freq(di)
dim2phase(di)
dim2slice(di)
Arguments
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. |
Details
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
Value
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).
Author(s)
B. Whitcher bwhitcher@gmail.com
References
Neuroimaging Informatics Technology Initiative (NIfTI)
http://nifti.nimh.nih.gov/
See Also
Extract Image Attribute xyzt_units
Description
Methods that act on the xyzt_units
field in the
NIfTI/ANALYZE header.
Usage
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
Arguments
object |
is an object of class |
value |
is the value to assign to the |
Details
See documentation on the ANALYZE and/or NIfTI data standards for more details.
Author(s)
John Muschelli muschellij2@gmail.com,
Brandon Whitcher bwhitcher@gmail.com
References
ANALYZE 7.5
http://eeg.sourceforge.net/ANALYZE75.pdf
NIfTI-1
http://nifti.nimh.nih.gov/
Examples
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)