omnipose
omnipose copied to clipboard
Omnipose not working on stacks
Hello,
As the title says, I am having trouble with stacks. As a test I put 5 copies of the e1t1_crop.tif test image into a stack and ran omnipose with
python -m omnipose --dir D:\[location of folder] --save_tif --dir_above --no_npy --in_folders --omni --pretrained_model bact_phase_omni --cluster --mask_threshold 1 --flow_threshold 0 --diameter 30
but I got the following error:
C:\Users\murrays.TER\AppData\Local\anaconda3\envs\omnipose\lib\site-packages\superqt\collapsible_collapsible.py:4: PythonQtWarning: Selected binding 'pyqt5' could not be found; falling back to 'pyqt6'
from qtpy.QtCore import (
!NEW LOGGING SETUP! To see cellpose progress, set --verbose
No --verbose => no progress or info printed
2023-10-26 16:51:56,582 [INFO] >>>> using CPU
2023-10-26 16:51:56,582 [INFO] This model uses boundary field, setting nclasses=3.
2023-10-26 16:51:56,582 [INFO] running omnipose on 1 image(s) using 2 channel(s).
2023-10-26 16:51:56,582 [INFO] channel(s) to seg: MONO and NONE
2023-10-26 16:51:56,582 [INFO] omni is ON, cluster is True
2023-10-26 16:51:56,708 [INFO] using diameter 30.00 for all images
2023-10-26 16:51:56,708 [INFO] 0%| | 0/1 [00:00<?, ?it/s]
2023-10-26 16:51:56,708 [INFO]
2023-10-26 16:51:56,708 [INFO] 0%| | 0/5 [00:00<?, ?it/s]
2023-10-26 16:52:00,186 [INFO]
2023-10-26 16:52:00,186 [INFO] 20%|## | 1/5 [00:03<00:13, 3.48s/it]
2023-10-26 16:52:03,400 [INFO]
2023-10-26 16:52:03,400 [INFO] 40%|#### | 2/5 [00:06<00:09, 3.32s/it]
2023-10-26 16:52:06,687 [INFO]
2023-10-26 16:52:06,687 [INFO] 60%|###### | 3/5 [00:09<00:06, 3.31s/it]
2023-10-26 16:52:09,863 [INFO]
2023-10-26 16:52:09,863 [INFO] 80%|######## | 4/5 [00:13<00:03, 3.25s/it]
2023-10-26 16:52:13,257 [INFO]
2023-10-26 16:52:13,257 [INFO] 100%|##########| 5/5 [00:16<00:00, 3.31s/it]
2023-10-26 16:52:13,263 [INFO] 100%|##########| 5/5 [00:16<00:00, 3.31s/it]
2023-10-26 16:52:13,267 [INFO] 0%| | 0/1 [00:16<?, ?it/s]
Traceback (most recent call last):
File "C:\Users\murrays.TER\AppData\Local\anaconda3\envs\omnipose\lib\runpy.py", line 196, in run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\murrays.TER\AppData\Local\anaconda3\envs\omnipose\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\murrays.TER\AppData\Local\anaconda3\envs\omnipose\lib\site-packages\omnipose_main.py", line 12, in
It looks like something is going wrong with the path. The location in the last line of the error is not where the masks are supposed to go. That colon is obviously not right.
Everything works fine when acting on a single image and adding --z_axis 2 doesn't change anything.
If I use the gui, the stack dimensions are not determined correctly and it analyses 384 planes of size (392,1).
So I fixed it by
changing the these lines in io.py -- 138 tifffile.imsave(filename, arr) ++138 tifffile.imsave(filename, arr,append=True)
--497 for image, mask, flow, file_name in zip(images, masks, flows, file_names): --498 save_masks(image, mask, flow, file_name, png=png, tif=tif, suffix=suffix, dir_above=dir_above, ++497 for image, mask, flow in zip(images, masks, flows): ++498 save_masks(image, mask, flow, file_names, png=png, tif=tif, suffix=suffix, dir_above=dir_above,
I haven't made a pull request because I am still figuring out how python and omnipose work (new to both!) Maybe someone can review it first.
@smury Sorry for the extreme delay, was inundated with wrapping up my PhD program. Those changes make sense to me.