MRIaggr-allocContrast: Allocate new contrast parameters

Description Usage Arguments Details Value See Also Examples

Description

Allocate one or several contrast parameters to a MRIaggr object.

Usage

1
2
3
## S4 replacement method for signature 'MRIaggr'
allocContrast(object, param = NULL, default_value = NULL,
         overwrite = FALSE, verbose = optionsMRIaggr("verbose")) <- value

Arguments

object

an object of class MRIaggr. REQUIRED.

value

the value of each contrast parameter (in columns) at each voxel (in rows). data.frame. REQUIRED.

param

the names of the contrast parameters. character vector or NULL leading to use the name of the value argument.

default_value

the reference values of the contrast parameters (e.g background values). A one row data.frame where the column length must match the length of the param argument.

overwrite

if a contrast parameters with the same names are already stored in object@data, can they be overwritten ? logical.

verbose

should the execution of the function be traced ? logical.

Details

FUNCTION:
If the param argument is not specified then the names of the value argument will be used to define the parameter names.

If the default_value argument is NULL then default values "undefined" are attributed to each parameter.

If a parameter named "mask" is intended to be allocated it must be done alone and it must be of type logical.

Parameter names "index", "i", "j" and "k" are reserved and cannot be modified. Nevertheless if value contains parameters "i", "j" and "k", the correspondance between these coordinates and the object coordinates is tested.

Value

None.

See Also

calcContralateral, calcRegionalContrast, calcFilter and calcTissueType to compute, modify and allocate cartography.
selectContrast to select contrast parameters in the MRIaggr object.

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
## load NIFTI files and convert them to MRIaggr
path.Pat1 <- system.file(file.path("nifti"), package = "MRIaggr")
ls.array <- list()
ls.array[[1]] <- readMRI(file.path(path.Pat1, "DWI_t0"),format = "nifti")
ls.array[[2]] <- readMRI(file.path(path.Pat1, "MASK_DWI_t0"),format = "nifti")
MRIaggr.Pat1 <- constMRIaggr(ls.array, identifier = "Pat1", param = c("DWI_t0", "MASK_DWI_t0"))

## allocate a new contrast parameters
allocContrast(MRIaggr.Pat1, param = "noise", overwrite = TRUE) <- rnorm(selectN(MRIaggr.Pat1))

## perform operations on a contrast parameters and store the results
myCarto <- selectContrast(MRIaggr.Pat1 , param = "DWI_t0")
myCarto <- myCarto * 2 + 1
allocContrast(MRIaggr.Pat1, param = "myCarto", overwrite = TRUE) <- myCarto

## import a contrast parameters in an already existing MRIaggr object
nifti.MTT_t0 <- readMRI(file.path(path.Pat1, "MTT_t0"), format = "nifti")
df.MTT_t0 <- array2dt(nifti.MTT_t0, name_newparam = "MTT_t0")$MTT_t0
allocContrast(MRIaggr.Pat1, param = "MTT_t0", overwrite = TRUE) <- df.MTT_t0

## some calc methods automatically save results in the @data slot
calcFilter(MRIaggr.Pat1, param = "MTT_t0", filter = "2D_G3",
           update.object = TRUE, overwrite = TRUE)
res <- selectContrast(MRIaggr.Pat1, param = "MTT_t0_2D_G3")

bozenne/MRIaggr documentation built on May 13, 2019, 1:39 a.m.