-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_anatomical.py
More file actions
42 lines (33 loc) · 1.3 KB
/
test_anatomical.py
File metadata and controls
42 lines (33 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Integration tests for AFNI methods used across modalities."""
from types import SimpleNamespace
import pytest
from rbc.core import anatomical
@pytest.mark.slow
def test_brain_extraction(test_subject: SimpleNamespace) -> None:
"""Test brain extraction."""
ants_bet_output = anatomical.ants_brain_extraction(
in_file=test_subject.t1w, output_prefix="test"
)
# Test extracted brain image exists
assert ants_bet_output.brain_extracted_image is not None
assert ants_bet_output.brain_extracted_image.exists()
# Test brain mask exists
assert ants_bet_output.brain_mask is not None
assert ants_bet_output.brain_mask.exists()
@pytest.mark.slow
def test_tissue_segmentation(test_subject: SimpleNamespace) -> None:
"""Test tissue segmentation."""
tissue_mask = anatomical.fsl_tissue_segmentation(
in_file=test_subject.t1w, output_prefix="test"
)
assert tissue_mask.csf.exists()
assert tissue_mask.gm.exists()
assert tissue_mask.wm.exists()
@pytest.mark.slow
def test_registration(test_subject: SimpleNamespace) -> None:
"""Test anatomical registration."""
composite_xfms = anatomical.ants_registration(
in_file=test_subject.t1w, output_prefix="test"
)
assert composite_xfms.forward.exists()
assert composite_xfms.inverse.exists()