Skip to content

Commit bd7817b

Browse files
authored
[FIX] allow atlas arguments to be None (#283)
* allow atlas_img and atlas_lut to be None * test that atlas_img and atlas_lut can be none
1 parent 5098d06 commit bd7817b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/nibetaseries/cli/run.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,19 @@ def main():
230230
'parameterize_dirs': False},
231231
})
232232

233+
# check if atlas img or atlas lut exist
234+
if opts.atlas_img and opts.atlas_lut:
235+
atlas_img = os.path.abspath(opts.atlas_img)
236+
atlas_lut = os.path.abspath(opts.atlas_lut)
237+
else:
238+
atlas_img = atlas_lut = None
239+
233240
# running participant level
234241
if opts.analysis_level == "participant":
235242
nibetaseries_participant_wf = init_nibetaseries_participant_wf(
236243
estimator=opts.estimator,
237-
atlas_img=os.path.abspath(opts.atlas_img),
238-
atlas_lut=os.path.abspath(opts.atlas_lut),
244+
atlas_img=atlas_img,
245+
atlas_lut=atlas_lut,
239246
bids_dir=bids_dir,
240247
database_path=opts.database_path,
241248
derivatives_pipeline_dir=derivatives_pipeline_dir,

src/nibetaseries/cli/tests/test_run.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,18 @@ def test_conditional_arguments(monkeypatch):
3636
get_parser().parse_args(no_img)
3737

3838

39-
@pytest.mark.parametrize("estimator,fir_delays,hrf_model,part_label",
40-
[('lsa', None, 'spm', '01'),
41-
('lss', None, 'spm', 'sub-01'),
42-
('lss', [0, 1, 2, 3, 4], 'fir', None)])
39+
@pytest.mark.parametrize("use_atlas,estimator,fir_delays,hrf_model,part_label",
40+
[(True, 'lsa', None, 'spm', '01'),
41+
(False, 'lss', None, 'spm', 'sub-01'),
42+
(True, 'lss', [0, 1, 2, 3, 4], 'fir', None)])
4343
def test_nibs(
4444
bids_dir, deriv_dir, sub_fmriprep, sub_metadata, bold_file, preproc_file,
4545
sub_events, confounds_file, brainmask_file, atlas_file, atlas_lut,
46-
estimator, fir_delays, hrf_model, monkeypatch, part_label):
46+
estimator, fir_delays, hrf_model, monkeypatch, part_label, use_atlas):
4747
import sys
4848
bids_dir = str(bids_dir)
4949
out_dir = os.path.join(bids_dir, 'derivatives')
5050
args = ["nibs",
51-
"-a", str(atlas_file),
52-
"-l", str(atlas_lut),
5351
"-c", "white_matter", "csf",
5452
"--high-pass", "0.008",
5553
"--estimator", estimator,
@@ -66,6 +64,8 @@ def test_nibs(
6664
out_dir,
6765
"participant",
6866
"-c", ".*derivative.*"]
67+
if use_atlas:
68+
args.extend(["-a", str(atlas_file), "-l", str(atlas_lut)])
6969
if fir_delays:
7070
args.append('--fir-delays')
7171
args.extend([str(d) for d in fir_delays])

0 commit comments

Comments
 (0)