# Methods for Function ‘extract’ and ‘[’ in Package ‘dti’

### Description

The methods extract and/or compute specified statistics from object of class `"dtiData"`

, `"dtiTensor"`

, and `"dtiIndices"`

. This can be restricted to a subset of voxel.

### Usage

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 | ```
## S4 method for signature 'dtiData'
extract(x,
what=c("data","gradient","btb","s0","sb","siq"),
xind=TRUE, yind=TRUE, zind=TRUE)
## S4 method for signature 'dtiTensor'
extract(x, what=c("tensor", "fa", "ga", "md", "evalues",
"andir", "s0", "mask", "bic", "aic", "outlier"),
xind=TRUE, yind=TRUE, zind=TRUE, mc.cores = setCores(, reprt = FALSE))
## S4 method for signature 'dwiMixtensor'
extract(x, what=c("andir", "order", "ev", "mix", "s0",
"mask", "fa", "eorder", "bic", "aic"), xind=TRUE, yind=TRUE, zind=TRUE)
## S4 method for signature 'dtiIndices'
extract(x, what=c("fa", "andir", "ga", "md", "bary"),
xind=TRUE, yind=TRUE, zind=TRUE)
## S4 method for signature 'dwiQball'
extract(x, what=c("sphcoef", "s0", "mask", "bic", "aic",
"outlier"), xind=TRUE, yind=TRUE, zind=TRUE)
## S4 method for signature 'dtiData'
x[i, j, k, drop=FALSE]
## S4 method for signature 'dtiTensor'
x[i, j, k, drop=FALSE]
## S4 method for signature 'dtiIndices'
x[i, j, k, drop=FALSE]
## S4 method for signature 'dkiTensor'
x[i, j, k, drop=FALSE]
## S4 method for signature 'dkiIndices'
x[i, j, k, drop=FALSE]
## S4 method for signature 'dwiQball'
x[i, j, k, drop=FALSE]
``` |

### Arguments

`x` |
Object of class |

`i` |
vector of x-coordinates, defaults to whole range. |

`j` |
vector of y-coordinates, defaults to whole range. |

`k` |
vector of z-coordinates, defaults to whole range. |

`xind` |
vector of x-coordinates, defaults to whole range. |

`yind` |
vector of y-coordinates, defaults to whole range. |

`zind` |
vector of z-coordinates, defaults to whole range. |

`what` |
Statistic to extract. See Methods Section for details. |

`drop` |
unused. |

`mc.cores` |
Number of cores to use. Defaults to number of threads specified for openMP, see documentation of package awsMethods. Our experience suggests to use 4-6 cores if available. |

### Value

For function `extract`

a list with components carrying the names of the options specified in
argument `what`

. For code"[" the cutted object.

### Methods

The generic extract function `"["`

does what it is expected to do: it extracts parts of the object specified by `i`

, `j`

, and `k`

.

- x = "ANY"
Returns a warning for

`extract`

. Generic funtion for`"["`

returns an object of same class with data clipped to the indices specified in arguments`i`

,`j`

and`k`

.- x = "dtiData"
Extraction of squared gradient matrix

`"btb"`

or of S0`"s0"`

, Sb`"sb"`

, Si/mean(SO)`"siq"`

or all images`"data"`

restricted to the cube defined by arguments`i`

,`j`

and`k`

.- x = "dtiIndices"
Returns an array containing the specified statistics, i.e. fractional anisotropy

`"fa"`

, geodesic anisotropy`"ga"`

, mean diffusivity`"md"`

, main direction of anisotropy`"andir"`

and/or shape parameters`"bary"`

, as specified in argument`what`

. Information is extracted for voxel within the cube defined by`xind`

,`yind`

, and`zind`

.- x = "dtiTensor"
Returns a list with component names corresponding to

`what`

containing the specified statistics, i.e. fractional anisotropy`"fa"`

, geodesic anisotropy`"ga"`

, mean diffusivity`"md"`

, eigenvalues`"evalues"`

, main direction of anisotropy`"andir"`

, the tensor`"tensor"`

the estimated S0 image`"s0"`

, the values of the model selection criteia BIC`"bic"`

or AIC`"aic"`

and/or the mask used to restrict computations`"mask"`

, as specified in argument`what`

. Information is extracted for voxel within the cube defined by arguments`xind`

,`yind`

and`zind`

.- x = "dwiMixtensor"
Returns a list with component names corresponding to

`what`

containing the specified statistics. Possible values for`what`

are`"order"`

(estimated number of mixture components),`"eorder"`

effective order),`"ev"`

(eigenvalues),`"mix"`

(mixture weights),`"andir"`

(main directions of diffusion),`"fa"`

(FA index),`"s0"`

(the estimated S0 image), the values of the model selection criteia BIC`"bic"`

or AIC`"aic"`

and`mask`

(the mask used to restrict computations). Information is extracted for voxel within the cube defined by arguments`xind`

,`yind`

and`zind`

.- x = "dwiQball"
Returns an array containing the specified statistics, the estimated coefficients with respect to the selected spherical harmonics basis

`"sphcoef"`

, the estimated S0 image`"s0"`

, the values of the model selection criteia BIC`"bic"`

or AIC`"aic"`

and/or the mask used to restrict computations`"mask"`

, as specified in argument`what`

. Information is extracted for voxel within the cube defined by arguments`xind`

,`yind`

and`zind`

.

### Author(s)

Karsten Tabelow tabelow@wias-berlin.de

J\"org Polzehl polzehl@wias-berlin.de

### See Also

`dtiData`

,
`dtiTensor`

,
`dtiIndices`

`dwiMixtensor`

,
`dwiQball`