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

ValueError: sero-size array to reduction operation minimum which has no identity [BUG] #789

Closed
LeireIglesiasC opened this issue Sep 27, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@LeireIglesiasC
Copy link

Hi,

Recently I encountered an error while saving .zip files of the ROIs segmented for an image in cellpose 2.2.3.

The images (spheroid-like cells) are saved as .TIFF. To segment them, they are individually dragged into the GUI, then you adjust the cell diameter and click on the "cyto" model zoo to segment. The segmentation part works since the masks appear over the cells. There are usually also some masks to correct, so, after editing (deleting and drawing spheres), the final masks are saved as: file > save outlines as .zip archive of ROI files for ImageJ (or Ctr + R). This process works usually very nicely (a bit slow sometimes), but it saves properly the .zip file in the file location of your original image.

However, today I encountered a problem in some images since the .zip file with the ROIs does not save. This error occurs both, when you click save directly after mask obtention with no ROI editing (see code below), and also when saving after ROI editing. I am not very sure when exactly this error occurs, because with some images it saves properly without an error, and then with other images it gives the error. Also, sometimes with the same image it seems to work and if you try again it does not.

This is the error shown:
`(base) C:\Users\ruberni>conda activate cellpose

(cellpose) C:\Users\ruberni>python -m cellpose
2023-09-27 15:45:38,478 [INFO] WRITING LOG OUTPUT TO C:\Users\ruberni.cellpose\run.log
2023-09-27 15:45:38,483 [INFO]
cellpose version: 2.2.3
platform: win32
python version: 3.8.17
torch version: 2.0.1+cpu
2023-09-27 15:45:38,816 [INFO] TORCH CUDA version not installed/working.
GUI_INFO: loading image: L:/Labs/Niels Ruber/Montages (18-06-23)/1. Organised folders - analysis/151/151-DIV7-Pl2-H1/2305151-151-004-NR-P0-DIV7-Pl2-H1_B03_B03_w1.tif
(2764, 2764, 4)
GUI_INFO: auto-adjust enabled, computing saturation levels
2023-09-27 15:46:09,857 [INFO] >>>> using CPU
2023-09-27 15:46:09,857 [INFO] >> cyto << model set to be used
2023-09-27 15:46:09,967 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training)
2023-09-27 15:46:09,983 [INFO] ~~~ FINDING MASKS ~~~
2023-09-27 15:48:57,758 [INFO] >>>> TOTAL TIME 167.77 sec
2023-09-27 15:48:58,017 [INFO] 236 cells found with model in 168.176 sec
GUI_INFO: 236 masks found
GUI_INFO: creating cellcolors and drawing masks
GUI_INFO: saving 236 ImageJ ROIs to .zip archive.
Traceback (most recent call last):
File "C:\Users\ruberni\Anaconda3\envs\cellpose\lib\site-packages\cellpose\gui\menus.py", line 59, in
parent.saveROIs.triggered.connect(lambda: io._save_rois(parent))
File "C:\Users\ruberni\Anaconda3\envs\cellpose\lib\site-packages\cellpose\gui\io.py", line 465, in _save_rois
save_rois(parent.cellpix[0], parent.filename)
File "C:\Users\ruberni\Anaconda3\envs\cellpose\lib\site-packages\cellpose\io.py", line 404, in save_rois
rois = [ImagejRoi.frompoints(outline) for outline in outlines]
File "C:\Users\ruberni\Anaconda3\envs\cellpose\lib\site-packages\cellpose\io.py", line 404, in
rois = [ImagejRoi.frompoints(outline) for outline in outlines]
File "C:\Users\ruberni\Anaconda3\envs\cellpose\lib\site-packages\roifile\roifile.py", line 455, in frompoints
left_top = coords.min(axis=0)
File "C:\Users\ruberni\Anaconda3\envs\cellpose\lib\site-packages\numpy\core_methods.py", line 45, in _amin
return umr_minimum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation minimum which has no identity`

In this example, the masks were saved directly after segmentation (no editing), but the error also occurred in the same image after editing.

Would someone know what the issue would be here? it seems to work sometimes and sometimes not, but I am not very familiar with the origin of the error.

Thank you very much.

Kind regards,
Leire

@LeireIglesiasC LeireIglesiasC added the bug Something isn't working label Sep 27, 2023
@mrariden mrariden self-assigned this Sep 28, 2023
@francodgstn
Copy link
Contributor

This issue seems to be related to #708

@carsen-stringer
Copy link
Member

thanks @francodgstn !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants