MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
360 stars 244 forks source link

BUG: Cannot load suite2p image into suite2p UI. Divide by 0 error #1140

Open arielleleon opened 3 months ago

arielleleon commented 3 months ago

Describe the issue:

We use suite2p to run segmentation on our motion corrected files. We set the arguments to run cellpose segmentation in suite2p as follows:

{'1Preg': False,
 'align_by_chan': 1,
 'allow_overlap': False,
 'anatomical_only': 2,
 'aspect': 1.0,
 'baseline': 'maximin',
 'batch_size': 500,
 'bidi_corrected': False,
 'bidiphase': 0,
 'bin_duration': 3.7,
 'block_size': [128, 128],
 'bruker': False,
 'bruker_bidirectional': False,
 'cellprob_threshold': 0.0,
 'chan2_thres': 0.65,
 'classifier_path': 0,
 'combined': True,
 'connected': True,
 'data_path': [],
 'delete_bin': False,
 'denoise': True,
 'diameter': 0,
 'do_bidiphase': False,
 'do_registration': 0,
 'fast_disk': [],
 'flow_threshold': 1.5,
 'force_refImg': False,
 'force_sktiff': False,
 'frames_include': -1,
 'fs': 9.48,
 'functional_chan': 1,
 'h5py': '/data/VISp_0/decrosstalk/VISp_0_decrosstalk.h5',
 'h5py_key': 'data',
 'high_pass': 100,
 'ignore_flyback': [],
 'inner_neuropil_radius': 2,
 'keep_movie_raw': False,
 'lam_percentile': 50.0,
 'look_one_level_down': False,
 'max_iterations': 20,
 'max_overlap': 0.75,
 'maxregshift': 0.1,
 'maxregshiftNR': 5,
 'mesoscan': False,
 'min_neuropil_pixels': 350,
 'move_bin': False,
 'multiplane_parallel': False,
 'nbinned': 97,
 'nchannels': 1,
 'neucoeff': 0.7,
 'neuropil_extract': True,
 'nimg_init': 300,
 'nonrigid': True,
 'norm_frames': True,
 'nplanes': 1,
 'nwb_driver': '',
 'nwb_file': '',
 'nwb_series': '',
 'pad_fft': False,
 'prctile_baseline': 8.0,
 'pre_smooth': 0,
 'preclassify': 0.0,
 'pretrained_model': 'cyto',
 'reg_tif': False,
 'reg_tif_chan2': False,
 'roidetect': True,
 'save_NWB': False,
 'save_folder': [],
 'save_mat': False,
 'save_path0': '/results/VISp_0/segmentation',
 'sig_baseline': 10.0,
 'smooth_sigma': 1.15,
 'smooth_sigma_time': 0,
 'snr_thresh': 1.2,
 'soma_crop': True,
 'sparse_mode': True,
 'spatial_hp': 42,
 'spatial_hp_cp': 0,
 'spatial_hp_detect': 25,
 'spatial_hp_reg': 42,
 'spatial_scale': 0,
 'spatial_taper': 40,
 'spikedetect': False,
 'subfolders': [],
 'subpixel': 10,
 'suite2p_version': '0.10.2',
 'tau': 1.0,
 'th_badframes': 1.0,
 'threshold_scaling': 1.0,
 'two_step_registration': False,
 'use_builtin_classifier': False,
 'win_baseline': 60.0}

The weighted masks ops.npy file output contains a value of zero for the diameter. When loading this file into the suite2p UI, a divide by zero error is raised (see below)

Reproduce the code example:

n/a: Using UI

Error message:

Traceback (most recent call last):
File "C:\Users\jinho.kim\Anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\gui2p.py", line 135, in dropEvent
io.load_proc(self)
File "C:\Users\jinho.kim\Anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\io.py", line 308, in load_proc
load_to_GUI(parent, basename, output)
File "C:\Users\jinho.kim\Anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\io.py", line 334, in load_to_GUI
make_masks_and_enable_buttons(parent)
File "C:\Users\jinho.kim\Anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\io.py", line 94, in make_masks_and_enable_buttons
parent.xyrat = parent.ops["diameter"][0] / parent.ops["diameter"][1]
ZeroDivisionError: division by zero

Version information:

v0.10.2 (suite2p processing) 0.11.2.dev51+g8f1a088 (suite2p GUI)

Context for the issue:

No response