File size: 674 Bytes
0e6708a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from imageio.v2 import imread as _imread
import tifffile as tif

__all__ = ['imread', 'imsave', 'get_examples']


def imread(filename):
    if filename.split('.')[-1] in ('tiff', 'tif'):
        return tif.imread(filename)
    return _imread(filename)


def imsave(filename, img, compression="zlib"):
    tif.imwrite(filename, img, compression=compression)


def get_examples(default_model):
    from skimage import data
    from os.path import dirname, join, isfile

    examples = []
    for f in ['coins.png']:
        f = join(dirname(data.__file__), f)
        if isfile(f):
            examples.append([f, default_model])
    if len(examples):
        return examples