Description Usage Arguments Value Note Author(s) Examples
View source: R/antsrMotionCalculation.R
Correct time-series data for motion.
1 2 3 4 5 6 7 8 9 10 11 12 |
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 |
getMotionDescriptors |
computes dvars and framewise displacement. May take additional memory. |
verbose |
enables verbose output. |
num_threads |
will execute
|
seed |
will execute
|
... |
extra parameters passed to antsRegistration |
List containing:
moco_img Motion corrected time-series image.
moco_params Data frame of translation parameters.
moco_avg_img Average motion-corrected image.
moco_mask Mask used to calculate framewise displacement.
fd Time-series mean and max displacements.
dvars DVARS, derivative of frame-wise intensity changes.
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
BB Avants, Benjamin M. Kandel, JT Duda, Jeffrey S. Phillips
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.