Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error loading new video #241

Open
leodiej opened this issue May 3, 2023 · 9 comments
Open

error loading new video #241

leodiej opened this issue May 3, 2023 · 9 comments

Comments

@leodiej
Copy link

leodiej commented May 3, 2023

Hello,
I am trying to perform the code with a tiff video. The file's name is "video conversion .tiff". Here is the code I ran and the error I get.

Set up Initial Basic Parameters#

minian_path = "."
dpath = "./inscopix_video/"
minian_ds_path = os.path.join(dpath, "minian")
intpath = "./fichier_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[0].tiff",
"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["fichier_intermediaire"] = intpath

The error is coming after this cell:

varr = load_videos(dpath, **param_load_videos)
chk, _ = get_optimal_chk(varr, dtype=float)

FileNotFoundError Traceback (most recent call last)
Cell In[15], line 1
----> 1 varr = load_videos(dpath, **param_load_videos)
2 chk, _ = get_optimal_chk(varr, dtype=float)

File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\minian\utilities.py:104, in load_videos(vpath, pattern, dtype, downsample, downsample_strategy, post_process)
100 vlist = natsorted(
101 [vpath + os.sep + v for v in os.listdir(vpath) if re.search(pattern, v)]
102 )
103 if not vlist:
--> 104 raise FileNotFoundError(
105 "No data with pattern {}"
106 " found in the specified folder {}".format(pattern, vpath)
107 )
108 print("loading {} videos in folder {}".format(len(vlist), vpath))
110 file_extension = os.path.splitext(vlist[0])[1]

FileNotFoundError: No data with pattern video conversion[0].tiff found in the specified folder C:\WINDOWS\system32\inscopix_video

@leodiej
Copy link
Author

leodiej commented May 3, 2023

Maybe the video is too heavy? What is the maximum input video size that minian can support?

@wmau
Copy link
Collaborator

wmau commented May 3, 2023 via email

@leodiej
Copy link
Author

leodiej commented May 3, 2023

I changed it and I got an error too. If I limit the number of slices and put in line 5 :
subset = dict(frame=slice(0, 499)) for example, would it work? I am thinking maybe the video is too heavy. It's a 35GB video.

@wmau
Copy link
Collaborator

wmau commented May 3, 2023 via email

@leodiej
Copy link
Author

leodiej commented May 3, 2023

ValueError Traceback (most recent call last)
Cell In[7], line 1
----> 1 varr = load_videos(dpath, **param_load_videos)
2 chk, _ = get_optimal_chk(varr, dtype=float)

File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\minian\utilities.py:116, in load_videos(vpath, pattern, dtype, downsample, downsample_strategy, post_process)
114 movie_load_func = load_tif_lazy
115 else:
--> 116 raise ValueError("Extension not supported.")
118 varr_list = [movie_load_func(v) for v in vlist]
119 varr = darr.concatenate(varr_list, axis=0)

ValueError: Extension not supported.

@wmau
Copy link
Collaborator

wmau commented May 3, 2023 via email

@wmau
Copy link
Collaborator

wmau commented May 3, 2023 via email

@leodiej
Copy link
Author

leodiej commented May 4, 2023

I renamed the file extension to .tif and apriori it works. Thank you for your help.

@leodiej
Copy link
Author

leodiej commented May 12, 2023

Hi.
I have get a problem with the video displaying. Then I tried to load an other one and still, "The extension is not suppported".

Set up Initial Basic Parameters#

minian_path = "."
dpath = "./inscopix/"
minian_ds_path = os.path.join(dpath, "minian2")
intpath = "./minian_intpath"
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": "2021-08-10-13-39-53_video_trig_0.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_INTPATH"] = intpath

varr = load_videos(dpath, **param_load_videos)
chk, _ = get_optimal_chk(varr, dtype=float)

KeyError Traceback (most recent call last)
File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\tifffile\tifffile.py:3142, in TiffFile.init(self, arg, mode, name, offset, size, _multifile, _useframes, _parent, **kwargs)
3141 try:
-> 3142 byteorder = {b'II': '<', b'MM': '>', b'EP': '<'}[header[:2]]
3143 except KeyError:

KeyError: b'\xa0\x00'

During handling of the above exception, another exception occurred:

TiffFileError Traceback (most recent call last)
Cell In[7], line 1
----> 1 varr = load_videos(dpath, **param_load_videos)
2 chk, _ = get_optimal_chk(varr, dtype=float)

File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\minian\utilities.py:118, in load_videos(vpath, pattern, dtype, downsample, downsample_strategy, post_process)
115 else:
116 raise ValueError("Extension not supported.")
--> 118 varr_list = [movie_load_func(v) for v in vlist]
119 varr = darr.concatenate(varr_list, axis=0)
120 varr = xr.DataArray(
121 varr,
122 dims=["frame", "height", "width"],
(...)
127 ),
128 )

File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\minian\utilities.py:118, in (.0)
115 else:
116 raise ValueError("Extension not supported.")
--> 118 varr_list = [movie_load_func(v) for v in vlist]
119 varr = darr.concatenate(varr_list, axis=0)
120 varr = xr.DataArray(
121 varr,
122 dims=["frame", "height", "width"],
(...)
127 ),
128 )

File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\minian\utilities.py:161, in load_tif_lazy(fname)
147 def load_tif_lazy(fname: str) -> darr.array:
148 """
149 Lazy load a tif stack of images.
150
(...)
159 Resulting dask array representation of the tif stack.
160 """
--> 161 data = TiffFile(fname)
162 f = len(data.pages)
164 fmread = da.delayed(load_tif_perframe)

File C:\ProgramData\Anaconda3\envs\minian2\lib\site-packages\tifffile\tifffile.py:3144, in TiffFile.init(self, arg, mode, name, offset, size, _multifile, _useframes, _parent, **kwargs)
3142 byteorder = {b'II': '<', b'MM': '>', b'EP': '<'}[header[:2]]
3143 except KeyError:
-> 3144 raise TiffFileError(f'not a TIFF file {header!r}')
3146 version = struct.unpack(byteorder + 'H', header[2:4])[0]
3147 if version == 43:
3148 # BigTiff

TiffFileError: not a TIFF file b'\xa0\x00\xa0\n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants