MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.32k stars 378 forks source link

Error exporting ROIs as .zip archive for Fiji after segmentation #969

Closed ccp77 closed 6 days ago

ccp77 commented 2 months ago

Describe the bug Hi, I have been using cellpose gui to segment cells using ctyo3 to export these to Fiji for further analyses. I usually load an image of one channel using the gui and then adjust the diameter for segmentation and press cyto3. The ROIs that I obtain look good so I would like to export to Fiji. This was running fine on some cropped images that I used to test the method. However, on another set of images I am able to generate the ROIs in the cellpose gui, however when I try to save the outlines as .zip archive of ROI files for fiji, I get the following error on the terminal:

GUI_INFO: saving 647 ImageJ ROIs to .zip archive.
Traceback (most recent call last):
  File "/opt/anaconda3/envs/cellpose/lib/python3.8/site-packages/cellpose/gui/menus.py", line 62, in <lambda>
    parent.saveROIs.triggered.connect(lambda: io._save_rois(parent))
  File "/opt/anaconda3/envs/cellpose/lib/python3.8/site-packages/cellpose/gui/io.py", line 589, in _save_rois
    save_rois(parent.cellpix[0], parent.filename)
  File "/opt/anaconda3/envs/cellpose/lib/python3.8/site-packages/cellpose/io.py", line 585, in save_rois
    rois = [ImagejRoi.frompoints(outline) for outline in outlines]
  File "/opt/anaconda3/envs/cellpose/lib/python3.8/site-packages/cellpose/io.py", line 585, in <listcomp>
    rois = [ImagejRoi.frompoints(outline) for outline in outlines]
  File "/opt/anaconda3/envs/cellpose/lib/python3.8/site-packages/roifile/roifile.py", line 455, in frompoints
    left_top = coords.min(axis=0)
  File "/opt/anaconda3/envs/cellpose/lib/python3.8/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
qt.pointer.dispatch: skipping QEventPoint(id=2 ts=0 pos=0,0 scn=620.789,683.267 gbl=620.789,683.267 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-620.789,-683.267 last=-620.789,-683.267 Δ 620.789,683.267) : no target window
qt.pointer.dispatch: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=1158,331.494 gbl=1158,331.494 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-1158,-331.494 last=-1158,-331.494 Δ 1158,331.494) : no target window
qt.pointer.dispatch: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=1013.12,687.285 gbl=1013.12,687.285 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-1013.12,-687.285 last=-1013.12,-687.285 Δ 1013.12,687.285) : no target window
qt.pointer.dispatch: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=805.062,712.905 gbl=805.062,712.905 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-805.062,-712.905 last=-805.062,-712.905 Δ 805.062,712.905) : no target window

I have seen possibly related bugs reported (example issue #708), but I dont know how to solve it.

Thank you very much in advance !

bobonannan commented 1 week ago

I have same question in windows ,I can,t save ROI

carsen-stringer commented 6 days ago

can you please try the latest version pip install git+https://github.com/mouseland/cellpose.git

if this doesn't work I will reopen the issue