denisecailab / minian

miniscope analysis pipeline with interactive visualizations
GNU General Public License v3.0
91 stars 35 forks source link

corupted video during downloading #245

Open leodiej opened 1 year ago

leodiej commented 1 year ago

**Hi. I am trying to perform minian on a video from inscopix miniscope. I tried to change extension in .avi, the extension remain not supported. So, I changed it in 'tif' and the video is now playing. The problem is that there is a huge artefact in the middle. A purple stain in the middle with color really not representing the real video.

tif minian

Then I am not able to visualize the cells' activity.**

Even if I forget this problem and try to continue the pipeline. In this cell %%time seeds = seeds_init(Y_fm_chk, **param_seeds_init)

Note that in the seting parameters, I change the intpath with a folder I created by myself called minian_intermediaire minian_path = "." dpath = "./inscopix/" minian_ds_path = os.path.join(dpath, "minian") intpath = "./minian_intermediaire" subset = dict(frame=slice(0, None)) subset_mc = None interactive = True output_size = 100 n_workers = int(os.getenv("MINIAN_NWORKERS", 4)) param_save_minian = { "dpath": minian_ds_path, "meta_dict": dict(session=-1, animal=-2), "overwrite": True, }

Pre-processing Parameters

param_load_videos = { "pattern": "video_conversion.tif", "dtype": np.uint8, "downsample": dict(frame=1, height=1, width=1), "downsample_strategy": "subset", } param_denoise = {"method": "median", "ksize": 7} param_background_removal = {"method": "tophat", "wnd": 15}

Motion Correction Parameters

subset_mc = None param_estimate_motion = {"dim": "frame"}

Initialization Parameters

param_seeds_init = { "wnd_size": 1000, "method": "rolling", "stp_size": 500, "max_wnd": 15, "diff_thres": 3, } param_pnr_refine = {"noise_freq": 0.06, "thres": 1} param_ks_refine = {"sig": 0.05} param_seeds_merge = {"thres_dist": 10, "thres_corr": 0.8, "noise_freq": 0.06} param_initialize = {"thres_corr": 0.8, "wnd": 10, "noise_freq": 0.06} param_init_merge = {"thres_corr": 0.8}

CNMF Parameters

param_get_noise = {"noise_range": (0.06, 0.5)} param_first_spatial = { "dl_wnd": 10, "sparse_penal": 0.01, "size_thres": (25, None), } param_first_temporal = { "noise_freq": 0.06, "sparse_penal": 1, "p": 1, "add_lag": 20, "jac_thres": 0.2, } param_first_merge = {"thres_corr": 0.8} param_second_spatial = { "dl_wnd": 10, "sparse_penal": 0.01, "size_thres": (25, None), } param_second_temporal = { "noise_freq": 0.06, "sparse_penal": 1, "p": 1, "add_lag": 20, "jac_thres": 0.4, }

os.environ["OMP_NUM_THREADS"] = "1" os.environ["MKL_NUM_THREADS"] = "1" os.environ["OPENBLAS_NUM_THREADS"] = "1" os.environ['MINIAN_INTERMEDIAIRE'] = intpath I get

KeyError Traceback (most recent call last) File :1

File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\minian\initialization.py:82, in seeds_init(varr, wnd_size, method, stp_size, nchunk, max_wnd, diff_thres) 26 def seeds_init( 27 varr: xr.DataArray, 28 wnd_size=500, (...) 33 diff_thres=2, 34 ): 35 """ 36 Generate over-complete set of seeds by finding local maxima across frames. 37 (...) 80 maxima. 81 """ ---> 82 int_path = os.environ["MINIAN_INTERMEDIATE"] 83 print("constructing chunks") 84 idx_fm = varr.coords["frame"]

File C:\ProgramData\Anaconda3\envs\minian2\lib\os.py:675, in _Environ.getitem(self, key) 672 value = self._data[self.encodekey(key)] 673 except KeyError: 674 # raise KeyError with the original key value --> 675 raise KeyError(key) from None 676 return self.decodevalue(value)

KeyError: 'MINIAN_INTERMEDIATE'

leodiej commented 1 year ago

Another question is: Is it possible to run and visualize only a small part of the video in minian? Like telling the code "I only want the two firsts minutes" Thank you

leodiej commented 1 year ago

What I don't understand about the first issue is that my video and the demo are realy alike. So I don't understand why fluorescence is localised diffrently