The napari hub is transitioning to a community-run implementation due to launch in June 2025.
Since October 1, 2024, this version is no longer actively maintained and will not be updated. New plugins and plugin updates will continue to be listed.

Cochlea SynapSeg

cochlea-synapseg

A plugin to segment cochlear ribbon synapses automatically, as well as edit and adjust

Workflow step:
Image annotation
Image segmentation

License BSD-3 PyPI Python Version tests codecov napari hub

A plugin to segment cochlear ribbon synapses.

More is in the works, but for now it includes tools to more quickly generate ground truth ribbon segmentation (Plugins > SynapSeg - Ground Truth Widget).


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

Installation

You can install cochlea-synapseg (receommended: in a new conda environment with up-to-date napari) via pip:

python -m pip install cochlea-synapseg

Usage

After successfull installation, you can find the plugin next time you launch napari (Plugins > SynapSeg - Ground Truth Widget).

The ground truth widget is divided into multiple sections, for "quick use", be sure to check the settings denoted with asterisks:

Image Tools

image_tools

*1. Image Layer Selection - use the dropdown to select the name of your image layer (here, the layer that contains the ribbon stain)

(First load a 3D image using one of napari's native readers, or using the Cochlea-Synapseg .zarr reader (reads a .zarr with '3d/raw' and '3d/labeled').)

*2. Refresh Image Layer Selection - update the list of available image layers in #1

3. Pixel size information - (in microns), used for some point readers to successfully convert real units to pixel coordinates. Can be left as 1 if this functionality is not needed.

4. Split channels - splits multiple channels into separate image layers (useful for FIJI-saved .tif images)

Points Tools & Points to Labels

points_tools

5. Points Layer Selection and Refresh - use the dropdown to select an existing points layer, use the refresh button to update the list (or skip to #8 if not loading in existing points)

6. Real -> Pixel Units - if you've loaded some points were saved in real units, make sure the pixel size information above in #3 is correct, then click "real -> pixel units"

7. Channel Adjustment - some points (like ImageJ/FIJI rois or CellCounter points), show up in the wrong z plane because their "slice" coordinates are a combination of both slice and channel info. If this happens, set the number of channels (in the original image, where the ROIs were created!), and then click "chan -> z convert". Z coordinates of the points layer will be divided by the number of channels specified.

*8. New Points Layer - if starting annotation from scratch, click to create a new points layer. #5 should automatically select this new layer.

*9. Rotate to XY and *10. Auto-adjust Z - these convenient functions allow you to quickly annotate points in Napari's 3D view. Simply click "Rotate to XY before adding new points. These points will now have the correct XY position but will have missing Z information. (Rotate out of XY to confirm.) Click "Auto-adjust z" and the z will automatically adjust to the brightest point.

11. Manually Edit Z - useful for overlapping points, can be used to manually edit the z position of ONLY selected points. Use the +/- arrow keys for single z steps type in a number to move a larger amount.

12. Snap too Max - will automatically adjust all points to their local max (search radius defined in pixels in Advanced Settings -> snap to max rad). Useful for adjusting quickly dropped points, but proceed with caution if you have close-together points.

*13. Points to Labels - the key functionality of the module, creates a label layer by performing a local segmentation on all points.

14. Advanced Settings - adjust settings for the points to labels function to optimize local segmentation and watershed separation of points.

Labels Tools

labels_tools

15. Lables Layer Selection and Refresh - use the dropdown to select an existing labels layer, use the refresh button to update the list

16. Make Labels Editable - zarrs and other file formats tend to load in as dask arrays, which don't allow editing. Checking this box will make the labels layer editable by converting to a numpy array (will load the layer into memory, so be careful if dealing with large images!). This will allow you to edit the labels layer with tools like the paintbrush and eraser. Automatically enables if merging or removing labels is requested (see #17 and #19)

*17. Remove a Label - use the labels layer eyedropper tool to identify the ID of an unwanted label, then type in the box and click "Remove label"

18. Max Label Display - shows the current maximum label ID. If you're painting labels by hand and need a new label ID, increment above this number. Use the refresh button to the right to get an up-to-date number if you've made changes to your label layer.

*19. Merge labels - if you have an existing labels layer, and then create new labels (e.g. from the points to labels function), select the layer you'd like to merge into your existing labels layer (i.e. box 15 and 19a should be different from one another!), and then click "merge labels". This function will automatically ensure overlapping label IDs are not used.

20. Labels to Points - if wanted, you can take all your existing labels and convert them to a points layer based on their centroids. This may be helpful for quickly generating better labels using the points tools above.

Save to Zarr

save_zarr

Functionality to save to .zarr format. Saves image as '3d/raw' and labels as '3d/labeled'. Used for later auto-segmentation of ribbons (not live in this plugin yet, but coming soon!).

*21. File Path - the directory in which to save the zarr; use the folder icon to search for an existing directory

*22. File Name - the zarr name to save to; use the magnifying glass icon to select an existing .zarr

23. From Source - set the file path and name to where the image layer was loaded from. (Caution: if you loaded a zarr, this will result in the zarr being overwritten!)

*24. Save 3D Only (recommended) - saves the image and labels layers (selected in #1 and #15) in the specified .zarr, as 3d/raw and 3d/labeled, respectively. A reader is included with this plugin for this format as well.

25. Save 2D and 3D - (not recommended) to be used in the future if 2D models are to be run on the data, saves both the 3D stacks as in 24, and then individual 2D slices for each z in 2d/raw/[z] and 2d/labeled/[z]

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 BSD-3 license, "cochlea-synapseg" is free and open source software

Issues

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

Version:

  • 0.0.1

Last updated:

  • 07 November 2024

First released:

  • 07 November 2024

License:

  • Copyright (c) 2024, Cayla Miller All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 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. * Neither the name of 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.

Supported data:

  • Information not submitted

Save extension:

Save layers:

GitHub activity:

  • Stars: 0
  • Forks: 0
  • Issues + PRs: 0

Python versions supported:

Operating system:

Requirements:

  • numpy
  • qtpy
  • scikit-image
  • scipy
  • zarr