|
17 | 17 | from ..base import TraitedSpec, File, Str, traits, InputMultiPath, isdefined
|
18 | 18 | from .base import ANTSCommand, ANTSCommandInputSpec
|
19 | 19 |
|
| 20 | +try: |
| 21 | + LOCAL_DEFAULT_NUMBER_OF_THREADS = int(os.getenv("LOCAL_DEFAULT_NUMBER_OF_THREADS")) |
| 22 | +except TypeError: |
| 23 | + LOCAL_DEFAULT_NUMBER_OF_THREADS = 1 |
| 24 | + |
20 | 25 |
|
21 | 26 | class ANTSInputSpec(ANTSCommandInputSpec):
|
22 | 27 | dimension = traits.Enum(
|
@@ -1516,9 +1521,8 @@ class RegistrationSynQuickInputSpec(ANTSCommandInputSpec):
|
1516 | 1521 | desc='Moving image or target image')
|
1517 | 1522 | output_prefix = Str("transform", usedefault=True, argstr='-o %s',
|
1518 | 1523 | desc="A prefix that is prepended to all output files")
|
1519 |
| - |
1520 |
| - # todo ANTSCommandInputSpec already has this, but I can't figure out how to set it without defining it again |
1521 |
| - num_threads = traits.Int(default_value=1, desc='Number of threads (default = 1)', argstr='-n %d') |
| 1524 | + num_threads = traits.Int(default_value=LOCAL_DEFAULT_NUMBER_OF_THREADS, usedefault=True, |
| 1525 | + desc='Number of threads (default = 1)', argstr='-n %d') |
1522 | 1526 |
|
1523 | 1527 | transform_type = traits.Enum('s', 't', 'r', 'a', 'sr', 'b', 'br', argstr='-t %s',
|
1524 | 1528 | desc="""
|
@@ -1554,11 +1558,24 @@ class RegistrationSynQuickOutputSpec(TraitedSpec):
|
1554 | 1558 |
|
1555 | 1559 | class RegistrationSynQuick(ANTSCommand):
|
1556 | 1560 | """
|
| 1561 | + Reistration using a symmetric image normalization method (SyN). |
| 1562 | + You can read more in Avants et al.; Med Image Anal., 2008 |
| 1563 | + (https://www.ncbi.nlm.nih.gov/pubmed/17659998). |
| 1564 | +
|
1557 | 1565 | Examples
|
1558 | 1566 | --------
|
1559 | 1567 |
|
| 1568 | + >>> import copy, pprint |
| 1569 | + >>> from nipype.interfaces.ants import Registration |
| 1570 | + >>> reg = RegistrationSynQuick() |
| 1571 | + >>> reg.inputs.fixed_image = 'fixed1.nii' |
| 1572 | + >>> reg.inputs.moving_image = 'moving1.nii' |
| 1573 | + >>> reg.inputs.num_threads = 2 |
| 1574 | + >>> reg.cmdline |
| 1575 | + 'antsRegistrationSynQuick.sh -d 3 -f fixed1.nii -m moving1.nii -n 2 -o transform -p d -t s' |
| 1576 | + >>> reg.run() # doctest: +SKIP |
1560 | 1577 | """
|
1561 |
| - # todo examples |
| 1578 | + |
1562 | 1579 |
|
1563 | 1580 | _cmd = 'antsRegistrationSynQuick.sh'
|
1564 | 1581 | input_spec = RegistrationSynQuickInputSpec
|
|
0 commit comments