Skip to main content

A simple plugin for counting objects in 3D images

Project description

napari-3d-counter

License GNU GPL v3.0 PyPI Python Version tests codecov napari hub

A simple plugin for counting objects in 3D images

small


This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

Installation

You can install napari-3d-counter via pip:

pip install napari-3d-counter

To install latest development version :

pip install git+https://github.com/pnewstein/napari-3d-counter.git

Count3D Usage

Count3D can be launched from the plugin menu

Adding a cell

You can add a cell of the currently selected cell type by clicking on the viewer.

  • Ensure that Point adder layer is selected
  • Ensure that Add points tool is selected
  • Click on the viewer where you would like the point to be added

The counter on the current cell type's button will be incremented

https://github.com/pnewstein/napari-3d-counter/assets/30813691/745d495e-1d18-43dd-aa5e-e9ecd835cdae

Changing cell type

You can change the currently selected cell type by clicking on that cell type's button. This change will be reflected in the GUI. Additionally, the keyboard shortcut for that cell type can be used. Keyboard shortcuts are listed on the button, and are "q", "w", "e", "r", "t", "y" by default

https://github.com/pnewstein/napari-3d-counter/assets/30813691/844d04ce-2795-4226-a98b-d5fe5a0b131e

Undo last added cell

The undo button (shortcut u) will remove last added cell, regardless of cell type

https://github.com/pnewstein/napari-3d-counter/assets/30813691/c04ca5e3-9f48-4dd5-89e5-a9866b353e03

Remove a particular cell

To remove a particular cell. Change to the layer containing the cell you would like to remove. Then select the select points tool to select the points to delete, then use Delete selected points to delete those points

This change will be reflected in the counts.

https://github.com/pnewstein/napari-3d-counter/assets/30813691/d0787cba-9b23-46d5-9cd3-21a4ad73460a

Change appearance of a cell type

Changes to the name or edge color of a points layer will be reflected in the previously added points, as well as the GUI. Features that are editable in this way include: - face color - edge color - symbol - size

https://github.com/pnewstein/napari-3d-counter/assets/30813691/6c495270-d4c4-473e-9091-8d2e0f8e2764

Save configuration

Use the Make launch_cell_count.py button to create a python script that will launch napari with 3DCounter added to the dock and current cell type appearances already loaded

https://github.com/pnewstein/napari-3d-counter/assets/30813691/3448652d-3064-4900-8bbe-e88d75667108

Save cells

Use the "Save cells" button to save the cell coordinates for all layers into a csv file

https://github.com/pnewstein/napari-3d-counter/assets/30813691/38b30f2a-cc83-46c2-8b19-4d44715c07c5

Load cells

Use the "Load cells" button to load the cells from a csv file into new layers

https://github.com/pnewstein/napari-3d-counter/assets/30813691/7df74688-85b1-4b61-aa51-dab179763832

Launch with saved configuration

To run Count3D with custom configuration, paste the following code into your napari ipython console

from napari_3d_counter import Count3D, CellTypeConfig

cell_type_config = [
    # The first celltype is called "cq+eve+" and should be green
    CellTypeConfig(
        name="cq+eve+",
        color="g"
    ),
    # The first celltype is called "cq+eve-" and should be cyan
    CellTypeConfig(
        name="cq+eve-",
        color="c"
    ),
    # The first celltype is called "cq-eve+" and should be red
    CellTypeConfig(
        name="cq-eve+",
        color="r"
    ),
]
# Launch the plugin with configuration
viewer.window.add_dock_widget(Count3D(viewer, cell_type_config=cell_type_config))

Auxiliary plugins

Reconstruct Selected

One use case of Napari 3D Counter is to visualize a subset of labeled cells. For example, automated process label your cells of interest as well as a set of off-target cells, and you would like to visualize only your cells of interest. This can be accomplished by using Napari 3D Counter to count your cells of interest, and some other process to create labels (perhaps nsbatwm) and using Reconstruct Selected to create a new image layer of those labels which have been counted as a particular cell type.

Ingress Points

This plugin takes a points layer and adds the points to the selected cell_type layer. This can be usefull if you want to manualy count cells after cell identification.

Contributing

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.

License

Distributed under the terms of the GNU GPL v3.0 license, "napari-3d-counter" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari_3d_counter-0.5.0.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_3d_counter-0.5.0-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file napari_3d_counter-0.5.0.tar.gz.

File metadata

  • Download URL: napari_3d_counter-0.5.0.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for napari_3d_counter-0.5.0.tar.gz
Algorithm Hash digest
SHA256 7f844928db87a845ee7d301bb25f098b830c4ceecd9264ffc588d9cce94a8513
MD5 5baaa39538d21ae6fb2c0547020deaeb
BLAKE2b-256 e2c616e0272646f4f7993debd2d0e763d3c956af902294f7e2c1866a05d8beb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for napari_3d_counter-0.5.0.tar.gz:

Publisher: test_and_deploy.yml on pnewstein/napari-3d-counter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file napari_3d_counter-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_3d_counter-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a24002625e99247257813f786322b754f88929e19a402c5ac068d8ecd544b61c
MD5 478dac48b65d19024637ef99a9c427d2
BLAKE2b-256 fea39f7db334540dec3767d7d6aec9ca511f1120e1a236a5fdaedfc34afbc8ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for napari_3d_counter-0.5.0-py3-none-any.whl:

Publisher: test_and_deploy.yml on pnewstein/napari-3d-counter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page