mincIO.asVolume-methods: Convert a 3D-Array into a 3D Minc Volume Object

Description Usage Arguments Value Author(s) See Also Examples

Description

MincVolumeIO objects are basically comprised of a 3D array, plus a number of properties which describe the volume. Now, although one can often treat MincVolumeIO just as one would treat any 3D array, nonetheless, there are some computations which strip off the class attributes, returning only the 3D array part. The mincIO.asVolume() function serves to take a 3D array and convert it back into a MincVolumeIO object.

Usage

1
2
3
4
5
## S4 method for signature 'array,MincVolumeIO,missing'
mincIO.asVolume(array3D, likeVolObject, likeTemplate)

## S4 method for signature 'array,missing,character'
mincIO.asVolume(array3D, likeVolObject, likeTemplate)

Arguments

array3D

A 3D array to be converted into a MincVolumeIO object.

likeVolObject

A pre-existing instantiated MincVolumeIO object to serve as a template.

likeTemplate

A character string containing the name of the template volume. See mincIO.makeNewVolume for the names and types of templates currently supported.

Value

An instantiated MincVolumeIO object wrapping the passed 3D array.

Author(s)

Jim Nikelski nikelski@bic.mni.mcgill.ca

See Also

MincVolumeIO

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
\dontshow{
# clear debug flag and get full volume pathname
# ... dunno why zzz.R debug setting is not passed
    R_DEBUG_rmincIO <- 0      
    volDir <- system.file("packageData/volumes", package="rmincIO")
}
# load the ICBM-152 volume
vIcbm <- "icbm_avg_152_t1_tal_lin.mnc"
vIcbm <- file.path(volDir, vIcbm)
vol <- mincIO.readVolume(vIcbm)

# make a mask array (not a volume object)
mask3D <- vol[,,]>100000
class(mask3D)

# apply the mask element-wise to the volume
maskedImage <- vol * mask3D
class(maskedImage)

# recast image data into a MincVolumeIO object
vol2 <-mincIO.asVolume(maskedImage, vol)
class(vol2)

# combining previous 2 lines into 1
vol2 <- mincIO.asVolume(vol * mask3D, vol)


## End(Not run)

jnikelski/rmincIO documentation built on May 19, 2019, 2:58 p.m.