#### 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)
Run the code above in your browser using DataLab