In [1]:
%matplotlib inline
In [2]:
from numpy import array
import matplotlib.pyplot as plt
import seaborn as sns
In [3]:
import thunder
from showit import image, tile
import matplotlib.animation as animation
In [4]:
from os.path import join, exists
from os import mkdir, makedirs
In [5]:
from numpy import save
In [6]:
from skimage.io import imsave
In [ ]:
from mesoscope.utils import normalize
In [8]:
directory = '/tier2/freeman/Nick/lfov.calibration'
In [9]:
key = '2016-04-18-long'
name = 'anm-0330549'
In [10]:
path = join(directory, 'reprocessed', name, key)
print exists(path)
In [11]:
savepath = join(directory, 'reprocessed', name, key, 'summary')
if not exists(savepath):
makedirs(savepath)
In [13]:
data = thunder.images.frombinary(join(path, 'images'), engine=sc)
In [14]:
data.cache();
In [15]:
mean = data.mean().toarray().astype('float32')
In [16]:
img = mean[:,:]
fig = plt.figure(figsize=[10,10])
ax = plt.axes()
im = image(img, clim=(0, 3.5*img.mean()), ax=ax)
In [17]:
imsave(savepath+'/mean.tif', mean, plugin='tifffile', photometric='minisblack')
#imsave(savepath+'/mean-norm.tif', normalize(mean), plugin='tifffile', photometric='minisblack')
In [19]:
std = data.std().toarray().astype('float32')
In [20]:
img = std[:,:]
fig = plt.figure(figsize=[10,10])
ax = plt.axes()
im = image(img, clim=(0, 3.5*img.mean()), ax=ax)
In [21]:
imsave(savepath+'/std.tif', std, plugin='tifffile', photometric='minisblack')
#imsave(savepath+'/std-norm.tif', normalize(std), plugin='tifffile', photometric='minisblack')
In [22]:
maximum = data.max().toarray().astype('float32')
In [23]:
img = maximum[:,:]
fig = plt.figure(figsize=[10,10])
ax = plt.axes()
im = image(img, clim=(0, 3.5*img.mean()), ax=ax)
In [24]:
imsave(savepath+'/maximum.tif', maximum, plugin='tifffile', photometric='minisblack')
#imsave(savepath+'/maximum-norm.tif', normalize(maximum), plugin='tifffile', photometric='minisblack')
In [25]:
data.shape
Out[25]:
In [26]:
localcorr = data.localcorr((4, 4)).astype('float32')
In [27]:
img = localcorr[:,:]
fig = plt.figure(figsize=[10,10])
ax = plt.axes()
im = image(img, clim=(0, 3.5*img.mean()), ax=ax)
In [28]:
imsave(savepath+'/localcorr.tif', localcorr, plugin='tifffile', photometric='minisblack')
#imsave(savepath+'/localcorr-norm.tif', normalize(localcorr), plugin='tifffile', photometric='minisblack')
In [ ]: