Skip to content

Commit

Permalink
Cellprofiler app + plugin (Project-MONAI#1724)
Browse files Browse the repository at this point in the history
* first version of cellprofiler plugin

Signed-off-by: binliu <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add vista support

Signed-off-by: binliu <[email protected]>

* fix some issues

Signed-off-by: binliu <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update the plugin part

Signed-off-by: binliu <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix format

Signed-off-by: binliu <[email protected]>

* fix plugin doc

Signed-off-by: binliu <[email protected]>

* remove redundant imports

Signed-off-by: binliu <[email protected]>

* add the test case

Signed-off-by: Bin Liu (SW-GPU) <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add mock test

Signed-off-by: binliu <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add unit test

Signed-off-by: Bin Liu (SW-GPU) <[email protected]>

* add readme for cellprofiler plugin

Signed-off-by: binliu <[email protected]>

* add the cellprofiler image

Signed-off-by: binliu <[email protected]>

* update readme file

Signed-off-by: binliu <[email protected]>

* remove the unnecessary file

Signed-off-by: binliu <[email protected]>

* fix import

Signed-off-by: binliu <[email protected]>

* add return

Signed-off-by: binliu <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update vista app readme

Signed-off-by: binliu <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* rename the vista app to vista2d app

Signed-off-by: binliu <[email protected]>

* fix vista to vista2d

Signed-off-by: binliu <[email protected]>

* fix the bundle name from cell_vista_segmentation to vista2d

Signed-off-by: binliu <[email protected]>

* add vista2d model

Signed-off-by: binliu <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix readme issue

Signed-off-by: binliu <[email protected]>

---------

Signed-off-by: binliu <[email protected]>
Signed-off-by: Bin Liu (SW-GPU) <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bin Liu (SW-GPU) <[email protected]>
  • Loading branch information
3 people authored Aug 30, 2024
1 parent 364c693 commit 6b7d315
Show file tree
Hide file tree
Showing 17 changed files with 1,335 additions and 3 deletions.
Binary file added docs/images/cellprofiler.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/cellprofiler_plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions monailabel/tasks/infer/basic_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,10 @@ def _get_network(self, device, data):
if path:
checkpoint = torch.load(path, map_location=torch.device(device))
model_state_dict = checkpoint.get(self.model_state_dict, checkpoint)

if set(self.network.state_dict().keys()) != set(checkpoint.keys()):
if set(self.network.state_dict().keys()) != set(model_state_dict.keys()):
logger.warning(
f"Checkpoint keys don't match network.state_dict()! Items that exist in only one dict"
f" but not in the other: {set(self.network.state_dict().keys()) ^ set(checkpoint.keys())}"
f" but not in the other: {set(self.network.state_dict().keys()) ^ set(model_state_dict.keys())}"
)
logger.warning(
"The run will now continue unless load_strict is set to True. "
Expand Down
1 change: 1 addition & 0 deletions monailabel/utils/others/modelzoo_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
"wholeBrainSeg_Large_UNEST_segmentation", # whole brain segmentation for T1 MRI brain images. Added Oct 2022
"lung_nodule_ct_detection", # The first lung nodule detection task can be used for MONAI Label. Added Dec 2022
"wholeBody_ct_segmentation", # The SegResNet trained TotalSegmentator dataset with 104 tissues. Added Feb 2023
"vista2d", # The VISTA segmentation trained on a collection of 15K public microscopy images. Added Aug 2024
]
51 changes: 51 additions & 0 deletions plugins/cellprofiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
Copyright (c) MONAI Consortium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# MONAI Label Plugin for CellProfiler
CellProfiler is a free open-source software designed to enable biologists without training in computer vision or programming to quantitatively measure phenotypes from thousands of images automatically.

CellProfiler is designed to serve biologists as well as bioimage analysts who want a flexible system that is easy to deploy to collaborators who lack computational skills. It is commonly used for small-scale experiments involving a few images but is also routinely run on millions of images using cluster or cloud computing resources at some of the largest pharmaceutical companies and academic screening centers in the world.

<img src="../../docs/images/cellprofiler.jpg" width=70% />

### Table of Contents
- [Supported Applications](#supported-applications)
- [Installing CellProfiler](#installing-cellprofiler)
- [Install MONAI Label Extension](#install-monai-label-extension)
- [Using the Plugin](#using-the-plugin)

### Supported Applications
Users can find supported applications in the [sample-apps](../../sample-apps/vista2d/) folder and use the vista2d bundle. Currently, only this bundle can be used to create and refine labels for medical imaging tasks in CellProfiler.

### Installing CellProfiler

To use MONAILabel with CellProfiler, you first need to install CellProfiler from source code following the installation part of [CellProfiler WiKi](https://github.com/CellProfiler/CellProfiler/wiki). Once you have CellProfiler installed, you can install the MONAILabel plugin as shown in the `Install MONAI Label Extension` part.

Please note these tips when installing the software:
1. After cloned the source code, you must switch to a specific version tag of the repo to start installation.
1. For Macbooks with Apple Silicon, please note [this issue](https://github.com/CellProfiler/CellProfiler/issues/4932) before you start to install.
1. Before actually running the command `pip install -e .`, you may need to install numpy if it doesn't exist in your environment.

### Install MONAI Label Extension
1. Save the runvista2d.py file to a local path.
1. Start CellProfiler from CLI, open the `File-->preferences` option and fill in the `CellProfiler plugin directory` parameter with your local path.

## Using the Plugin

1. Start the MONAI Label server with vista2d bundle.
1. Add the `RunVISTA2D` module to your pipeline for object processing.
1. Make sure the MONAILabel Server URL is correctly set in the plugin input.
1. Click the `Analyse Images` or `Start Test Mode` button to execute the pipeline.
1. Update masks and perform the sequential modules to get measurement results.

<img src="../../docs/images/cellprofiler_plugin.png" width=70% />
Binary file added plugins/cellprofiler/resources/vista2d_test.tiff
Binary file not shown.
Loading

0 comments on commit 6b7d315

Please sign in to comment.