celldetection / util.py
ericup's picture
Add files
0e6708a verified
raw
history blame
674 Bytes
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