Skip to content

Commit 58407ce

Browse files
committed
fix issue with dependency, add support for @@ directory hierarchy
1 parent 5299370 commit 58407ce

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

examples/flywheel_analyzer_engage.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
}
1616

1717

18+
def _find_file(container, glob):
19+
return (
20+
container.find_file(glob) or
21+
# HACK because flywheel does not currently support nested files
22+
# in output folders, we are flattening hierarchy by replacing
23+
# forward slashes with @@
24+
container.find_file(glob.replace('/', '@@')))
25+
26+
1827
def analysis_label(gear_name, acquisition_label):
1928
return '{} ({})'.format(gear_name, acquisition_label)
2029

@@ -40,14 +49,13 @@ def reactivity_inputs(acquisition_label, acquisitions, **kwargs):
4049

4150

4251
def connectivity_inputs(acquisition_label, analyses, acquisitions):
43-
functional = fa.find(acquisitions, label=acquisition_label)
4452
reactivity = fa.find(
4553
analyses, label=analysis_label('reactivity-preprocessing', acquisition_label))
4654

4755
return dict(
48-
functional=functional.find_file('*.nii.gz'),
49-
highres2standard_warp=reactivity.find_file('highres2standard_warp/*.nii.gz'),
50-
example_func2highres=reactivity.find_file('example_func2highres_mat/*.mat'),
56+
functional=_find_file(reactivity, 'realigned_unwarped_files/*.nii'),
57+
highres2standard_warp=_find_file(reactivity, 'highres2standard_warp/*.nii.gz'),
58+
example_func2highres=_find_file(reactivity, 'example_func2highres_mat/*.mat'),
5159
)
5260

5361

@@ -60,15 +68,15 @@ def first_level_model_inputs(acquisition_label, analyses, acquisitions):
6068
acquisitions, label='Behavioral and Physiological')
6169

6270
return dict(
63-
reactivity_functional=reactivity.find_file('smoothed/s02_globalremoved_func_data.nii'),
64-
connectivity_functional=connectivity.find_file('result/swa01_normalized_func_data.nii'),
71+
reactivity_functional=_find_file(reactivity, 'smoothed/s02_globalremoved_func_data.nii'),
72+
connectivity_functional=_find_file(connectivity, 'result/swa01_normalized_func_data.nii'),
6573
behavioral=behavioral.find_file(label_to_behavioral_pattern[acquisition_label]),
66-
structural_brain_fnirt_mask=reactivity.find_file('brain_fnirt_mask/*.nii.gz'),
67-
example_func=reactivity.find_file('example_func/*.nii.gz'),
68-
highres2example_func=reactivity.find_file('highres2example_func_mat/*.mat'),
69-
example_func2highres=reactivity.find_file('example_func2highres_mat/*.mat'),
70-
highres2standard_warp=reactivity.find_file('highres2standard_warp/*.nii.gz'),
71-
spike_regressors_wFD=reactivity.find_file('wFD/spike_regressors_wFD.mat'),
74+
structural_brain_fnirt_mask=_find_file(reactivity, 'brain_fnirt_mask/*.nii.gz'),
75+
example_func=_find_file(reactivity, 'example_func/*.nii.gz'),
76+
highres2example_func=_find_file(reactivity, 'highres2example_func_mat/*.mat'),
77+
example_func2highres=_find_file(reactivity, 'example_func2highres_mat/*.mat'),
78+
highres2standard_warp=_find_file(reactivity, 'highres2standard_warp/*.nii.gz'),
79+
spike_regressors_wFD=_find_file(reactivity, 'wFD/spike_regressors_wFD.mat'),
7280
), dict(task_type=label_to_task_type[acquisition_label])
7381

7482
if __name__ == '__main__':

0 commit comments

Comments
 (0)