File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -1735,7 +1735,34 @@ def get_key_name(path, key):
17351735
17361736
17371737def build_path (filepath , entities , out_dir ):
1738- """Build a new path for a file based on its BIDS entities."""
1738+ """Build a new path for a file based on its BIDS entities.
1739+
1740+ Parameters
1741+ ----------
1742+ filepath : str
1743+ The original file path.
1744+ entities : dict
1745+ A dictionary of BIDS entities.
1746+ out_dir : str
1747+ The output directory for the new file.
1748+
1749+ Returns
1750+ -------
1751+ new_path : str
1752+ The new file path.
1753+
1754+ Examples
1755+ --------
1756+ >>> build_path("sub-01/ses-01/anat/sub-01_ses-01_T1w.nii.gz", {"suffix": "T2w"}, "output")
1757+ 'output/sub-01/ses-01/anat/sub-01_ses-01_T2w.nii.gz'
1758+
1759+ >>> build_path(
1760+ >>> "sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_bold.nii.gz",
1761+ >>> {"task": "rest", "run": "01", "acquisition": "VAR"},
1762+ >>> "output",
1763+ >>> )
1764+ 'output/sub-01/ses-01/func/sub-01_ses-01_task-rest_acq-VAR_run-001_bold.nii.gz'
1765+ """
17391766 exts = Path (filepath ).suffixes
17401767 old_ext = "" .join (exts )
17411768
You can’t perform that action at this time.
0 commit comments