Esempio n. 1
0
def test_dicomweb_retrieve_study(test_dataset, test_dicom_store, capsys):
    dicomweb.dicomweb_store_instance(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        dcm_file)

    dicomweb.dicomweb_retrieve_study(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid)

    out, _ = capsys.readouterr()

    # Check that store instance worked
    assert 'Retrieved study with UID:' in out

    dicomweb.dicomweb_delete_study(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid)
def test_dicomweb_retrieve_study(test_dataset, test_dicom_store, capsys):
    dicomweb.dicomweb_store_instance(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        dcm_file)

    dicomweb.dicomweb_retrieve_study(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid)

    out, _ = capsys.readouterr()

    # Check that store instance worked
    assert 'Retrieved study with UID:' in out

    dicomweb.dicomweb_delete_study(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid)
Esempio n. 3
0
def test_dicomweb_retrieve_rendered(test_dataset, test_dicom_store, capsys):
    try:
        dicomweb.dicomweb_store_instance(base_url, project_id, cloud_region,
                                         dataset_id, dicom_store_id, dcm_file)

        dicomweb.dicomweb_retrieve_rendered(
            base_url,
            project_id,
            cloud_region,
            dataset_id,
            dicom_store_id,
            study_uid,
            series_uid,
            instance_uid,
        )

        # Assert rendered image was downloaded
        assert os.path.isfile("rendered_image.png")

        out, _ = capsys.readouterr()

        # Check that retrieve rendered image worked
        assert "Retrieved rendered image" in out

    finally:
        # Delete downloaded rendered image
        os.remove("rendered_image.png")
def test_dicomweb_retrieve_instance(test_dataset, test_dicom_store, capsys):
    try:
        dicomweb.dicomweb_store_instance(project_id, location, dataset_id,
                                         dicom_store_id, dcm_file)

        dicomweb.dicomweb_retrieve_instance(
            project_id,
            location,
            dataset_id,
            dicom_store_id,
            study_uid,
            series_uid,
            instance_uid,
        )

        # Assert instance was downloaded
        assert os.path.isfile("instance.dcm")

        out, _ = capsys.readouterr()

        # Check that retrieve instance worked
        assert "Retrieved DICOM instance" in out

    finally:
        # Delete downloaded instance
        os.remove("instance.dcm")
Esempio n. 5
0
def test_dicomweb_store_instance(test_dataset, test_dicom_store, capsys):
    dicomweb.dicomweb_store_instance(base_url, project_id, cloud_region,
                                     dataset_id, dicom_store_id, dcm_file)

    out, _ = capsys.readouterr()

    # Check that store instance worked
    assert "Stored DICOM instance" in out
Esempio n. 6
0
def test_dicomweb_delete_study(test_dataset, test_dicom_store, capsys):
    dicomweb.dicomweb_store_instance(base_url, project_id, cloud_region,
                                     dataset_id, dicom_store_id, dcm_file)

    dicomweb.dicomweb_delete_study(base_url, project_id, cloud_region,
                                   dataset_id, dicom_store_id, study_uid)

    out, _ = capsys.readouterr()

    # Check that store instance worked
    assert "Deleted study." in out
Esempio n. 7
0
def test_dicomweb_search_instance_studies(test_dataset, test_dicom_store,
                                          capsys):
    dicomweb.dicomweb_store_instance(base_url, project_id, cloud_region,
                                     dataset_id, dicom_store_id, dcm_file)

    dicomweb.dicomweb_search_instance(base_url, project_id, cloud_region,
                                      dataset_id, dicom_store_id)

    dicomweb.dicomweb_search_studies(base_url, project_id, cloud_region,
                                     dataset_id, dicom_store_id)

    out, _ = capsys.readouterr()

    # Check that search instance worked
    assert "Instances:" in out
    # Check that search studies worked
    assert "Studies found: response is <Response [204]>" in out
Esempio n. 8
0
def test_dicomweb_retrieve_study(test_dataset, test_dicom_store, capsys):
    try:
        dicomweb.dicomweb_store_instance(base_url, project_id, cloud_region,
                                         dataset_id, dicom_store_id, dcm_file)

        dicomweb.dicomweb_retrieve_study(base_url, project_id, cloud_region,
                                         dataset_id, dicom_store_id, study_uid)

        # Assert study was downloaded
        assert os.path.isfile("study.multipart")

        out, _ = capsys.readouterr()

        # Check that retrieve study worked
        assert "Retrieved study" in out

    finally:
        # Delete downloaded study
        os.remove("study.multipart")
def test_dicomweb_retrieve_rendered(test_dataset, test_dicom_store, capsys):
    dicomweb.dicomweb_store_instance(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        dcm_file)

    dicomweb.dicomweb_retrieve_rendered(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid,
        series_uid,
        instance_uid)

    # Assert rendered image was downloaded
    assert os.path.isfile('rendered_image.png')

    out, _ = capsys.readouterr()

    # Check that retrieve rendered image worked
    assert 'Retrieved rendered image' in out

    # Delete downloaded rendered image
    os.remove('rendered_image.png')

    dicomweb.dicomweb_delete_study(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid)
def test_dicomweb_retrieve_study(test_dataset, test_dicom_store, capsys):
    dicomweb.dicomweb_store_instance(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        dcm_file)

    dicomweb.dicomweb_retrieve_study(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid)

    # Assert study was downloaded
    assert os.path.isfile('study.multipart')

    out, _ = capsys.readouterr()

    # Check that retrieve study worked
    assert 'Retrieved study' in out

    # Delete downloaded study
    os.remove('study.multipart')

    dicomweb.dicomweb_delete_study(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        study_uid)
Esempio n. 11
0
def test_dicomweb_search_instance_studies(test_dataset, test_dicom_store,
                                          capsys):
    dicomweb.dicomweb_store_instance(service_account_json, base_url,
                                     project_id, cloud_region, dataset_id,
                                     dicom_store_id, dcm_file)

    dicomweb.dicomweb_search_instance(service_account_json, base_url,
                                      project_id, cloud_region, dataset_id,
                                      dicom_store_id)

    dicomweb.dicomweb_search_studies(service_account_json, base_url,
                                     project_id, cloud_region, dataset_id,
                                     dicom_store_id)

    out, _ = capsys.readouterr()

    # Check that search instance worked
    assert 'Instances:' in out
    # Check that search studies worked
    assert 'Patients found matching query' in out

    dicomweb.dicomweb_delete_study(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, dicom_store_id,
                                   study_uid)