Skip to content

Commit 81125d0

Browse files
add 2.3.2 docker to RunCellPose(#259)
* add 2.3.2 docker - allows selection of Cellpose 2.2.0 or Cellpose 2.3.2 * bumped Dockerfile --------- Co-authored-by: bethac07 <bcimini@broadinstitute.org>
1 parent 35ab27c commit 81125d0

2 files changed

Lines changed: 21 additions & 18 deletions

File tree

active_plugins/runcellpose.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@
5858
and the mask reconstruction algorithm for Omnipose that was created to solve over-segemnation of large cells; useful for bacterial cells,
5959
but can be used for other arbitrary and anisotropic shapes. You can mix and match Omnipose models with Cellpose style masking or vice versa.
6060
61-
The module has been updated to be compatible with the latest release of Cellpose. From the old version of the module the 'cells' model corresponds to 'cyto2' model.
61+
The module is compatible with Cellpose 1.0.2 >= 2.3.2. From the old version of the module the 'cells' model corresponds to 'cyto2' model.
6262
63-
Installation:
63+
You can run this module using Cellpose installed to the same Python environment as CellProfiler. Alternatively, you can
64+
run this module using Cellpose in a Docker that the module will automatically download for you so you do not have to perform
65+
any installation yourself.
6466
65-
It is necessary that you have installed Cellpose version >= 1.0.2
66-
67-
You'll want to run `pip install cellpose` on your CellProfiler Python environment to setup Cellpose. If you have an older version of Cellpose
68-
run 'python -m pip install cellpose --upgrade'.
67+
To install Cellpose in your Python environment:
68+
You'll want to run `pip install cellpose==2.3.2` on your CellProfiler Python environment to setup Cellpose. If you have an older version of Cellpose
69+
run 'python -m pip install --force-reinstall -v cellpose==2.3.2'.
6970
7071
To use Omnipose models, and mask reconstruction method you'll want to install Omnipose 'pip install omnipose' and Cellpose version 1.0.2 'pip install cellpose==1.0.2'.
7172
@@ -84,8 +85,10 @@
8485
"""
8586

8687
"Select Cellpose Docker Image"
87-
CELLPOSE_DOCKER_NO_PRETRAINED = "cellprofiler/runcellpose_no_pretrained:0.1"
88-
CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED = "cellprofiler/runcellpose_with_pretrained:0.1"
88+
CELLPOSE_DOCKER_NO_PRETRAINED_v232 = "cellprofiler/runcellpose_no_pretrained:2.3.2"
89+
CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v232 = "cellprofiler/runcellpose_with_pretrained:2.3.2"
90+
CELLPOSE_DOCKER_NO_PRETRAINED_v220 = "cellprofiler/runcellpose_no_pretrained:2.2"
91+
CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v220 = "cellprofiler/runcellpose_with_pretrained:2.2"
8992

9093
"Detection mode"
9194
MODEL_NAMES = ['cyto','nuclei','tissuenet','livecell', 'cyto2', 'general',
@@ -134,19 +137,19 @@ def create_settings(self):
134137

135138
self.docker_image = Choice(
136139
text="Select Cellpose docker image",
137-
choices=[CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED, CELLPOSE_DOCKER_NO_PRETRAINED],
138-
value=CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED,
140+
choices=[CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v220, CELLPOSE_DOCKER_NO_PRETRAINED_v220,CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v232, CELLPOSE_DOCKER_NO_PRETRAINED_v232],
141+
value=CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v232,
139142
doc="""\
140143
Select which Docker image to use for running Cellpose.
141144
142145
If you are not using a custom model, you can select
143-
**"{CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED}"**. If you are using a custom model,
144-
you can use either **"{CELLPOSE_DOCKER_NO_PRETRAINED}"** or
145-
**"{CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED}"**, but the latter will be slightly
146-
larger (~500 MB) due to including all of the pretrained models.
146+
**"{CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v232}"** or "{CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v220}"**. If you are using a custom model,
147+
you can use any of the available Dockers, but those with pretrained models will be slightly larger (~500 MB).
147148
""".format(
148-
**{"CELLPOSE_DOCKER_NO_PRETRAINED": CELLPOSE_DOCKER_NO_PRETRAINED,
149-
"CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED": CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED}
149+
**{"CELLPOSE_DOCKER_NO_PRETRAINED_v220": CELLPOSE_DOCKER_NO_PRETRAINED_v220,
150+
"CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v220": CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v220,
151+
"CELLPOSE_DOCKER_NO_PRETRAINED_v232": CELLPOSE_DOCKER_NO_PRETRAINED_v232,
152+
"CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v232": CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v232}
150153
),
151154
)
152155

@@ -738,7 +741,7 @@ def upgrade_settings(self, setting_values, variable_revision_number, module_name
738741
setting_values = setting_values + ["0.0", False, "15", "1.0", False, False]
739742
variable_revision_number = 3
740743
if variable_revision_number == 3:
741-
setting_values = [setting_values[0]] + ["Python",CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED] + setting_values[1:]
744+
setting_values = [setting_values[0]] + ["Python",CELLPOSE_DOCKER_IMAGE_WITH_PRETRAINED_v232] + setting_values[1:]
742745
variable_revision_number = 4
743746
if variable_revision_number == 4:
744747
setting_values = [setting_values[0]] + ['No'] + setting_values[1:]

dockerfiles/RunCellpose/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM pytorch/pytorch:1.13.0-cuda11.6-cudnn8-runtime
22

3-
RUN pip install cellpose==2.2
3+
RUN pip install numpy==1.26.4 cellpose==2.3.2
44

55
# Include if you wish the image to contain Cellpose pretrained models
66
COPY download_cellpose_models.py /

0 commit comments

Comments
 (0)