m_copy=m.copy() #%% resize to increase SNR and have better convergence of segmentation algorithms resizeMovie=True if resizeMovie: fx=.5; # downsample a factor of four along x axis fy=.5; fz=.1; # downsample a factor of 5 across time dimension m.resize(fx=fx,fy=fy,fz=fx) else: fx,fy,fz=1,1,1 #%% compute delta f over f (DF/F) initTime=time.time() m.computeDFF(secsWindow=15,quantilMin=20,subtract_minimum=False) print 'elapsed time:' + str(time.time()-initTime) #%% compute subregions where to apply more efficiently facrtorization algorithms fovs, mcoef, distanceMatrix=m.partition_FOV_KMeans(tradeoff_weight=.7,fx=.25,fy=.25,n_clusters=4,max_iter=500); plt.imshow(fovs) #%% create a denoised version of the movie, nice to visualize if True: m2=m.copy() m2.IPCA_denoise(components = 100, batch = 1000) m2.playMovie(frate=.05,magnification=4,gain=10.0) #%%
m_copy=m.copy() #%% resize to increase SNR and have better convergence of segmentation algorithms resizeMovie=True if resizeMovie: fx=.5; # downsample a factor of four along x axis fy=.5; fz=.2; # downsample a factor of 5 across time dimension m.resize(fx=fx,fy=fy,fz=fz) else: fx,fy,fz=1,1,1 #%% compute delta f over f (DF/F) initTime=time.time()print 'elapsed time:' + str(time.time()-initTime) m.computeDFF(secsWindow=10,quantilMin=50,subtract_minimum=True) print 'elapsed time:' + str(time.time()-initTime) #%% compute subregions where to apply more efficiently facrtorization algorithms fovs, mcoef, distanceMatrix=m.partition_FOV_KMeans(tradeoff_weight=.7,fx=.25,fy=.25,n_clusters=4,max_iter=500); plt.imshow(fovs) #%% create a denoised version of the movie, nice to visualize if True: m2=m.copy() m2.IPCA_denoise(components = 100, batch = 1000) m2.playMovie(frate=.05,magnification=1,gain=2.0) #%% #%% compute spatial components via NMF