In [1]:
%matplotlib inline
from microscopestitching import ImageCollection, stitch, calc_translations_parallel
from skimage.io import imsave, imshow
def img_tuple(img):
row = int(img[1])
col = int(img[4])
return img, row, col
files = !ls r*png
# list of (path, row, column)
images = [img_tuple(f) for f in files]
ic = ImageCollection(images)
ic
Out[1]:
In [2]:
ic[0]
Out[2]:
In [3]:
# calc translation single core
%time tr = ic.translations # top left image excluded
In [4]:
# results are cached
%time tr = ic.translations
In [5]:
# calc translations on all cpu cores
ic = ImageCollection(images) # prevent using cached values
%time translations = calc_translations_parallel(ic)
In [6]:
ic.median_translation()
Out[6]: