Skip to content

Commit 0448135

Browse files
authored
Fix to set mod
See issue #1339 Previous version failed if 'anat', 'fmap', 'func', 'dwi' strings were found in file path, for example ses-noanatomicals. Changed to name of parent folder of source_file (requires valid BIDS structure).
1 parent a0460f9 commit 0448135

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

fmriprep/interfaces/bids.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,7 @@ def _run_interface(self, runtime):
221221

222222
m = BIDS_NAME.search(src_fname)
223223

224-
# TODO this quick and dirty modality detection needs to be implemented
225-
# correctly
226-
mod = 'func'
227-
if 'anat' in op.dirname(self.inputs.source_file):
228-
mod = 'anat'
229-
elif 'dwi' in op.dirname(self.inputs.source_file):
230-
mod = 'dwi'
231-
elif 'fmap' in op.dirname(self.inputs.source_file):
232-
mod = 'fmap'
224+
mod = op.basename(op.dirname(self.inputs.source_file))
233225

234226
base_directory = runtime.cwd
235227
if isdefined(self.inputs.base_directory):

0 commit comments

Comments
 (0)