mincIO.readVolume-methods: Methods to Read a 3D Volume or a Single 4D Frame

Description Usage Arguments Details Value Methods Note Author(s) See Also Examples

Description

Reads a 3D volume or a single 4D frame into a 3D array and returns a MincVolumeIO object.

Usage

1
2
3
4
5
## S4 method for signature 'character'
mincIO.readVolume(object, frameNo = 0, ..., volumeType, colorMap)

## S4 method for signature 'MincInfo'
mincIO.readVolume(object, frameNo = 0, ..., volumeType, colorMap)

Arguments

object

The first argument should contain either a MincInfo object, or a character string containing the name of a valid Minc volume.

frameNo

A 1-relative frame number. Only required for 4D volumes.

...

Other yet to be defined parameters.

volumeType

Type of volume(s) being read. Current options include “anatomical” “mask”, “label” and “functional”; if not specified, reasonable defaults will be assigned (4D = “functional”, 3D = “anatomical”). Note that while this argument primarily effects visualization; Mask and Label volumes are subjected to a call to round() in order to ensure that real values are placed into the integer realm.

colorMap

Color map to be used for display. Any valid R colormaps can be specified; if not specified, reasonable defaults will be assigned (functional and label = “rainbow”, anatomical and mask = “gray”).

Details

This is the primary function to load an entire 3D volume or frame. Not much to say, really.

Value

An instantiated MincVolumeIO object.

Methods

filenames = "character"

Pass a filename.

filenames = "MincInfo"

Pass a single MincInfo object.

Note

Note that since the MincVolumeIO class inherits from array, the data portion of the object is directly accessible via standard array indexing. This feature therefore would permit the user to both retrieve values from and write new values to the volume object. Be warned, however, that due to R's “pass-by-value” semantics, any modification of the volume object will result in the volume being copied. So, if you want to make your machine cry, loop through all of the voxels in a volume and change each voxel's value. The better way to change a lot of values within a volume would involve either: (1) use a vectorized function on the entire volume, resulting in only a single volume copy, or (2) do your processing by slice, resulting in only the slice being copied for each update.

Author(s)

Jim Nikelski nikelski@bic.mni.mcgill.ca

See Also

mincIO.makeNewVolume mincIO.writeVolume MincVolumeIO

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 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")
}
# 3D volume
v305 <- file.path(volDir, "average305_PET_t1_tal_lin.mnc")
vol <- mincIO.readVolume(v305)               # load a 3D volume 
print(vol)                                   # ... print and visualize

vol <- mincIO.readVolume(v305, colorMap="rainbow")

vol <- mincIO.readVolume(v305, colorMap="heat.colors") 

# read a frame from a specific dynamic volume
v4d <- file.path(volDir, "functional_4D.mnc")
vol <- mincIO.readVolume(v4d, 10)            # read frame 10
print(vol)                                   # print and visualize it

## End(Not run)

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