Skip to content

Commit

Permalink
skip anatomical metrics when running on anatomical fast track derivat…
Browse files Browse the repository at this point in the history
…ives
  • Loading branch information
htwangtw committed Apr 2, 2024
1 parent c7b951f commit 7f70d4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions giga_auto_qc/assessments.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ def calculate_anat_metrics(
"""
if verbose > 0:
print("Calculate the anatomical dice score.")
# check if the derivative was created with anatomical fast-track
check_anat = fmriprep_bids_layout.get(datatype="anat", return_type="file")
if not check_anat:
print("`anat/` not present in the derivatives. " "Skip anatomical QC.")
return pd.DataFrame()

metrics = {}
for sub in tqdm(subjects):
anat_filter = {
Expand Down
6 changes: 6 additions & 0 deletions giga_auto_qc/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def workflow(args):
derivatives=True,
reset_database=args.reindex_bids,
)
if fmriprep_bids_layout is None:
raise ValueError(
f"Cannot index directory in {bids_dir}. "
"Please ensure the path is a fMRIPrep output directory."
)

# check output path
output_dir.mkdir(parents=True, exist_ok=True)

Expand Down

0 comments on commit 7f70d4e

Please sign in to comment.