diff --git a/caiman/summary_images.py b/caiman/summary_images.py index 7bb50a108..f9a841d35 100644 --- a/caiman/summary_images.py +++ b/caiman/summary_images.py @@ -591,8 +591,7 @@ def local_correlations_movie(file_name, stride: int = 1, swap_dim: bool = False, eight_neighbours: bool = True, - mode: str = 'simple', - is3D: bool = False): + mode: str = 'simple'): """ Compute an online correlation image as moving average @@ -615,15 +614,13 @@ def local_correlations_movie(file_name, Use 18 neighbors if true, and 6 if false for 4D data mode: 'simple', 'exponential', or 'cumulative' Mode of moving average - is3D: Boolean - Whether the movie has 3 spatial dimensions Returns: corr_movie: caiman.movie (3D or 4D). local correlation movie """ - Y = caiman.load(file_name, is3D=is3D) if isinstance(file_name, str) else file_name + Y = caiman.load(file_name) if isinstance(file_name, str) else file_name Y = Y[..., :tot_frames] if swap_dim else Y[:tot_frames] first_moment, second_moment, crosscorr, col_ind, row_ind, num_neigbors, M, cn = \ prepare_local_correlations(Y[..., :window] if swap_dim else Y[:window], @@ -665,8 +662,7 @@ def local_correlations_movie_offline(file_name, remove_baseline: bool = False, winSize_baseline: int = 50, quantil_min_baseline: float = 8, - gaussian_blur: bool=False, - is3D: bool = False): + gaussian_blur: bool=False): """ Efficient (parallel) computation of correlation image in shifting windows with option for prior baseline removal @@ -709,9 +705,6 @@ def local_correlations_movie_offline(file_name, gaussian_blur: bool (False) Gaussian smooth the signal - - is3D: bool (False) - Whether movie has 3 spatial dimensions Returns: mm: caiman.movie (3D or 4D). @@ -723,12 +716,12 @@ def local_correlations_movie_offline(file_name, params:list = [[file_name, range(j, j + window), eight_neighbours, swap_dim, order_mean, ismulticolor, remove_baseline, winSize_baseline, - quantil_min_baseline, gaussian_blur, is3D] + quantil_min_baseline, gaussian_blur] for j in range(0, Tot_frames - window, stride)] params.append([file_name, range(Tot_frames - window, Tot_frames), eight_neighbours, swap_dim, order_mean, ismulticolor, remove_baseline, winSize_baseline, - quantil_min_baseline, gaussian_blur, is3D]) + quantil_min_baseline, gaussian_blur]) if dview is None: parallel_result = list(map(local_correlations_movie_parallel, params)) @@ -745,9 +738,8 @@ def local_correlations_movie_offline(file_name, def local_correlations_movie_parallel(params:tuple) -> np.ndarray: - (mv_name, idx, eight_neighbours, swap_dim, order_mean, ismulticolor, - remove_baseline, winSize_baseline, quantil_min_baseline, gaussian_blur, is3D) = params - mv = caiman.load(mv_name, subindices=idx, in_memory=True, is3D=is3D) + mv_name, idx, eight_neighbours, swap_dim, order_mean, ismulticolor, remove_baseline, winSize_baseline, quantil_min_baseline, gaussian_blur = params + mv = caiman.load(mv_name, subindices=idx, in_memory=True) if gaussian_blur: mv = mv.gaussian_blur_2D() @@ -764,8 +756,7 @@ def mean_image(file_name, Tot_frames=None, fr: float = 10., window: int = 100, - dview=None, - is3D: bool = False): + dview=None): """ Efficient (parallel) computation of mean image in chunks @@ -784,24 +775,21 @@ def mean_image(file_name, dview: map object Use it for parallel computation - - is3D: bool (False) - Whether movie has 3 spatial dimensions Returns: - mm: caiman.movie (2D or 3D). + mm: caiman.movie (2D). mean image """ if Tot_frames is None: _, Tot_frames = caiman.base.movies.get_file_size(file_name) - params:list = [[file_name, range(j * window, (j + 1) * window), is3D] + params:list = [[file_name, range(j * window, (j + 1) * window)] for j in range(int(Tot_frames / window))] remain_frames = Tot_frames - int(Tot_frames / window) * window if remain_frames > 0: - params.append([file_name, range(int(Tot_frames / window) * window, Tot_frames), is3D]) + params.append([file_name, range(int(Tot_frames / window) * window, Tot_frames)]) if dview is None: parallel_result = list(map(mean_image_parallel, params)) @@ -820,6 +808,6 @@ def mean_image(file_name, return mean_image def mean_image_parallel(params:tuple) -> np.ndarray: - mv_name, idx, is3D = params - mv = caiman.load(mv_name, subindices=idx, in_memory=True, is3D=is3D) + mv_name, idx = params + mv = caiman.load(mv_name, subindices=idx, in_memory=True) return mv.mean(axis=0)[np.newaxis,:,:]