Note
This page was generated from a Jupyter notebook. Not all interactive visualization will work on this web page. Consider downloading the notebooks for full Python-backed interactivity.
[ ]:
# holoviews initialization
1. Setting Up¶
Cross-registration allows the user to register the outcomes of the MiniAn pipeline across multiple experimental sessions. It is a useful add-on to deal with longitudinal experiments.
1.1. specify directories and dataset patterns¶
For cross-registration to work, we need to have existing datasets with proper metadata. At the minimum, a dimension session should exists on all the datasets. Each dataset can either be a directory of zarr arrays (the default output format of save_minian), or a single file saved by users. Each dataset should reside in its own directory.
Details on the parameters:
minian_pathpoints to the path of minian package, which by default is the current folder.dpathis the path containing all the datasets. It will be traversed recursively to search for datasets.f_patternis the directory/file name pattern of each dataset. The program will attempt to load all directories/files matchingf_patternunderdpath. Note that here our demo data arenetcdffiles that are manually saved. For the default minian dataset format (directory ofzarrarrays),f_pattern = r"minian$"should suffice.id_dimsis the name of dimensions that can uniquely identify each dataset. It should at least contain a"session"dimension.
[1]:
minian_path = "."
dpath = "./demo_data/"
f_pattern = r"minian.nc$"
id_dims = ["session"]
1.2. specify parameters¶
param_dist defines the maximal distance between cell centroids (in pixel units) on different sessions to consider them as the same cell. output_size controls the scale of visualizations.
[2]:
param_dist = 5
output_size = 100
1.3. load modules¶
[3]:
%%capture
%load_ext autoreload
%autoreload 2
import os
import sys
import warnings
import itertools as itt
import numpy as np
import xarray as xr
import holoviews as hv
import pandas as pd
from holoviews.operation.datashader import datashade, regrid
from dask.diagnostics import ProgressBar
sys.path.append(minian_path)
from minian.cross_registration import (calculate_centroids, calculate_centroid_distance, calculate_mapping,
group_by_session, resolve_mapping, fill_mapping)
from minian.motion_correction import estimate_motion, apply_transform
from minian.utilities import open_minian, open_minian_mf
from minian.visualization import AlignViewer
1.4. module initialization¶
[4]:
hv.notebook_extension('bokeh', width=100)
pbar = ProgressBar(minimum=2)
pbar.register()