Skip to content

pnewstein/napari-3d-counter

Repository files navigation

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

click.mp4

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

switch.mp4

Undo last added cell

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

undo.mp4

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.

manual_delete.mp4

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

config.mp4

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

gen_py.mp4

Save cells

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

save.mp4

Load cells

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

load_file.mp4

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))

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages