Beispiel #1
0
def create_image_level_study(
    study_instance_uid,
    series_instance_uids: List[str],
    sop_class_uids: List[str],
) -> Dataset:
    return DICOMQR.parse_c_find_response(
        create_c_find_image_response(study_instance_uid, series_instance_uids,
                                     sop_class_uids))[0]
Beispiel #2
0
def an_image_level_study() -> List[Study]:
    """A study with series and slice info"""
    response = create_c_find_image_response(
        study_instance_uid="Study1",
        series_instance_uids=["Series1", "Series2"],
        sop_class_uids=[f"Instance{i}" for i in range(1, 10)],
    )
    return DICOMQR.parse_c_find_response(response)
Beispiel #3
0
def another_image_level_series() -> Series:
    """A study with series and slice info"""
    response = create_c_find_image_response(
        study_instance_uid="Study1",
        series_instance_uids=["Series2"],
        sop_class_uids=[f"Instance{i}" for i in range(1, 10)],
    )
    study = DICOMQR.parse_c_find_response(response)[0]
    return study.get("Series2")
Beispiel #4
0
def test_parse_study_response():
    """Parse CFIND response for STUDY level. This is missing any series or instance
    info and should yield studies with no series
    """
    qr = DICOMQR(host="host", port=123)
    parsed = qr.parse_c_find_response(
        create_c_find_study_response(
            study_instance_uids=[f"Study{i}" for i in range(1, 10)]
        )
    )

    assert len(parsed) == 9
    assert len(parsed[0].series) == 0
Beispiel #5
0
def test_parse_instance_response():
    """Parse CFIND response for IMAGE level. This should yield a full-depth
    study/series/instance object
    """
    qr = DICOMQR(host="host", port=123)
    parsed = qr.parse_c_find_response(
        create_c_find_image_response(
            study_instance_uid="Study1",
            series_instance_uids=["Series1"],
            sop_class_uids=[f"Instance{i}" for i in range(1, 10)],
        )
    )

    assert len(parsed) == 1
    assert len(parsed[0].series) == 1
    assert len(parsed[0].series[0].instances) == 9
Beispiel #6
0
def a_study_level_study():
    """Study witnout slice info"""
    return DICOMQR.parse_c_find_response(
        create_c_find_study_response(study_instance_uids=["Study2"]))