@@ -66,9 +66,8 @@ def test_config_spaces():
66
66
section .load (configs , init = False )
67
67
config .nipype .init ()
68
68
config .loggers .init ()
69
- config .init_spaces ()
70
-
71
- spaces = config .workflow .spaces
69
+ age = 8
70
+ spaces = _load_spaces (age )
72
71
assert "MNI152NLin6Asym:res-2" not in [str (s ) for s in spaces .get_standard (full_spec = True )]
73
72
74
73
assert "MNI152NLin6Asym_res-2" not in [
@@ -78,8 +77,7 @@ def test_config_spaces():
78
77
]
79
78
80
79
config .workflow .use_aroma = True
81
- config .init_spaces ()
82
- spaces = config .workflow .spaces
80
+ spaces = _load_spaces (age )
83
81
84
82
assert "MNI152NLin6Asym:res-2" in [str (s ) for s in spaces .get_standard (full_spec = True )]
85
83
@@ -91,25 +89,17 @@ def test_config_spaces():
91
89
92
90
config .execution .output_spaces = None
93
91
config .workflow .use_aroma = False
94
- config .workflow .age_months = None
95
- config .init_spaces ()
96
- spaces = config .workflow .spaces
97
92
98
- assert [str (s ) for s in spaces .get_standard (full_spec = True )] == []
99
- assert [
100
- format_reference ((s .fullname , s .spec ))
101
- for s in spaces .references
102
- if s .standard and s .dim == 3
103
- ] == []
93
+ with pytest .raises (RuntimeError ):
94
+ spaces = _load_spaces (None )
104
95
105
96
config .execution .output_spaces = None
106
97
config .workflow .cifti_output = "91k"
107
98
config .workflow .use_aroma = False
108
- config .workflow .age_months = 1
109
- config .init_spaces ()
110
- spaces = config .workflow .spaces
99
+ spaces = _load_spaces (1 )
111
100
112
101
assert [str (s ) for s in spaces .get_standard (full_spec = True )] == [
102
+ 'MNIInfant:cohort-1:res-native' , # Default output space
113
103
'fsaverage:den-164k' ,
114
104
'MNI152NLin6Asym:res-2' ,
115
105
]
@@ -118,7 +108,7 @@ def test_config_spaces():
118
108
format_reference ((s .fullname , s .spec ))
119
109
for s in spaces .references
120
110
if s .standard and s .dim == 3
121
- ] == ['MNI152NLin6Asym_res-2' , 'MNIInfant_cohort-1' ]
111
+ ] == ['MNIInfant_cohort-1_res-native' , ' MNI152NLin6Asym_res-2' , 'MNIInfant_cohort-1' ]
122
112
_reset_config ()
123
113
124
114
@@ -138,3 +128,11 @@ def test_prng_seed(master_seed, ants_seed, numpy_seed):
138
128
_reset_config ()
139
129
for seed in ('_random_seed' , 'master' , 'ants' , 'numpy' ):
140
130
assert getattr (config .seeds , seed ) is None
131
+
132
+
133
+ def _load_spaces (age ):
134
+ from nibabies .workflows .base import init_execution_spaces , init_workflow_spaces
135
+
136
+ # Conditional based on workflow necessities
137
+ spaces = init_workflow_spaces (init_execution_spaces (), age )
138
+ return spaces
0 commit comments