Skip to content

Commit

Permalink
ADD test for anatomical dice score
Browse files Browse the repository at this point in the history
  • Loading branch information
htwangtw committed Aug 29, 2023
1 parent 626c63a commit 00d670b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions giga_auto_qc/tests/test_assessments.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
import pandas as pd
from nibabel import Nifti1Image
from giga_auto_qc import assessments
from bids import BIDSLayout
from pkg_resources import resource_filename
import pytest
import templateflow


def test_quality_accessments():
Expand Down Expand Up @@ -85,3 +89,30 @@ def test_get_consistent_masks():
) = assessments._get_consistent_masks(mask_imgs, exclude)
assert len(cleaned_func_masks) == 7
assert len(weird_mask_identifiers) == 3


@pytest.mark.smoke
def test_calculate_anat_metrics():
bids_dir = resource_filename(
"giga_auto_qc",
"data/test_data/ds000017-fmriprep22.0.1-downsampled-nosurface",
)
fmriprep_bids_layout = BIDSLayout(
root=bids_dir,
database_path=bids_dir,
validate=False,
derivatives=True,
reset_database=True,
)
template_mask = templateflow.api.get(
["MNI152NLin2009cAsym"], desc="brain", suffix="mask", resolution="01"
)
df = assessments.calculate_anat_metrics(
["1", "2"],
fmriprep_bids_layout,
{"anat": template_mask},
{"anatomical_dice": 0.97},
)
print(df)

assert df.shape == (2, 2)

0 comments on commit 00d670b

Please sign in to comment.