File size: 672 Bytes
0e6708a
20b8a33
0e6708a
 
20b8a33
0e6708a
 
 
 
 
 
 
 
 
 
 
 
20b8a33
0e6708a
20b8a33
0e6708a
20b8a33
0e6708a
20b8a33
 
 
 
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
from shutil import copy2
import tifffile as tif

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


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 copy_skimage_data(dst='examples'):
    from skimage import data
    from os import makedirs
    from os.path import dirname, join, isfile
    from glob import glob

    makedirs(dst, exist_ok=True)

    for f in glob(join(dirname(data.__file__), '*.png')):
        copy2(f, dst)