Skip to content

Commit

Permalink
Merge pull request #546 from dbic/adds_populate_intended_for
Browse files Browse the repository at this point in the history
ENH: specify POPULATE_INTENDED_FOR_OPTS within reproin following the doc
  • Loading branch information
pvelasco authored Feb 28, 2022
2 parents e747f05 + e76750a commit cb2fd91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions heudiconv/heuristics/reproin.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@
"TODO: adjust to your case.",
}

POPULATE_INTENDED_FOR_OPTS = {
'matching_parameters': ['ImagingVolume', 'Shims'],
'criterion': 'Closest'
}

def _delete_chars(from_str, deletechars):
""" Delete characters from string allowing for Python 2 / 3 difference
Expand Down
7 changes: 4 additions & 3 deletions heudiconv/tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,14 @@ def mock_populate_intended_for(session, matching_parameters='Shims', criterion='
output = capfd.readouterr()
# if the heuristic module has a 'POPULATE_INTENDED_FOR_OPTS' field, we expect
# to get the output of the mock_populate_intended_for, otherwise, no output:
if getattr(heuristic, 'POPULATE_INTENDED_FOR_OPTS', None):
pif_cfg = getattr(heuristic, 'POPULATE_INTENDED_FOR_OPTS', None)
if pif_cfg:
assert all([
"\n".join([
"session: " + outfolder.format(sID=s, ses=sesID),
# "ImagingVolume" is defined in heuristic file; "Shims" is the default
"matching_parameters: " + "ImagingVolume",
"criterion: Closest"
f"matching_parameters: {pif_cfg['matching_parameters']}",
f"criterion: {pif_cfg['criterion']}"
]) in output.out
for s in subjects
])
Expand Down

0 comments on commit cb2fd91

Please sign in to comment.