Skip to content

Commit

Permalink
Disable preview pics by default (#40)
Browse files Browse the repository at this point in the history
* turned off preview pics, disabled in docker entirely
* reformat file
* bump version
  • Loading branch information
bendhouseart authored Jul 30, 2024
1 parent cf4543a commit ad16144
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
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 <martin.noergaard@nru.dk>", "Anthony Galassi <28850131+bendhouseart@users.noreply.github.com>", "Murat Bilgel <bilgelm@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit ad16144

Please sign in to comment.