23
23
"""Parser."""
24
24
25
25
import sys
26
+ from pathlib import Path
26
27
27
28
from .. import config
28
29
@@ -32,9 +33,13 @@ def _build_parser(**kwargs):
32
33
33
34
``kwargs`` are passed to ``argparse.ArgumentParser`` (mainly useful for debugging).
34
35
"""
35
- from argparse import Action , ArgumentDefaultsHelpFormatter , ArgumentParser
36
+ from argparse import (
37
+ Action ,
38
+ ArgumentDefaultsHelpFormatter ,
39
+ ArgumentParser ,
40
+ BooleanOptionalAction ,
41
+ )
36
42
from functools import partial
37
- from pathlib import Path
38
43
39
44
from niworkflows .utils .spaces import OutputReferencesAction , Reference
40
45
from packaging .version import Version
@@ -413,7 +418,7 @@ def _fallback_trt(value, parser):
413
418
'--slice-time-ref' ,
414
419
required = False ,
415
420
action = 'store' ,
416
- default = None ,
421
+ default = 0.5 ,
417
422
type = SliceTimeRef ,
418
423
help = 'The time of the reference slice to correct BOLD values to, as a fraction '
419
424
'acquisition time. 0 indicates the start, 0.5 the midpoint, and 1 the end '
@@ -496,7 +501,6 @@ def _fallback_trt(value, parser):
496
501
)
497
502
g_conf .add_argument (
498
503
'--project-goodvoxels' ,
499
- required = False ,
500
504
action = 'store_true' ,
501
505
default = False ,
502
506
help = 'Exclude voxels whose timeseries have locally high coefficient of variation '
@@ -521,10 +525,11 @@ def _fallback_trt(value, parser):
521
525
'(default is 91k, which equates to 2mm resolution)' ,
522
526
)
523
527
g_outputs .add_argument (
524
- '--no-msm' ,
525
- action = 'store_false' ,
528
+ '--msm' ,
529
+ action = BooleanOptionalAction ,
530
+ default = True ,
526
531
dest = 'run_msmsulc' ,
527
- help = 'Disable Multimodal Surface Matching surface registration.' ,
532
+ help = 'Enable or disable Multimodal Surface Matching surface registration.' ,
528
533
)
529
534
530
535
g_confounds = parser .add_argument_group ('Options relating to confounds' )
@@ -634,10 +639,11 @@ def _fallback_trt(value, parser):
634
639
'(default: OUTPUT_DIR/freesurfer)' ,
635
640
)
636
641
g_fs .add_argument (
637
- '--no-submm-recon' ,
638
- action = 'store_false' ,
642
+ '--submm-recon' ,
643
+ action = BooleanOptionalAction ,
644
+ default = True ,
639
645
dest = 'hires' ,
640
- help = 'Disable sub-millimeter (hires ) reconstruction' ,
646
+ help = 'Enable or disable sub-millimeter (hi-res ) reconstruction. ' ,
641
647
)
642
648
g_fs .add_argument (
643
649
'--fs-no-reconall' ,
@@ -656,6 +662,7 @@ def _fallback_trt(value, parser):
656
662
g_carbon = parser .add_argument_group ('Options for carbon usage tracking' )
657
663
g_carbon .add_argument (
658
664
'--track-carbon' ,
665
+ default = False ,
659
666
action = 'store_true' ,
660
667
help = 'Tracks power draws using CodeCarbon package' ,
661
668
)
@@ -682,7 +689,6 @@ def _fallback_trt(value, parser):
682
689
'--work-dir' ,
683
690
action = 'store' ,
684
691
type = Path ,
685
- default = Path ('work' ).absolute (),
686
692
help = 'Path where intermediate results should be stored' ,
687
693
)
688
694
g_other .add_argument (
@@ -776,6 +782,9 @@ def parse_args(args=None, namespace=None):
776
782
config .execution .log_level = int (max (25 - 5 * opts .verbose_count , logging .DEBUG ))
777
783
config .from_dict (vars (opts ), init = ['nipype' ])
778
784
785
+ if config .execution .work_dir is None :
786
+ config .execution .work_dir = Path ('work' ).absolute ()
787
+
779
788
# Consistency checks
780
789
force_set = set (config .workflow .force )
781
790
ignore_set = set (config .workflow .ignore )
0 commit comments