Skip to content

Commit 83f337c

Browse files
committed
refactored args naming
1 parent 6e00396 commit 83f337c

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ This software can be installed via source or via pip from PyPi with `pip install
3737
```bash
3838
usage: petdeface.py [-h] [--anat_only] [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [--docker] [--singularity] [--n_procs N_PROCS]
3939
[--skip_bids_validator] [--version] [--placement PLACEMENT] [--remove_existing] [--preview_pics]
40-
[--exclude_participant EXCLUDE_PARTICIPANT [EXCLUDE_PARTICIPANT ...]] [--session SESSION [SESSION ...]]
41-
[--exclude_session EXCLUDE_SESSION [EXCLUDE_SESSION ...]]
40+
[--participant_label_exclude participant_label_exclude [participant_label_exclude ...]] [--session_label SESSION [SESSION ...]]
41+
[--session_label_exclude session_label_exclude [session_label_exclude ...]]
4242
bids_dir [output_dir] [analysis_level]
4343

4444
PetDeface
@@ -66,11 +66,11 @@ options:
6666
--remove_existing, -r
6767
Remove existing output files in output_dir.
6868
--preview_pics Create preview pictures of defacing, defaults to false for docker
69-
--exclude_participant EXCLUDE_PARTICIPANT [EXCLUDE_PARTICIPANT ...]
70-
Exclude a subject(s) from the defacing workflow. e.g. --exclude_participant sub-01 sub-02
71-
--session SESSION [SESSION ...]
69+
--participant_label_exclude participant_label_exclude [participant_label_exclude ...]
70+
Exclude a subject(s) from the defacing workflow. e.g. --participant_label_exclude sub-01 sub-02
71+
--session_label SESSION [SESSION ...]
7272
Select only a specific session(s) to include in the defacing workflow
73-
--exclude_session EXCLUDE_SESSION [EXCLUDE_SESSION ...]
73+
--session_label_exclude session_label_exclude [session_label_exclude ...]
7474
Select a specific session(s) to exclude from the defacing workflow
7575
```
7676

docs/usage.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Additional options can be found in the help menu::
8888
petdeface -h
8989
usage: petdeface.py [-h] [--anat_only] [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [--docker] [--singularity] [--n_procs N_PROCS]
9090
[--skip_bids_validator] [--version] [--placement PLACEMENT] [--remove_existing] [--preview_pics]
91-
[--exclude_participant EXCLUDE_PARTICIPANT [EXCLUDE_PARTICIPANT ...]] [--session SESSION [SESSION ...]]
92-
[--exclude_session EXCLUDE_SESSION [EXCLUDE_SESSION ...]]
91+
[--participant_label_exclude participant_label_exclude [participant_label_exclude ...]] [--session_label SESSION [SESSION ...]]
92+
[--session_label_exclude session_label_exclude [session_label_exclude ...]]
9393
bids_dir [output_dir] [analysis_level]
9494

9595
PetDeface
@@ -117,11 +117,11 @@ options:
117117
--remove_existing, -r
118118
Remove existing output files in output_dir.
119119
--preview_pics Create preview pictures of defacing, defaults to false for docker
120-
--exclude_participant EXCLUDE_PARTICIPANT [EXCLUDE_PARTICIPANT ...]
121-
Exclude a subject(s) from the defacing workflow. e.g. --exclude_participant sub-01 sub-02
122-
--session SESSION [SESSION ...]
120+
--participant_label_exclude participant_label_exclude [participant_label_exclude ...]
121+
Exclude a subject(s) from the defacing workflow. e.g. --participant_label_exclude sub-01 sub-02
122+
--session_label SESSION [SESSION ...]
123123
Select only a specific session(s) to include in the defacing workflow
124-
--exclude_session EXCLUDE_SESSION [EXCLUDE_SESSION ...]
124+
--session_label_exclude session_label_exclude [session_label_exclude ...]
125125
Select a specific session(s) to exclude from the defacing workflow
126126

127127
Docker Based

petdeface/petdeface.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,15 @@ def deface(args: Union[dict, argparse.Namespace]) -> None:
249249
)
250250

251251
# check to see if any subjects are excluded from the defacing workflow
252-
if args.exclude_participant != []:
252+
if args.participant_label_exclude != []:
253253
print(
254-
f"Removing the following subjects {args.exclude_participant} from the defacing workflow"
254+
f"Removing the following subjects {args.participant_label_exclude} from the defacing workflow"
255255
)
256-
args.exclude_participant = [
257-
subject.replace("sub-", "") for subject in args.exclude_participant
256+
args.participant_label_exclude = [
257+
subject.replace("sub-", "") for subject in args.participant_label_exclude
258258
]
259259
subjects = [
260-
subject for subject in subjects if subject not in args.exclude_participant
260+
subject for subject in subjects if subject not in args.participant_label_exclude
261261
]
262262

263263
print(f"Subjects remaining in the defacing workflow: {subjects}")
@@ -277,8 +277,8 @@ def deface(args: Union[dict, argparse.Namespace]) -> None:
277277
args.bids_dir,
278278
preview_pics=args.preview_pics,
279279
anat_only=args.anat_only,
280-
session=args.session,
281-
exclude_session=args.exclude_session,
280+
session=args.session_label,
281+
session_label_exclude=args.session_label_exclude,
282282
)
283283
except FileNotFoundError:
284284
single_subject_wf = None
@@ -306,7 +306,7 @@ def init_single_subject_wf(
306306
preview_pics=False,
307307
anat_only=False,
308308
session=[],
309-
exclude_session=[],
309+
session_label_exclude=[],
310310
) -> Workflow:
311311
"""
312312
Organize the preprocessing pipeline for a single subject.
@@ -323,8 +323,8 @@ def init_single_subject_wf(
323323
:type anat_only: bool, optional
324324
:param session: _description_, will default to only selecting session(s) supplied to this argument, defaults to []
325325
:type session: list, optional
326-
:param exclude_session: _description_, will exclude any session(s) supplied to this argument, defaults to []
327-
:type exclude_session: list, optional
326+
:param session_label_exclude: _description_, will exclude any session(s) supplied to this argument, defaults to []
327+
:type session_label_exclude: list, optional
328328
:raises FileNotFoundError: _description_
329329
:return: _description_
330330
:rtype: Workflow
@@ -347,10 +347,10 @@ def init_single_subject_wf(
347347
sessions_to_exclude = list(
348348
set(bids_data.get_sessions())
349349
- (set(bids_data.get_sessions()) & set(session))
350-
| set(exclude_session)
350+
| set(session_label_exclude)
351351
)
352352
else:
353-
sessions_to_exclude = exclude_session
353+
sessions_to_exclude = session_label_exclude
354354

355355
# check if any t1w images exist for the pet images
356356
for pet_image, t1w_image in subject_data.items():
@@ -767,9 +767,9 @@ def __init__(
767767
remove_existing=True,
768768
placement="adjacent",
769769
preview_pics=True,
770-
exclude_participant=[],
770+
participant_label_exclude=[],
771771
session=[],
772-
exclude_session=[],
772+
session_label_exclude=[],
773773
):
774774
self.bids_dir = bids_dir
775775
self.remove_existing = remove_existing
@@ -780,9 +780,9 @@ def __init__(
780780
self.n_procs = n_procs
781781
self.skip_bids_validator = skip_bids_validator
782782
self.preview_pics = preview_pics
783-
self.exclude_participant = exclude_participant
783+
self.participant_label_exclude = participant_label_exclude
784784
self.session = session
785-
self.exclude_session = exclude_session
785+
self.session_label_exclude = session_label_exclude
786786

787787
# check if freesurfer license is valid
788788
self.fs_license = check_valid_fs_license()
@@ -812,9 +812,9 @@ def run(self):
812812
"placement": self.placement,
813813
"remove_existing": self.remove_existing,
814814
"preview_pics": self.preview_pics,
815-
"exclude_participant": self.exclude_participant,
815+
"participant_label_exclude": self.participant_label_exclude,
816816
"session": self.session,
817-
"exclude_session": self.exclude_session,
817+
"session_label_exclude": self.session_label_exclude,
818818
}
819819
)
820820
wrap_up_defacing(
@@ -915,23 +915,23 @@ def cli():
915915
default=False,
916916
)
917917
parser.add_argument(
918-
"--exclude_participant",
919-
help="Exclude a subject(s) from the defacing workflow. e.g. --exclude_participant sub-01 sub-02",
918+
"--participant_label_exclude",
919+
help="Exclude a subject(s) from the defacing workflow. e.g. --participant_label_exclude sub-01 sub-02",
920920
type=str,
921921
nargs="+",
922922
required=False,
923923
default=[],
924924
)
925925
parser.add_argument(
926-
"--session",
926+
"--session_label",
927927
help="Select only a specific session(s) to include in the defacing workflow",
928928
type=str,
929929
nargs="+",
930930
required=False,
931931
default=[],
932932
)
933933
parser.add_argument(
934-
"--exclude_session",
934+
"--session_label_exclude",
935935
help="Select a specific session(s) to exclude from the defacing workflow",
936936
type=str,
937937
nargs="+",
@@ -1132,9 +1132,9 @@ def main(): # noqa: max-complexity: 12
11321132
remove_existing=args.remove_existing,
11331133
placement=args.placement,
11341134
preview_pics=args.preview_pics,
1135-
exclude_participant=args.exclude_participant,
1136-
session=args.session,
1137-
exclude_session=args.exclude_session,
1135+
participant_label_exclude=args.participant_label_exclude,
1136+
session=args.session_label,
1137+
session_label_exclude=args.session_label_exclude,
11381138
)
11391139
petdeface.run()
11401140

0 commit comments

Comments
 (0)