Rigid-registration across multiple types of images, non-linear normalization
from native brain to common templates, and map template atlas or 'ROI' back
to native brain. See examples at as_yael_process
Value
whether the image has been set (or replaced)
Absolute path if the image
'RAVE' subject instance
Nothing
A list of moving and fixing images, with rigid transformations from different formats.
See method get_template_mapping
A list of input, output images, with forward and inverse
transform files (usually two 'Affine'
with one displacement field)
transformed image in 'ANTs'
format
transformed image in 'ANTs'
format
Nothing
A matrix of 3 columns, each row is a transformed points (
invalid rows will be filled with NA
)
A matrix of 3 columns, each row is a transformed points (
invalid rows will be filled with NA
)
Active bindings
subject_code
'RAVE' subject code
image_types
allowed image types
work_path
Working directory ('RAVE' imaging path)
Methods
Method new()
Constructor to instantiate the class
Usage
YAELProcess$new(subject_code, image_types)
Arguments
subject_code
character code representing the subject
image_types
vector of image types, such as
'T1w'
,'CT'
,'fGATIR'
. All images except'CT'
will be considered'preop'
(before electrode implantation). Please use'postop'
to indicate if an image is taken after the implantation (for example,'postopT1w'
)
Method set_input_image()
Set the raw input for different image types
Usage
YAELProcess$set_input_image(
path,
type = YAEL_IMAGE_TYPES,
overwrite = FALSE,
on_error = c("warning", "error", "ignore")
)
Arguments
path
path to the image files in
'NIfTI'
formattype
type of the image
overwrite
whether to overwrite existing images if the same type has been imported before; default is false
on_error
when the file exists and
overwrite
is false, how should this error be reported; choices are'warning'
(default),'error'
(throw error and abort), or'ignore'
.
Method get_subject()
Get 'RAVE' subject instance
Arguments
project_name
project name; default is
'YAEL'
strict
passed to
as_rave_subject
Method register_to_T1w()
Register other images to 'T1' weighted 'MRI'
Arguments
image_type
type of the image to register, must be set via
process$set_input_image
first.reverse
whether to reverse the registration; default is false, meaning the fixed (reference) image is the
'T1'
. When setting to true, then the'T1'
'MRI' will become the moving imageverbose
whether to print out the process; default is true
Method map_to_template()
Normalize native brain to 'MNI152'
template
Arguments
template_name
which template to use, choices are
'mni_icbm152_nlin_asym_09a'
,'mni_icbm152_nlin_asym_09b'
,'mni_icbm152_nlin_asym_09c'
.use_images
a vector of image types to use for normalization; default types are
'T1w'
,'T2w'
,'T1wContrast'
,'fGATIR'
, and'preopCT'
. To use all available images for normalization, use wildcard"all"
native_type
which type of image should be used to map to template; default is
'T1w'
verbose
whether to print out the process; default is true
...
additional tuning parameters passed to internal 'Python' code.
Method get_template_mapping()
Get configurations used for normalization
Usage
YAELProcess$get_template_mapping(
template_name = c("mni_icbm152_nlin_asym_09a", "mni_icbm152_nlin_asym_09b",
"mni_icbm152_nlin_asym_09c"),
native_type = "T1w",
relative = FALSE
)
Method transform_image_from_template()
Apply transform from images (usually an atlas or 'ROI') on template to native space
Usage
YAELProcess$transform_image_from_template(
template_roi_path,
template_name = c("mni_icbm152_nlin_asym_09a", "mni_icbm152_nlin_asym_09b",
"mni_icbm152_nlin_asym_09c"),
native_type = "T1w",
interpolator = c("auto", "nearestNeighbor", "linear", "gaussian", "bSpline",
"cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
"lanczosWindowedSinc", "genericLabel"),
verbose = TRUE
)
Arguments
template_roi_path
path to the template image file which will be transformed into individuals' image
template_name
templates to use
native_type
which type of native image to use for calculating the coordinates (default
'T1w'
)interpolator
how to interpolate the
'voxels'
; default is"auto"
:'linear'
for probabilistic map and'nearestNeighbor'
otherwise.verbose
whether the print out the progress
Method transform_image_to_template()
Apply transform to images (usually an atlas or 'ROI') from native space to template
Usage
YAELProcess$transform_image_to_template(
native_roi_path,
template_name = c("mni_icbm152_nlin_asym_09a", "mni_icbm152_nlin_asym_09b",
"mni_icbm152_nlin_asym_09c"),
native_type = "T1w",
interpolator = c("auto", "nearestNeighbor", "linear", "gaussian", "bSpline",
"cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
"lanczosWindowedSinc", "genericLabel"),
verbose = TRUE
)
Arguments
native_roi_path
path to the native image file that will be transformed into template
template_name
templates to use
native_type
which type of native image to use for calculating the coordinates (default
'T1w'
)interpolator
how to interpolate the
'voxels'
; default is"auto"
:'linear'
for probabilistic map and'nearestNeighbor'
otherwise.verbose
whether the print out the progress
Method generate_atlas_from_template()
Generate atlas maps from template and morph to native brain
Usage
YAELProcess$generate_atlas_from_template(
template_name = c("mni_icbm152_nlin_asym_09a", "mni_icbm152_nlin_asym_09b",
"mni_icbm152_nlin_asym_09c"),
atlas_folder = NULL,
surfaces = NA,
verbose = TRUE
)
Arguments
template_name
which template to use
atlas_folder
path to the atlas folder (that contains the atlas files)
surfaces
whether to generate surfaces (triangle mesh); default is
NA
(generate if not existed). Other choices areTRUE
for always generating and overwriting surface files, orFALSE
to disable this function. The generated surfaces will stay in native'T1'
space.verbose
whether the print out the progress
Method transform_points_to_template()
Transform points from native images to template
Usage
YAELProcess$transform_points_to_template(
native_ras,
template_name = c("mni_icbm152_nlin_asym_09a", "mni_icbm152_nlin_asym_09b",
"mni_icbm152_nlin_asym_09c"),
native_type = "T1w",
verbose = TRUE
)
Method transform_points_from_template()
Transform points from template images to native
Usage
YAELProcess$transform_points_from_template(
template_ras,
template_name = c("mni_icbm152_nlin_asym_09a", "mni_icbm152_nlin_asym_09b",
"mni_icbm152_nlin_asym_09c"),
native_type = "T1w",
verbose = TRUE
)
Method construct_ants_folder_from_template()
Create a reconstruction folder (as an alternative option) that
is generated from template brain to facilitate the '3D' viewer.
Please make sure method map_to_template
is called before using
this method (or the program will fail)
Usage
YAELProcess$construct_ants_folder_from_template(
template_name = c("mni_icbm152_nlin_asym_09a", "mni_icbm152_nlin_asym_09b",
"mni_icbm152_nlin_asym_09c"),
add_surfaces = TRUE
)
Arguments
template_name
template to use for mapping
add_surfaces
whether to create surfaces that is morphed from template to local; default is
TRUE
. Please enable this option only if the cortical surfaces are not critical (for example, you are studying the deep brain structures). Always use'FreeSurfer'
if cortical information is used.
Method get_brain()
Get '3D' brain model
Usage
YAELProcess$get_brain(
electrodes = TRUE,
project_name = "YAEL",
coord_sys = c("scannerRAS", "tkrRAS", "MNI152", "MNI305"),
...
)
Arguments
electrodes
whether to add electrodes to the viewers; can be logical, data frame, or a character (path to electrode table). When the value is
TRUE
, the electrode file underproject_name
will be loaded; whenelectrodes
is adata.frame
, or path to a'csv'
file, then please specifycoord_sys
on what is the coordinate system used for columns"x"
,"y"
, and"z"
.project_name
project name under which the electrode table should be queried, if
electrodes=TRUE
coord_sys
coordinate system if
electrodes
is a data frame with columns"x"
,"y"
, and"z"
, available choices are'scannerRAS'
(defined by 'T1' weighted native 'MRI' image),'tkrRAS'
('FreeSurfer'
defined native 'TK-registered'),'MNI152'
(template 'MNI' coordinate system averaged over 152 subjects; this is the common "'MNI' coordinate space" we often refer to), and'MNI305'
(template 'MNI' coordinate system averaged over 305 subjects; this coordinate system used by templates such as'fsaverage'
)...
passed to
threeBrain