Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable preview pics by default #40

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions petdeface/petdeface.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ def deface(args: Union[dict, argparse.Namespace]) -> None:

for subject_id in participants:
try:
single_subject_wf = init_single_subject_wf(subject_id, args.bids_dir)
single_subject_wf = init_single_subject_wf(
subject_id, args.bids_dir, preview_pics=args.preview_pics
)
except FileNotFoundError:
single_subject_wf = None

Expand All @@ -242,6 +244,7 @@ def init_single_subject_wf(
subject_id: str,
bids_data: [pathlib.Path, BIDSLayout],
output_dir: pathlib.Path = None,
preview_pics=False,
) -> Workflow:
"""
Organize the preprocessing pipeline for a single subject.
Expand Down Expand Up @@ -308,11 +311,9 @@ def init_single_subject_wf(

t1w_wf = Workflow(name=workflow_name)

# create preview pics
# always set preview pics to false if running in docker
if determine_in_docker():
preview_pics = False
else:
preview_pics = True

deface_t1w = Node(
Mideface(
Expand Down Expand Up @@ -670,6 +671,7 @@ def __init__(
skip_bids_validator=True,
remove_existing=True, # TODO: currently not implemented
placement="adjacent", # TODO: currently not implemented
preview_pics=True,
):
self.bids_dir = bids_dir
self.remove_existing = remove_existing
Expand All @@ -680,6 +682,7 @@ def __init__(
self.session = session
self.n_procs = n_procs
self.skip_bids_validator = skip_bids_validator
self.preview_pics = preview_pics

# check if freesurfer license is valid
self.fs_license = check_valid_fs_license()
Expand All @@ -703,6 +706,7 @@ def run(self):
"participant_label": self.subject,
"placement": self.placement,
"remove_existing": self.remove_existing,
"preview_pics": self.preview_pics,
}
)
wrap_up_defacing(
Expand Down Expand Up @@ -790,9 +794,14 @@ def cli():
action="store_true",
default=False,
)
parser.add_argument(
"--preview_pics",
help="Create preview pictures of defacing, defaults to false for docker",
action="store_true",
default=False,
)

arguments = parser.parse_args()

return arguments


Expand Down Expand Up @@ -918,6 +927,7 @@ def main(): # noqa: max-complexity: 12
skip_bids_validator=args.skip_bids_validator,
remove_existing=args.remove_existing,
placement=args.placement,
preview_pics=args.preview_pics,
)
petdeface.run()

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "petdeface"
version = "0.1.0"
version = "0.1.1"
description = "A nipype PET and MR defacing pipeline for BIDS datasets utilizing FreeSurfer's MiDeFace."
authors = ["Martin Nørgaard <[email protected]>", "Anthony Galassi <[email protected]>", "Murat Bilgel <[email protected]>"]
license = "MIT"
Expand Down
Loading