Skip to content

Commit

Permalink
Merge pull request #753 from mgxd/enh/path2bids-regex
Browse files Browse the repository at this point in the history
ENH: Add morphometric suffixes to pattern matching
  • Loading branch information
effigies authored Oct 18, 2022
2 parents e5fc210 + a46f5d9 commit 5b898c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion niworkflows/data/nipreps.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"default_path_patterns": [
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_res-{resolution}][_desc-{desc}]_{suffix<T1w|T2w|T1rho|T1map|T2map|T2starmap|FLAIR|FLASH|PDmap|PD|PDT2|dseg|inplaneT[12]|angio|T2starw|MTw|TSE>}{extension<.nii|.nii.gz|.json>|.nii.gz}",
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_from-{from}_to-{to}_mode-{mode<image|points>|image}_{suffix<xfm>|xfm}{extension<.txt|.h5>}",
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_hemi-{hemi<L|R>}[_space-{space}][_cohort-{cohort}][_den-{density}]_{suffix<wm|smoothwm|pial|midthickness|inflated|vinflated|sphere|flat>}{extension<.surf.gii>}",
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}]_hemi-{hemi<L|R>}[_space-{space}][_cohort-{cohort}][_den-{density}]_{suffix<wm|smoothwm|pial|midthickness|inflated|vinflated|sphere|flat|sulc|curv|thickness>}{extension<.surf.gii|.shape.gii>}",
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_res-{resolution}]_desc-{desc}_{suffix<mask>|mask}{extension<.nii|.nii.gz|.json>|.nii.gz}",
"sub-{subject}[/ses-{session}]/{datatype<anat>|anat}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_res-{resolution}]_label-{label}[_desc-{desc}]_{suffix<probseg>|probseg}{extension<.nii|.nii.gz|.json>|.nii.gz}",
"sub-{subject}[/ses-{session}]/{datatype<func>|func}/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_dir-{direction}][_run-{run}][_echo-{echo}][_part-{part}][_space-{space}][_cohort-{cohort}][_res-{resolution}][_desc-{desc}]_{suffix<bold|cbv|sbref|boldref|dseg>}{extension<.nii|.nii.gz|.json>|.nii.gz}",
Expand Down
8 changes: 7 additions & 1 deletion niworkflows/interfaces/surf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,19 @@ class Path2BIDS(SimpleInterface):
suffix = smoothwm
<BLANKLINE>
>>> Path2BIDS(in_file='lh.sulc_converted.gii').run().outputs
<BLANKLINE>
extension = .gii
hemi = L
suffix = sulc
<BLANKLINE>
"""

input_spec = _Path2BIDSInputSpec
output_spec = _Path2BIDSOutputSpec
_pattern = re.compile(
r"(?P<hemi>[lr])h.(?P<suffix>(wm|smoothwm|pial|midthickness|"
r"inflated|vinflated|sphere|flat))[\w\d_-]*(?P<extprefix>\.\w+)?"
r"inflated|vinflated|sphere|flat|sulc|curv|thickness))[\w\d_-]*(?P<extprefix>\.\w+)?"
)
_excluded = ("extprefix",)

Expand Down

0 comments on commit 5b898c4

Please sign in to comment.