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 380 forks source link

[BUG] Cellpose 3 GUI cannot load 3d stack #863

Closed MathieuVigneau closed 7 months ago

MathieuVigneau commented 7 months ago

When I try to import 3d images in the Cellpose 3 GUI, this following error appears :

raise ValueError("cannot load 3D stack, run 'python -m cellpose --Zstack' for 3D GUI")

The suggested command line doesn't work when starting the Cellpose GUI How can I importe 3d stack within Cellpose GUI ?

Mathieu

gillescourtand commented 7 months ago

I tried "cellpose --Zstack " and it raised a different error :

(cellpose) C:\Users\courtand>python -m cellpose --Zstack
2024-02-16 16:58:31,945 [INFO] WRITING LOG OUTPUT TO C:\Users\courtand\.cellpose\run.log
2024-02-16 16:58:31,945 [INFO]
cellpose version:       3.0.3
platform:               win32
python version:         3.8.13
torch version:          1.12.1+cpu
Traceback (most recent call last):
  File "C:\Anaconda\envs\cellpose\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Anaconda\envs\cellpose\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda\envs\cellpose\lib\site-packages\cellpose\__main__.py", line 257, in <module>
    main()
  File "C:\Anaconda\envs\cellpose\lib\site-packages\cellpose\__main__.py", line 54, in main
    gui3d.run()
  File "C:\Anaconda\envs\cellpose\lib\site-packages\cellpose\gui\gui3d.py", line 108, in run
    app.setPalette(guiparts_old.DarkPalette())
NameError: name 'guiparts_old' is not defined
carsen-stringer commented 7 months ago

I'm sorry, I fixed this now. But please note the 3D GUI does not yet support the denoising, it will soon

derekthirstrup commented 7 months ago

@carsen-stringer I just installed cellpose 3.0.4 and it seems to still have issues detecting the z dim of a single channel 3d tif stack. The tif reader step correctly detects the z stack as having 21 planes but it thinks this single channel tif grayscale image has more than 3 channels. So, I think the dimension order detection step is a bit off in the new version. The z stack selector also does not show up at the bottom as it does in CP2. Here is a screenshot to demo what I found.
image

MathieuVigneau commented 7 months ago

@derekthirstrup You have to launch the following command line : python -m cellpose --Zstack This should work with your stacked images

gillescourtand commented 7 months ago

ok, version 3.0.4 works for me (cellpose --Zstack), but I have to drag the image to analyze in the gui to access the z-dimension. If I open the image from menu File/Load image .., there is an error about number of channel (there is only one channel on my image). finally when I open the zstack with drag and drop and lauch a segmentation, hte processing stop at 75% with an issu


2024-02-19 08:40:23,411 [INFO] >> cyto3 << model set to be used
2024-02-19 08:40:23,573 [INFO] >>>> model diam_mean =  30.000 (ROIs rescaled to this size during training)
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': False, 'sharpen_radius': 0, 'smooth_radius': 0, 'tile_norm_blocksize': 0, 'tile_norm_smooth3D': 1, 'invert': False}
2024-02-19 08:40:23,596 [INFO] ~~~ FINDING MASKS ~~~
2024-02-19 08:40:23,596 [INFO] multi-stack tiff read in as having 14 planes 1 channels
2024-02-19 08:40:24,142 [INFO] running YX: 14 planes of size (1024, 1024)
2024-02-19 08:40:24,227 [INFO] 0%|          | 0/14 [00:00<?, ?it/s]
2024-02-19 08:40:40,576 [INFO] 7%|7         | 1/14 [00:16<03:32, 16.35s/it]
...
2024-02-19 08:44:07,748 [INFO] 100%|##########| 14/14 [03:43<00:00, 15.97s/it]
2024-02-19 08:44:08,260 [INFO] running ZY: 1024 planes of size (14, 1024)
2024-02-19 08:44:08,452 [INFO] 0%|          | 0/256 [00:00<?, ?it/s]
2024-02-19 08:44:10,421 [INFO] 0%|          | 1/256 [00:01<08:22,  1.97s/it]
...
2024-02-19 08:51:34,062 [INFO] 100%|##########| 256/256 [07:25<00:00,  1.74s/it]
2024-02-19 08:51:35,003 [INFO] running ZX: 1024 planes of size (14, 1024)
2024-02-19 08:51:35,194 [INFO] 0%|          | 0/256 [00:00<?, ?it/s]
2024-02-19 08:51:36,866 [INFO] 0%|          | 1/256 [00:01<07:06,  1.67s/it]
...
2024-02-19 08:58:52,628 [INFO] 100%|##########| 256/256 [07:17<00:00,  1.71s/it]
2024-02-19 08:58:53,367 [INFO] network run in 1109.69s
2024-02-19 08:59:30,229 [INFO] masks created in 36.86s
2024-02-19 08:59:31,393 [INFO] >>>> TOTAL TIME 1147.80 sec
Traceback (most recent call last):
  File "C:\Anaconda\envs\cellpose\lib\site-packages\cellpose\gui\guiparts.py", line 139, in <lambda>
    self.clicked.connect(lambda: self.press(parent))
  File "C:\Anaconda\envs\cellpose\lib\site-packages\cellpose\gui\guiparts.py", line 143, in press
    parent.compute_segmentation(model_name=self.model_name)
  File "C:\Anaconda\envs\cellpose\lib\site-packages\cellpose\gui\gui.py", line 2228, in compute_segmentation
    self.flows.append(resize_image(self.flows[j], Ly=self.Ly,
IndexError: list index out of range
derekthirstrup commented 7 months ago

I can now see the z slider if I open cellpose with "cellpose --Zstack" but I get the same error as gillescourtand when trying to use any model to segment a single channel z stack.

2024-02-19 08:02:08,793 [INFO] network run in 67.71s 2024-02-19 08:02:39,648 [INFO] masks created in 30.86s 2024-02-19 08:02:49,053 [INFO] >>>> TOTAL TIME 108.52 sec Traceback (most recent call last): File "C:\Users\derekt.conda\envs\cellpose3\Lib\site-packages\cellpose\gui\guiparts.py", line 139, in self.clicked.connect(lambda: self.press(parent)) ^^^^^^^^^^^^^^^^^^ File "C:\Users\derekt.conda\envs\cellpose3\Lib\site-packages\cellpose\gui\guiparts.py", line 143, in press parent.compute_segmentation(model_name=self.model_name) File "C:\Users\derekt.conda\envs\cellpose3\Lib\site-packages\cellpose\gui\gui.py", line 2228, in compute_segmentation self.flows.append(resize_image(self.flows[j], Ly=self.Ly,


IndexError: list index out of range