Skip to content
Vanessa Dao edited this page Jun 25, 2024 · 10 revisions

Welcome to the PARSEG wiki!

PARSEG (PArallelised Refinement of SEGmentations) is a workflow for the combining of segmentation maps and subsequent removal of overlapping objects. It can be utilised as either a napari plugin for graphical user interaction or as a Python API to be included in custom workflows. This document will describe both implementations.

Getting Started

To use these scripts you need to install napari-segmentation-overlap-filter in a conda environment. For GUI usage, install the plugin in an environment which contains Napari.

Installing the plugin

Activate the your Napari environment and pip install the plugin

$ conda activate napari-env
$ pip install napari-segmentation-overlap-filter

Downloading the scripts

Download the code into a folder where you want to run it from. All python scripts and jupyter notebooks take path to root directory containing data.

Get Labels

napari-segmentation-overlap-filter combines existing segmentation masks and is agnostic to how these segmentations are created as long as they are labelled images with background pixels assigned as 0. For generating labels with FIJI's Trackmate-Cellpose and using Trackmate_Cellpose_GUI.py see this page.

Combining Labels

Python API

Combine_Segmentations_And_Filter_Overlaps.ipynb is an example notebook which shows how you can use the Python API for your own custom workflows, it is based off of the output from Trackmate_Cellpose_GUI.py (see above). For a breakdown of how it works, see this page.

Napari plugin

  1. Start napari and open two segmentation masks as separate layers
  2. Convert the layers from an Image Layer to a Labels Layer by right-clicking on the layer
  3. Open the plugin with Plugins > Segmentation Overlap Filter (napari-segmentation-overlap-filter) and the widget will appear on the right
  4. Select the two segmentation masks you'd like to combine using the drop down and menu
  5. Drag the slider to set percent overlap allowed
  6. Click Run
  7. Optionally, export the overlap dataframe as a csv file