antsrMotionCalculation: antsrMotionCalculation

Description Usage Arguments Value Note Author(s) Examples

View source: R/antsrMotionCalculation.R

Description

Correct time-series data for motion.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
antsrMotionCalculation(
  img,
  fixed,
  mask,
  typeofTransform = c("Rigid", "QuickRigid", "BOLDRigid", "Affine", "AffineFast",
    "BOLDAffine", "SyN", "SyNOnly"),
  getMotionDescriptors = TRUE,
  verbose = FALSE,
  num_threads = 1,
  seed = NULL,
  ...
)

Arguments

img

antsImage, usually ND where D=4.

fixed

Fixed image to register all timepoints to. If not provided, mean image is used.

mask

mask for image (ND-1). If not provided, estimated from data.

typeofTransform

One of "Affine", "Rigid", '"BOLDAffine", "BOLDRigid", "QuickRigid".

getMotionDescriptors

computes dvars and framewise displacement. May take additional memory.

verbose

enables verbose output.

num_threads

will execute Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS = num_threads) before running to attempt a more reproducible result. See https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues for discussion. If NULL, will not set anything.

seed

will execute Sys.setenv(ANTS_RANDOM_SEED = seed) before running to attempt a more reproducible result. See https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues for discussion. If NULL, will not set anything.

...

extra parameters passed to antsRegistration

Value

List containing:

Note

For reproducible results, you should run Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS = 1), which is what the num_threads = 1 flag will do. See https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues and https://github.com/ANTsX/ANTsR/issues/210#issuecomment-377511054 for discussion

Author(s)

BB Avants, Benjamin M. Kandel, JT Duda, Jeffrey S. Phillips

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS = 1)
Sys.setenv(ANTS_RANDOM_SEED = 1)
set.seed(120)
simimg<-makeImage(rep(5,4), rnorm(5^4))
testthat::expect_equal(mean(simimg), 0.0427369860965759)
res = antsrMotionCalculation( simimg , seed = 1234)
res2 = antsrMotionCalculation( simimg , seed = 1234)
res3 = antsrMotionCalculation( simimg, num_threads = 1, seed = 1 )
	testthat::expect_equal(res, res2)
# testthat::expect_failure(testthat::expect_equal(res, res3))
print(res$fd)
print(res3$fd)
print(res$moco_params)
print(res3$moco_params)

neuroconductor/ANTsR documentation built on Oct. 11, 2020, 8:14 a.m.