Description Usage Arguments Details Value See Also Examples
Extract the coordinates from a Carto3D
or from a MRIaggr
object.
1 2 3 4 5 6 7 | ## S4 method for signature 'Carto3D'
selectCoords(object, coords=c("i","j","k"), num = NULL, format = "data.frame")
## S4 method for signature 'MRIaggr'
selectCoords(object, coords = c("i","j","k"), spatial_res = c(1,1,1),
num = NULL, hemisphere = "both", subset = NULL,
slice_var = "k", format = "data.frame")
|
object |
an |
coords |
the coordinates that sould be extracted. Any of |
spatial_res |
a dilatation factor for the coordinates. positive numeric vector of size 3. |
num |
the slices to extract. numeric vector or |
hemisphere |
the hemisphere to extract. character. |
subset |
the subset of observations to extract. positive integer vector or |
slice_var |
the type of slice to extract. |
format |
the format of the output. Can be |
ARGUMENTS:
Information about the num
argument can be found in the details section of initNum
.
Information about the hemisphere
argument can be found in the details section of selectContrast
.
FUNCTION:
Each of the num
, hemisphere
and subset
argument define a subset of the total set of observations.
It is the intersection of all these three subsets that is extracted.
A "vector"
, matrix or a data.frame. In the latter two cases, each row corresponds to a voxel and each column to a coordinate.
calcHemisphere
to identify the hemispheres.
allocHemisphere<-
and allocContrast<-
to allocate hemispheres obtained from an external source.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #### 1- Carto3D method ####
## load nifti files and convert them to Carto3D
path.Pat1 <- system.file("nifti", package = "MRIaggr")
nifti.Pat1_TTP_t0 <- readMRI(file.path(path.Pat1, "TTP_t0"), format = "nifti")
Carto3D.Pat1_TTP_t0 <- constCarto3D(nifti.Pat1_TTP_t0, identifier = "Pat1", param = "TTP_t0")
## selection all coordinates
coords1 <- selectCoords(Carto3D.Pat1_TTP_t0)
dim(coords1)
## selection coordinates i and j from slices 1 to 3
coords2 <- selectCoords(Carto3D.Pat1_TTP_t0, num = 1:3, coords = c("i","j"))
dim(coords2)
#### 2- MRIaggr method ####
## load a MRIaggr object
data("MRIaggr.Pat1_red", package="MRIaggr")
## select all coordinates for all observations
coords <- selectCoords(MRIaggr.Pat1_red)
dim(coords)
head(coords)
## select coordinate i for slices 1 and 3
coords <- selectCoords(MRIaggr.Pat1_red, coords = "i", num = c(1,3))
dim(coords)
head(coords)
## select coordinate i for observations in the hemishere containing the lesion
coords <- selectCoords(MRIaggr.Pat1_red, hemisphere = "lesion", num = c(1,3))
dim(coords)
head(coords)
## select coordinate i for observations in the right hemisphere
coords <- selectCoords(MRIaggr.Pat1_red, hemisphere = "right", num = c(1,3))
dim(coords)
head(coords)
## select all coordinates and rescale them
coords <- selectCoords(MRIaggr.Pat1_red, spatial_res = c(1.875,1.875,6))
dim(coords)
head(coords)
## select coordinate i and j and return a matrix
coords <- selectCoords(MRIaggr.Pat1_red, format = "matrix")
is(coords)
head(coords)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.