Skip to content

Commit ad16144

Browse files
authored
Disable preview pics by default (#40)
* turned off preview pics, disabled in docker entirely * reformat file * bump version
1 parent cf4543a commit ad16144

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

petdeface/petdeface.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ def deface(args: Union[dict, argparse.Namespace]) -> None:
218218

219219
for subject_id in participants:
220220
try:
221-
single_subject_wf = init_single_subject_wf(subject_id, args.bids_dir)
221+
single_subject_wf = init_single_subject_wf(
222+
subject_id, args.bids_dir, preview_pics=args.preview_pics
223+
)
222224
except FileNotFoundError:
223225
single_subject_wf = None
224226

@@ -242,6 +244,7 @@ def init_single_subject_wf(
242244
subject_id: str,
243245
bids_data: [pathlib.Path, BIDSLayout],
244246
output_dir: pathlib.Path = None,
247+
preview_pics=False,
245248
) -> Workflow:
246249
"""
247250
Organize the preprocessing pipeline for a single subject.
@@ -308,11 +311,9 @@ def init_single_subject_wf(
308311

309312
t1w_wf = Workflow(name=workflow_name)
310313

311-
# create preview pics
314+
# always set preview pics to false if running in docker
312315
if determine_in_docker():
313316
preview_pics = False
314-
else:
315-
preview_pics = True
316317

317318
deface_t1w = Node(
318319
Mideface(
@@ -670,6 +671,7 @@ def __init__(
670671
skip_bids_validator=True,
671672
remove_existing=True, # TODO: currently not implemented
672673
placement="adjacent", # TODO: currently not implemented
674+
preview_pics=True,
673675
):
674676
self.bids_dir = bids_dir
675677
self.remove_existing = remove_existing
@@ -680,6 +682,7 @@ def __init__(
680682
self.session = session
681683
self.n_procs = n_procs
682684
self.skip_bids_validator = skip_bids_validator
685+
self.preview_pics = preview_pics
683686

684687
# check if freesurfer license is valid
685688
self.fs_license = check_valid_fs_license()
@@ -703,6 +706,7 @@ def run(self):
703706
"participant_label": self.subject,
704707
"placement": self.placement,
705708
"remove_existing": self.remove_existing,
709+
"preview_pics": self.preview_pics,
706710
}
707711
)
708712
wrap_up_defacing(
@@ -790,9 +794,14 @@ def cli():
790794
action="store_true",
791795
default=False,
792796
)
797+
parser.add_argument(
798+
"--preview_pics",
799+
help="Create preview pictures of defacing, defaults to false for docker",
800+
action="store_true",
801+
default=False,
802+
)
793803

794804
arguments = parser.parse_args()
795-
796805
return arguments
797806

798807

@@ -918,6 +927,7 @@ def main(): # noqa: max-complexity: 12
918927
skip_bids_validator=args.skip_bids_validator,
919928
remove_existing=args.remove_existing,
920929
placement=args.placement,
930+
preview_pics=args.preview_pics,
921931
)
922932
petdeface.run()
923933

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "petdeface"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "A nipype PET and MR defacing pipeline for BIDS datasets utilizing FreeSurfer's MiDeFace."
55
authors = ["Martin Nørgaard <[email protected]>", "Anthony Galassi <[email protected]>", "Murat Bilgel <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)