Refresh

This website github.com/herophilus/cellpose/commit/be9563e5d10cb9cd3afb052563dd43f295633ac6 is currently offline. Cloudflare's Always Online™ shows a snapshot of this web page from the Internet Archive's Wayback Machine. To check for the live version, click Refresh.

Skip to content

Commit

Permalink
fixing bug in writing computing_masks... and updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
carsen-stringer committed Apr 5, 2022
1 parent 15c8e9b commit be9563e
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 38 deletions.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ and updated GUI:

![gui screenshot](https://www.cellpose.org/static/images/cellpose_gui.png)

Mxnet is no longer supported in cellpose. To use mxnet, please use v1.0.2.

### UPDATE v1.0 (Jan 2022)

Cellpose has been relatively stable for a while now. Small bugs will continue to be fixed, but we are now releasing a reference 1.0 version. Larger updates to Cellpose will go towards a new 2.0 candidate version to be released soon.
Expand All @@ -45,6 +47,11 @@ from cellpose.io import logger_setup
logger_setup();
```

To install this version please use
```
pip install cellpose==1.0.2
```

### UPDATE v0.7 (Nov 2021)

[Omnipose](https://github.com/kevinjohncutler/omnipose) is now officially available and supported as part of Cellpose. `pip install omnipose` and use the 'omni' flag and models to take advantage of it for long cells! (<i>E.g.</i>, filamentous bacteria.) Omnipose was written by Kevin Cutler ([@kevinjohncutler](https://github.com/kevinjohncutler)). To learn about Omnipose, read the [paper](https://biorxiv.org/content/early/2021/11/04/2021.11.03.467199). If you use Omnipose in your work please cite the Cellpose paper and the Omnipose paper.
Expand Down Expand Up @@ -130,17 +137,6 @@ Follow the instructions [here](https://pytorch.org/get-started/locally/) to dete
conda install pytorch cudatoolkit=10.2 -c pytorch
~~~~

For the GPU version of mxnet, you will need to install the cuda toolkit first if you haven't already (on Windows it may be necessary to install via anaconda as below):

~~~
conda install -c anaconda cudatoolkit
~~~

When upgrading GPU Cellpose in the future, you will want to ignore dependencies (to ensure that the pip version of torch does not install):
~~~
pip install --no-deps cellpose --upgrade
~~~

### Installation of github version

Follow steps from above to install the dependencies. Then run
Expand Down Expand Up @@ -246,7 +242,7 @@ See the [docs](https://cellpose.readthedocs.io/en/latest/outputs.html) for info.

## Dependencies
cellpose relies on the following excellent packages (which are automatically installed with conda/pip if missing):
- [mxnet_mkl](https://mxnet.apache.org/)
- [pytorch](https://pytorch.org/)
- [pyqtgraph](https://pyqtgraph.org/)
- [PyQt5](https://pyqt.sourceforge.net/Docs/PyQt5/)
- [numpy](https://www.numpy.org/) (>=1.16.0)
Expand Down
12 changes: 7 additions & 5 deletions cellpose/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1642,11 +1642,7 @@ def get_thresholds(self):
cellprob_threshold = float(self.cellprob_threshold.text())
if flow_threshold==0.0 or self.NZ>1:
flow_threshold = None
logger.info('computing masks with cell prob=%0.3f, no flow error threshold'%
(cellprob_threshold))
else:
logger.info('computing masks with cell prob=%0.3f, flow error threshold=%0.3f'%
(cellprob_threshold, flow_threshold))

return flow_threshold, cellprob_threshold
except Exception as e:
print('flow threshold or cellprob threshold not a valid number, setting to defaults')
Expand All @@ -1657,6 +1653,12 @@ def get_thresholds(self):
def compute_cprob(self):
if self.recompute_masks:
flow_threshold, cellprob_threshold = self.get_thresholds()
if flow_threshold is None:
logger.info('computing masks with cell prob=%0.3f, no flow error threshold'%
(cellprob_threshold))
else:
logger.info('computing masks with cell prob=%0.3f, flow error threshold=%0.3f'%
(cellprob_threshold, flow_threshold))
maski = dynamics.compute_masks(self.flows[4][:-1],
self.flows[4][-1],
p=self.flows[3].copy(),
Expand Down
8 changes: 6 additions & 2 deletions docs/command.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ These are the same :ref:`settings`, but set up for the command line, e.g.
* use_gpu: (bool)
run network on GPU

* save_outlines: FLAG
save outlines as text file for ImageJ

* save_png: FLAG
save masks as png and outlines as text file for ImageJ
save masks as png

* save_tif: FLAG
save masks as tif and outlines as text file for ImageJ
save masks as tif

* no_npy: FLAG
turn off saving of _seg.npy file
Expand Down Expand Up @@ -73,6 +76,7 @@ Options
You can run the help string and see all the options:

::
usage: __main__.py [-h] [--use_gpu] [--check_mkl] [--dir DIR]
[--look_one_level_down] [--img_filter IMG_FILTER]
[--channel_axis CHANNEL_AXIS] [--z_axis Z_AXIS]
Expand Down
20 changes: 14 additions & 6 deletions docs/gui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ You can **drag and drop** images (.tif, .png, .jpg, .gif) into the GUI and run C

For multi-channel, multi-Z tiff's, the expected format is Z x channels x Ly x Lx.

.. note::
The output file with the masks is in the same folder as the loaded
image with ``_seg.npy`` appended. The GUI automatically saves after you
draw an ROI but NOT after running a model for
segmentation and NOT after 3D mask drawing (too slow). Save in the file
menu or with Ctrl+S.

.. note::
Since the output file is in the same folder as the loaded
image with ``_seg.npy`` appended, make sure you have WRITE access
in the folder, otherwise the file will not save.

Using the GUI
~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -41,14 +53,10 @@ in 2D should be single strokes (if *single_stroke* is checked).

If you want to draw masks in 3D, then you can turn *single_stroke*
option off and draw a stroke on each plane with the cell and then press
ENTER. 3D labelling will fill in unlabelled z-planes so that you do not
ENTER (cellpose 1.0 only currently).
3D labelling will fill in unlabelled z-planes so that you do not
have to as densely label.

.. note::
The GUI automatically saves after you draw a mask but NOT after
segmentation and NOT after 3D mask drawing (too slow). Save in the file
menu or with Ctrl+S. The output file is in the same folder as the loaded
image with ``_seg.npy`` appended.

Segmentation options
~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
14 changes: 2 additions & 12 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ this code at the beginning of your notebook before you import cellpose:
Common issues
~~~~~~~~~~~~~~~~~~~~~~~

If you receive the error: ``Illegal instruction (core dumped)``, then
likely mxnet does not recognize your MKL version. Please uninstall and
reinstall mxnet without mkl:

::

pip uninstall mxnet-mkl
pip uninstall mxnet
pip install mxnet==1.4.0

If you receive the error: ``No module named PyQt5.sip``, then try
uninstalling and reinstalling pyqt5

Expand Down Expand Up @@ -84,7 +74,7 @@ Dependencies
cellpose relies on the following excellent packages (which are
automatically installed with conda/pip if missing):

- `mxnet_mkl`_
- `pytorch`_
- `pyqtgraph`_
- `PyQt5`_
- `numpy`_ (>=1.16.0)
Expand All @@ -98,7 +88,7 @@ automatically installed with conda/pip if missing):
.. _environment.yml: https://github.com/MouseLand/cellpose/blob/master/environment.yml?raw=true
.. _here: https://pypi.org/project/cellpose/

.. _mxnet_mkl: https://mxnet.apache.org/
.. _pytorch: https://pytorch.org/
.. _pyqtgraph: https://pyqtgraph.org/
.. _PyQt5: https://pyqt.sourceforge.net/Docs/PyQt5/
.. _numpy: https://www.numpy.org/
Expand Down
16 changes: 15 additions & 1 deletion docs/models.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
Models
------------------------------

``from cellpose import models``

Cellpose 2.0 now has a model zoo and options for user model training.
See paper for more details.
Each model will be downloaded automatically to your ``models.MODELS_DIR``
(see Installation instructions for more details on MODELS_DIR).
See paper for more details on the model zoo. You can also directly download a
model by going to the URL, e.g.:

``https://www.cellpose.org/models/MODEL_NAME``

Model Zoo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -26,6 +33,11 @@ run with ``diameter=0`` or ``--diameter 0`` and the model can estimate the ROI s
These models can be loaded and used in the notebook with ``models.Cellpose(model_type='cyto')``
or in the command line with ``python -m cellpose --pretrained_model cyto``.

These models' names (to download all the models for a class run with ``--net_avg``):
* `'cyto'`: ``cytotorch_0``, ``cytotorch_1``, ``cytotorch_2``, ``cytotorch_3``, ``size_cytotorch_0.npy``
* `'nuclei'`: ``nucleitorch_0``, ``nucleitorch_1``, ``nucleitorch_2``, ``nucleitorch_3``, ``size_nucleitorch_0.npy``
* `'cyto2'`: ``cyto2torch_0``, ``cyto2torch_1``, ``cyto2torch_2``, ``cyto2torch_3``, ``size_cyto2torch_0.npy``

Cytoplasm model (`'cyto'`)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -71,6 +83,8 @@ These models can be loaded and used in the notebook with e.g.
``models.CellposeModel(model_type='tissuenet')`` or ``models.CellposeModel(model_type='LC2')``,
or in the command line with ``python -m cellpose --pretrained_model tissuenet``.

These models' names are the same as their strings in the GUI.

TissueNet models
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down

0 comments on commit be9563e

Please sign in to comment.