""" Test simpleitk plugin functionality. """ import os import numpy as np import pytest from pytest import raises from imageio.testing import run_tests_if_main, get_test_dir import imageio test_dir = get_test_dir() itk = None try: import itk except ImportError: pass try: if not itk: import SimpleITK as itk except ImportError: pass @pytest.mark.skipif("itk is None") def test_simpleitk_reading_writing(): """ Test reading and saveing tiff """ im2 = np.ones((10, 10, 3), np.uint8) * 2
""" The test suite of freeimage plugin """ import os import sys import zipfile import shutil from pytest import raises # noqa from imageio.testing import get_test_dir import imageio from imageio.core import get_remote_file, IS_PYPY, urlopen # noqa test_dir = get_test_dir() # Url to download images from ulr = ("http://sourceforge.net/projects/freeimage/files/" "Test%20Suite%20%28graphics%29/2.5.0/") # Names of zipfiles to download names = ['png', 'jpeg', 'bmp', 'ico', 'tiff', 'targa', 'koa', 'mng', 'iff', 'psd', 'ppm', 'pcx'] # Define what formats are not writable, we will convert these to png NOT_WRITABLE = ['.pgm', '.koa', '.pcx', '.mng', '.iff', '.psd', '.lbm'] # Define files that fail (i.e. crash) FAILS = [] if sys.platform.startswith('linux'):
def test_fei_file_fail(): normal_tif = os.path.join(get_test_dir(), "test_tiff.tiff") imageio.imsave(normal_tif, np.zeros((5, 5), dtype=np.uint8)) bad_reader = imageio.get_reader(normal_tif, format="fei") assert raises(ValueError, bad_reader._get_meta_data)