mincIO.makeNewSliceZ-methods: Method to Create an Axial Slice from a MincVolumeIO Object

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

Description

This method retrieves slice 1 from a MincVolumeIO object, and uses it to instantiate an axial MincSlice object. If an initialization vector is provided, it will be used to initialize the slice values, else the slice will be initialized to zeros.

Usage

1
2
## S4 method for signature 'MincVolumeIO'
mincIO.makeNewSliceZ(mincVolume,initVector)

Arguments

mincVolume

The name of a MincVolumeIO object.

initVector

An initialization vector that must contain the same number of elements as are in the slice.

Details

This method fills a very particular need. Specifically, let's say that we have loaded a bunch of slices into a MincSliceIO matrix object, and we do a computation at every voxel. This computation will result in a vector having a length reflecting the number of voxels in the slice. Obviously, we would want to store this result somewhere, so this method permits us to create an empty Z-slice to act as a container for the result. Once the result is in a MincSlice object, it can then be easily moved into a MincVolumeIO object for subsequent writing.

Note that the reason for having a mincIO.makeNewSliceZ method and no mincIO.newSliceX or mincIO.newSliceY methods is because the MincSliceIO objects currently only store axial slices. If a need arises for these other methods, they shall be written.

Value

A MincSlice object.

Methods

mincVolume = "MincVolumeIO"

Only one method/signature.

Author(s)

Jim Nikelski nikelski@bic.mni.mcgill.ca

See Also

mincIO.putSlice MincSlice 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
30
## 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")
}

# create an empty volume and axial slice
vol <- mincIO.makeNewVolume("myResultsVolume.mnc", likeTemplate="mni305PET")

# load slice 20 from 2 3D volumes into a MincSliceIO object
v305 <- file.path(volDir, "average305_PET_t1_tal_lin.mnc")
slicesMatrix <- mincIO.readBySlice(c(v305, v305), 20)

# compute the mean at each voxel
sliceMean <- apply(slicesMatrix,1,mean)   

# create an axial slice and init with the mean() result
zSlice <- mincIO.makeNewSliceZ(vol, sliceMean)

# display/visualize the slice
print(zSlice)
plot(zSlice)

# move the results slice into the output volume
# ... as slice 20
vol <- mincIO.putSlice(zSlice, vol, 20)

## End(Not run)

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