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

Script for cellprofiler/omero on 3D images with multi channel #293

Open
melithionine opened this issue Jun 19, 2024 · 4 comments
Open

Script for cellprofiler/omero on 3D images with multi channel #293

melithionine opened this issue Jun 19, 2024 · 4 comments

Comments

@melithionine
Copy link

Hello, I tried to use the script to analyse figures on omero with cellprofiler using the pythonAPI. However, it is written that the pipleine accept only images with 2 channels, but my images have 4. Do you know if there is a possibility to use my cellprofiler pipeline on omero even if my images have more than 2 chanels ? When i use my pipeline normally (on cellprofiler directly) it works well i just need to separate the chanels (and my images are in 3D). How can i modifiy the script to do it ?

@will-moore
Copy link
Member

If your cellprofiler pipeline works with multiple channels then it's certainly possible to load them from OMERO.
If it only works with 2 channels and your images have 4, you could still just pick 2 of the 4 channels and load them.

Are you referring to the walkthrough at https://omero-guides.readthedocs.io/en/latest/cellprofiler/docs/gettingstarted.html and the script at
https://github.com/ome/omero-guide-cellprofiler/blob/248e8cbfb0372b3d3be2d82cfe9234dd2e25c140/scripts/idr0002_save.py

The iterates through all the image channels at for c in range(0, size_c):
but only expects 2 channels.

@melithionine
Copy link
Author

Actually, my pipeline don't really work for multichanel, i have to first separate the chanels and run the pipeline. I thought that this script kind of separate the chanels so we can run the pipeline.
I already change this line (for c in range(0, size_c)) in the code but i still have this message error:
IF304_FE22386
pipeline_exception
ERROR:root:Error detected during run of module Watershed
Traceback (most recent call last):
File "/Users/melissamenga/miniconda/envs/omero_menga/lib/python3.8/site-packages/cellprofiler_core/pipeline/_pipeline.py", line 1016, in run_with_yield
self.run_module(module, workspace)
File "/Users/melissamenga/miniconda/envs/omero_menga/lib/python3.8/site-packages/cellprofiler_core/pipeline/_pipeline.py", line 1349, in run_module
module.run(workspace)
File "/Users/melissamenga/miniconda/envs/omero_menga/lib/python3.8/site-packages/cellprofiler/modules/watershed.py", line 500, in run
raise ValueError("Structuring element does not match object dimensions: "
ValueError: Structuring element does not match object dimensions: 3 != 2

(My image are multi chanel (4 generally) and with z-stack, and my pipeline take as input the 4 chanels separatly and segment the nuceli)

@will-moore
Copy link
Member

I'm not familiar with Cellprofiler so I don't know what that error means, but I'm guessing the dimension it's referring to is Channels. It looks like it's expecting 3 channels and you're giving it 2 channels (or vice versa)?

I even tried looking for that line in the cellprofiler code at https://github.com/CellProfiler/CellProfiler/blob/611ab2abd59b80230889d9f56fcc1954fb13d3d4/src/frontend/cellprofiler/modules/watershed.py#L4 but I don't see it (probably different version)?

@pwalczysko
Copy link
Member

(probably different version)?

I think it should be the CellProfiler version as per https://github.com/ome/EMBL-EBI-imaging-course-04-2024/blob/5c66178df5af1d6779e9665438ed580ad12765ef/Day_4/environment_cp.yml#L25.

Also, try to have the script as per notebook in https://github.com/ome/EMBL-EBI-imaging-course-04-2024/blob/main/Day_4/Cellprofiler.ipynb - sorry, but as you can see, the notebooks in https://github.com/ome/EMBL-EBI-imaging-course-04-2024 are more up-to-date (as you can see on the CP version for example, as the https://github.com/ome/EMBL-EBI-imaging-course-04-2024/blob/5c66178df5af1d6779e9665438ed580ad12765ef/Day_4/environment_cp.yml#L25 is the correct one.
Then I would recommend to set the environment up as per https://github.com/ome/EMBL-EBI-imaging-course-04-2024/blob/main/Day_4/setup.md - then, if successful, start incrementally making changes to that Jupyter notebook https://github.com/ome/EMBL-EBI-imaging-course-04-2024/blob/main/Day_4/Cellprofiler.ipynb so that you can insert your pipeline. In order to be able to help you, you will have to show us your pipeline, your script or Jupyter notebook and point to the exact line which is erroring.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants