Пример #1
0
def _change_backend(backend):
    if backend not in image_utils.get_available_backends():
        pytest.skip("{} is not installed".format(backend))

    # change backend arbitrary
    image_utils.set_backend(backend)
    assert image_utils.get_backend() == backend
Пример #2
0
def load_image_dcm(file, shape=None, normalize=False):
    if normalize:
        max_range = 1.0
    else:
        max_range = -1

    img = None
    try:
        if 'dicom' not in image_utils.get_available_backends():
            raise ValueError("Please ensure cv2 and dicom is installed.")

        current_backend = image_utils.get_backend()
        image_utils.set_backend('dicom')
        img = load_image_imread(file, shape, max_range)
        return img
    finally:
        image_utils.set_backend(current_backend)
        return img