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

Update base version #7

Merged
merged 45 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b919cc8
Add a layer around the model to unsqueeze based on if sample dim exists
lmanan Nov 1, 2023
1eb481e
Update README
lmanan Nov 21, 2023
bab4232
Update LICENSE to be HHMI, BSD 3 Clause
lmanan Nov 21, 2023
8f303c2
Add logo in README
lmanan Nov 21, 2023
f26cd6a
Update README.md
lmanan Nov 21, 2023
faf1fbb
Update README.md
lmanan Nov 21, 2023
9a369f2
Add logo
lmanan Nov 21, 2023
08278b1
Update dependency to specific gp and cellulus version
lmanan Nov 21, 2023
017a004
Update the front-end look
lmanan Nov 21, 2023
893cf4f
Install cellulus from the latest commit
lmanan Nov 21, 2023
6fef793
Update training code
lmanan Nov 21, 2023
e237a6b
Correctly import InferenceConfig
lmanan Nov 21, 2023
759e534
Update dependencies
lmanan Nov 29, 2023
4b30b86
Update inference code
lmanan Nov 29, 2023
8223bae
update mode for segmenting
lmanan Nov 29, 2023
ef62878
Update install instructions
lmanan Jan 16, 2024
e611b21
Add napari, pyqtgraph, cellulus, pre-commit as dependencies
lmanan Jan 16, 2024
435fabc
Update getting started
lmanan Jan 16, 2024
6740119
Add quotes around Plugins
lmanan Jan 16, 2024
4c0608b
Update 'Getting Started' section
lmanan Jan 16, 2024
3f68b0e
Update axis selector each time a different image is selected
lmanan Jan 16, 2024
65bbaf2
Replace import of os by pathlib
lmanan Jan 17, 2024
0263e08
Add 'train from scratch' checkbox
lmanan Jan 17, 2024
5659b2c
Allow resuming from last checkpoint
lmanan Jan 17, 2024
24ccff4
Upate default path to model weights to be /tmp/models
lmanan Jan 17, 2024
76c5c4a
Save scheduler state dict
lmanan Jan 17, 2024
46ee833
Add code for allowing loading of model weights
lmanan Jan 17, 2024
f7aadcc
update value of sliders once prediction is over
lmanan Jan 18, 2024
bd9f373
Add filter objects slider
lmanan Jan 22, 2024
e40b55c
Replace Args by Parameters in the docs
lmanan Jan 22, 2024
ca8b8f8
Update filter_small_objects
lmanan Jan 22, 2024
293501f
Add interactive functionality.
lmanan Jan 22, 2024
e7373ba
Add global min_object_sizes for having individual min object for each…
lmanan Jan 23, 2024
ad015c4
Update max_iterations to 100000
lmanan Jan 25, 2024
309ab08
Rename layers to be Uncertainty and OCE (x) and OCE (y)
lmanan Jan 25, 2024
8ff52f6
Add load model weights code
lmanan Jan 25, 2024
2f1294c
Remove old files
lmanan Mar 18, 2024
97a809f
Add widget.py
lmanan Mar 18, 2024
211684b
Add sample data
lmanan Mar 18, 2024
e8d0422
Add script file to load sample data
lmanan Mar 18, 2024
2501072
Update dataset related files
lmanan Mar 18, 2024
62af3a6
Use same version as for cellulus main package
lmanan Mar 18, 2024
4d1a44a
Update authors
lmanan Mar 18, 2024
254c127
Modify install instructions
lmanan Mar 18, 2024
c5e6720
Update napari yaml recipe file
lmanan Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
BSD 3-Clause License

The MIT License (MIT)
Copyright (c) 2023, Howard Hughes Medical Institute

Copyright (c) 2023 William Patton
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100 changes: 56 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,79 @@
# napari-cellulus
<h2 align="center">A napari plugin for cellulus</h2>

[![License MIT](https://img.shields.io/pypi/l/napari-cellulus.svg?color=green)](https://github.com/funkelab/napari-cellulus/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/napari-cellulus.svg?color=green)](https://pypi.org/project/napari-cellulus)
[![Python Version](https://img.shields.io/pypi/pyversions/napari-cellulus.svg?color=green)](https://python.org)
[![tests](https://github.com/funkelab/napari-cellulus/workflows/tests/badge.svg)](https://github.com/funkelab/napari-cellulus/actions)
[![codecov](https://codecov.io/gh/funkelab/napari-cellulus/branch/main/graph/badge.svg)](https://codecov.io/gh/funkelab/napari-cellulus)
[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-cellulus)](https://napari-hub.org/plugins/napari-cellulus)
- **[Introduction](#introduction)**
- **[Installation](#installation)**
- **[Getting Started](#getting-started)**
- **[Citation](#citation)**
- **[Issues](#issues)**

A Napari plugin for Cellulus: Unsupervised Learning of Object-Centric Embeddings for Cell Instance Segmentation in Microscopy Images
### Introduction

----------------------------------
This repository hosts the code for the napari plugin built around **cellulus**, which was described in the **[preprint](https://arxiv.org/pdf/2310.08501.pdf)** titled **Unsupervised Learning of *Object-Centric Embeddings* for Cell Instance Segmentation in Microscopy Images**.

This [napari] plugin was generated with [Cookiecutter] using [@napari]'s [cookiecutter-napari-plugin] template.
*cellulus* is a deep learning based method which can be used to obtain instance-segmentation of objects in microscopy images in an unsupervised fashion i.e. requiring no ground truth labels during training.

<!--
Don't miss the full getting started guide to set up your new package:
https://github.com/napari/cookiecutter-napari-plugin#getting-started
The main source repository for *cellulus* lives **[here](https://github.com/funkelab/cellulus)**.

and review the napari docs for plugin developers:
https://napari.org/stable/plugins/index.html
-->
### Installation

## Installation
One could execute these lines of code below to create a new environment and install dependencies.

You can install `napari-cellulus` via [pip]:
1. Create a new environment called `napari-cellulus`:

pip install napari-cellulus
```bash
conda create -y -n napari-cellulus python==3.9
```

2. Activate the newly-created environment:

```
conda activate napari-cellulus
```

To install latest development version :
3a. If using a GPU, install pytorch cuda dependencies:

pip install git+https://github.com/funkelab/napari-cellulus.git
```bash
conda install pytorch==2.0.1 torchvision==0.15.2 pytorch-cuda=11.7 -c pytorch -c nvidia
```

3b. otherwise (if using a CPU or MPS), run:

## Contributing
```bash
pip install torch torchvision
```

Contributions are very welcome. Tests can be run with [tox], please ensure
the coverage at least stays the same before you submit a pull request.
4. Install the package from github:

## License
```bash
pip install git+https://github.com/funkelab/napari-cellulus.git
```

Distributed under the terms of the [MIT] license,
"napari-cellulus" is free and open source software
### Getting Started

## Issues
Run the following commands in a terminal window:
```
conda activate napari-cellulus
napari
```

If you encounter any problems, please [file an issue] along with a detailed description.
Next, select `Cellulus` from the `Plugins` drop-down menu.

[napari]: https://github.com/napari/napari
[Cookiecutter]: https://github.com/audreyr/cookiecutter
[@napari]: https://github.com/napari
[MIT]: http://opensource.org/licenses/MIT
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin
### Citation

[file an issue]: https://github.com/funkelab/napari-cellulus/issues
If you find our work useful in your research, please consider citing:

[napari]: https://github.com/napari/napari
[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
[PyPI]: https://pypi.org/

```bibtex
@misc{wolf2023unsupervised,
title={Unsupervised Learning of Object-Centric Embeddings for Cell Instance Segmentation in Microscopy Images},
author={Steffen Wolf and Manan Lalit and Henry Westmacott and Katie McDole and Jan Funke},
year={2023},
eprint={2310.08501},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
```

### Issues

If you encounter any problems, please **[file an issue](https://github.com/funkelab/napari-cellulus/issues)** along with a description.
16 changes: 6 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ description = A Napari plugin for Cellulus: Unsupervised Learning of Object-Cent
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/funkelab/napari-cellulus
author = William Patton
author_email = [email protected]
license = MIT
author = William Patton, Manan Lalit
author_email = [email protected], [email protected]
license_files = LICENSE
classifiers =
Development Status :: 2 - Pre-Alpha
Expand All @@ -31,19 +30,16 @@ project_urls =
[options]
packages = find:
install_requires =
numpy
magicgui
napari[all]
pyqtgraph
qtpy
cellulus @ git+https://github.com/funkelab/cellulus
matplotlib
torch
gunpowder

pre-commit

python_requires = >=3.8
include_package_data = True
package_dir =
=src
= src

# add your package requirements here

Expand Down
6 changes: 3 additions & 3 deletions src/napari_cellulus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__version__ = "0.0.3"
__version__ = "0.1.0"

from ._sample_data import tissuenet_sample
from .sample_data import tissue_net_sample

__all__ = ("tissuenet_sample",)
__all__ = ("tissue_net_sample",)
3 changes: 0 additions & 3 deletions src/napari_cellulus/_tests/test_samples.py

This file was deleted.

171 changes: 0 additions & 171 deletions src/napari_cellulus/dataset.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, shape, axis_names):
self.channel_dim = None
self.time_dim = None
self.spatial_array: Tuple[int, ...] = ()
self.spatial_dims = ()
self.spatial_dims: Tuple[int, ...] = ()
for dim, axis_name in enumerate(axis_names):
if axis_name == "s":
self.sample_dim = dim
Expand Down
Loading
Loading