File size: 1,467 Bytes
aef1f5a
 
 
 
 
 
 
 
 
 
d77e99f
aef1f5a
 
4994e68
d77e99f
aef1f5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4994e68
d77e99f
aef1f5a
 
 
 
 
 
 
 
 
 
 
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
43
44
45
"""Integration tests with real ISLES24 data."""

from __future__ import annotations

from pathlib import Path

import pytest

from stroke_deepisles_demo.data.loader import load_isles_dataset

REAL_DATA_PATH = Path("data/isles24")


@pytest.mark.integration
@pytest.mark.skipif(not REAL_DATA_PATH.exists(), reason="Real data not found in data/isles24")
def test_load_real_data_count() -> None:
    """Verify that we can load the expected number of cases from real data."""
    dataset = load_isles_dataset(source=REAL_DATA_PATH)

    # We expect 149 cases based on schema report
    assert len(dataset) == 149

    # Check a specific known case
    case = dataset.get_case("sub-stroke0005")
    assert case["dwi"].name == "sub-stroke0005_ses-02_dwi.nii.gz"
    assert case["dwi"].exists()
    assert case["adc"].exists()
    assert case["ground_truth"] is not None
    assert case["ground_truth"].exists()


@pytest.mark.integration
@pytest.mark.skipif(not REAL_DATA_PATH.exists(), reason="Real data not found in data/isles24")
def test_real_data_subject_ids() -> None:
    """Verify subject ID formatting on real data."""
    dataset = load_isles_dataset(source=REAL_DATA_PATH)
    ids = dataset.list_case_ids()

    assert len(ids) == 149
    assert ids[0] == "sub-stroke0001"
    # We know there are gaps, so just check the format
    for subject_id in ids:
        assert subject_id.startswith("sub-stroke")
        assert len(subject_id) == len("sub-strokeXXXX")