Skip to content

Commit

Permalink
Force single-threaded motion correction.
Browse files Browse the repository at this point in the history
This is also to make the output deterministic, at the cost of running slow.

It turned out that using dense sampling wasn't enough; there was still some
numerical instability that came from the order of addition:

* https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues#variance-due-to-floating-point-precision-errors

For some reason it only appeared on OS X, and only about 10% of the time, and never on Linux.
I [showed](#2642 (comment))
that the instability in isct_antsSliceRegularizedRegistration did exist on Linux, so something
still unknown about how we call it was hiding it there.

See:

* https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues
* ANTsX/ANTs#444 (comment)
* ANTsX/ANTsR#210 (comment)
  • Loading branch information
kousu committed May 4, 2020
1 parent cbaa4bc commit 1d5c1ae
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions spinalcordtoolbox/moco.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,12 +724,9 @@ def register(param, file_src, file_dest, file_mat, file_out, im_mask=None):
# run command
if do_registration:
kw.update(dict(is_sct_binary=True))
env = dict()
env.update(os.environ)
env = kw.get("env", env)
# reducing the number of CPU used for moco (see issue #201)
env["ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS"] = "1"
status, output = sct.run(cmd, verbose=1 if param.verbose == 2 else 0, **kw)
env = {**os.environ, **{"ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS": "1"}}
status, output = sct.run(cmd, verbose=1 if param.verbose == 2 else 0, env=env, **kw)

elif param.todo == 'apply':
sct_apply_transfo.main(args=['-i', file_src,
Expand Down

0 comments on commit 1d5c1ae

Please sign in to comment.