- Edit segmentation on single time frame
- Edit segmentation on several time frames: tracks edit mode.
- Cleaning options: general cleaning/checking of the segmentation and EpiCure files to ensure.
- Group cells options: classify cells into group (type) of cells.
- ROI options: apply some process to only some drawn region.
-
Seeds options: to perform a watershed segmentation from several placed seed points.
Edit segmentation on single time frame
EpiCure
proposes features to ease the manual segmentation correction on single time frame (the current one), through several shortcuts.
Shortcuts
The segmented cells are represented as label. There are several possibility for label edition in Napari
+ extra features from EpiCure
.
EpiCure shortcuts are linked to the Segmentation
layer, so it should be selected for the shortcuts to work.
General shortcuts are documented here.

-
You can merge two neighboring cells that were wrongly segmented as 2 instead of one cell.
EpiCure
will relabel one of these two cell with the other cell label, and performs a morphological closing to bring them together if they are not touching. Note that if there is another cell is between, they cannot be merged; you will get two cells with the same label. Press Control + left-click to merge 2 cells, starting from inside the first cell until the second cell with the mouse button clicked. -
You can also split one cell that was wrongly segmented as one into the two correct separated cells.
Epicure
will do a watershed separation to find the limits of the two cells. Press Control + right-click across the junction to split the cell, starting from the middle of the first cell, until the middle of the second cell with the mouse button clicked. The program uses the first point of the dragged-click as a seed for the first cell, and the last point of the dragged-click as the second seed. If it fails, changing the starting and final points can improve the separation. -
A cell can also be split by drawing the junction (usefull when intensities are very messy making watershed separation to fail).
Press Alt + right-click and draw the junction, keeping the right button clicked all along. The plugin will then split the cell in 2, one with the previous value and the new one with the maximum label + 1 value. If your line drawing spread over the neighbor cells, it will not affect them.

-
Press 2 to switch to drawing mode or click on the pencil icon. You can draw a label with this pencil tool. When it is selected, it will draw with the current value in the field below. You can choose the precision of your drawing with thebrush stroke
parameter (the brush size can be decreased with [ and increased with ]. -
Press 3 to switch to fill mode. To replace a whole label by a new value (label), you can use thefill
option. Put the desired value in the label field and click on the label to fill with it. -
To select a label, you can put the value in the
label
field or you can use the picker tool and click on the corresponding area. Press 4 to switch to picker mode. -
To delete a label, put
0
as the current value (or press 1), select thefill
tool and click on the label to remove. Or right-click on a label to erase it directly. -
To draw a new cell, you have to select a value that is not used yet in all the movie. The simpler is to use the maximal current value and add one to be sure to use a new value.
You can get this value by pressing m. It will directly put the max value + 1 in the active label field and active the drawing mode. -
The
preserve labels
option allows you to freeze other labels than the current active one. If you try to draw on top of another label, it will not work as the other labels have been locked. This is convenient when you draw a new label to be sure to draw the new cell just against the other ones without modifying them. If you try to draw on a label when this option is activated, you will get an error message appearing.
Complete list of Napari label layer shortcuts (From File>Preferences>Shortcuts):
Edit segmentation on several time frames
To correct tracks,
Merge two tracks
Track edit mode is active
To link two cells that have not been correctly tracked as one (temporal merge) or that have been wrongly splitted in two in the segmentation in several frames (spatial merge),
Temporal merging
If the two cells clicked are not in the same frame, you are merging two tracks temporally. If you select cells that are not the last or first one of their tracks, or if the two clicked cells are not in consecutive frames, EpiCure will refuse to merge them and quit the track merging mode.
If the clicks are correct, the two tracks will be fused in one longer track with the first cell label.
Spatial merging
If the two cells clicked are on the same frame, you are merging two cells spatially as one (correcting a splitted segmentation). This will create a new track containing the two merged segmentation as one cell. The merge of the cells will be done from the current frame and until one of the two cells is not present anymore.
Split temporally track
Manual tracking edition
Track edit mode is active
The first left-click that you do would determine the id of the track to edit (the cell value that you clicked), and the movie will go to the next frame. Then, for each left-click, the cell below the cursor will be set to this track id value and the movie will move to the next frame.
To finish the track editing, Control+right-click and a confirmation message will appear. If you reach the end of the movie and do one more left-clik, the manual tracking mode will also be stopped.
Label interpolation
Track edit mode is active
Option to interpolate the segmentation of a label between two (or more) frames when the segmentation is missing.
EpiCure will interpolate the segmentation from the left clicked cell to the right clicked cell and link the two tracks. You should obtain a full track, with the label of the first cell that contains the first track, the interpolated cell on the missing frames and the second track.
Note that the interpolated segmentation is drawn only where the initial segmentation is black (background). If other labels are present in the interpolated area, it will not be corrected.
Cleaning options
Options to ensure clean and correct EpiCure files.
Remove border cells
Remove all segmented cells that touch the spatial borders of the image. This parameter allows to get rid of cells that are partially outside of the imaged region and thus not complete.
The parameter Border width
allows to extend the requirement for the cells to be considered as fully inside. Cells that have at least one pixel at a distance less than Border width
pixels from the image limits will be removed.
Note that this action will be applied to all the time frames of the movie, and cannot be cancelled (if you wish to cancel it, you then need to restart EpiCure without saving the files).
Remove mini cells
Allows to remove all cells smaller than the chosen threshold. The cell size is its area in pixels (number of pixels inside the cell). When this button is clicked, all frames will be treated.
Cell inside another: merge
Merge all cell fully included in another one into it.
One recurrent segmentation error can be a large cell wrongly split in two cells, with one (false split) inside the other (correct one). This kind of error occurs when there is a large bright spot inside a cell, as for example into SOP (Sensory Organ Precursor) cells.

This option performs several checks to ensure that the files follows EpiCure's standards and can fix some errors.
For example, the tracks must not have frame gaps (missing one frame). If that happens, the sanity check
option will detect it and fix it by splitting the gap in two different gaps.
If some napari layers had been wrongly closed, this step will also re-open them.
It also checks if the labels seemed ok or if something is weird.
Group cells options
Allows to create group of cells (classify them). Cells can be manually assigned to a cell group by clicking on them. This is useful to distinguish different type of cells visually or/and in the analysis in the Outputs options.
Group name
allows to choose the name to give to a new Group of cells, or to assign a cell to the current Group name
group. Write a new name to enter a new group, or choose in the list an existing group to insert the cell in that group.
A cell can be assigned to the current group with
Show groups
will add a Groups
layer in Napari, in which the cell are colored by the group they are in. Cells that are not in any group are black.
Reset groups
remove all created groups. All cells are not in any groups.
Cells inside ROI to group
: assign all the cells that are inside the currently selected ROI in the current frame (in the ROIs
layer) to the current group (set by Group name
). Cells that are assigned to a group are assigned all along the track (in all frames where this cell is present).
When the segmentation is Segmentation
layer is active, the group information is also saved, in the EpiCure data file (file in the epics
folder that ends with _epidata.pkl
. When the movie is reopened in EpiCure, it will be automatically reloaded.
Automatic cell group assignement
Options are proposed to automatically assign several cells into one group.
Group cells based on intensity measurement.
To set this option, click on the Group from track intensity...
button in the Group options
panel.
It opens-up an interface that allows to choose the criteria for the cell classification.
The positive cells based on the selected criteria will be assigned to the current group name that can be set in the Group name
parameter in the main interface.
Choose the layer to use for the classification: the intensity in this layer will be measured in each cell. The layer can be a non EpiCure-layer . It only have to be opened in the same Napari and put at the same scale. For example it can be a probability map that are calculated by DeXtrusion. In the notebook EpiCure_DeXtrusion_Interaction.ipynb in this repository, dextrusion probability maps are overlayed with the EpiCure data and used to automatically classify SOP cells if they have been detected by DeXtrusion.
For each track, the intensity will be measured in all the pixels of the cell at each time frame. You can choose whether you want to measure the mean value of these intensities, or the sum/max/min/median. Then fix a threshold to consider the track as positive if the measured value is above this threshold.
Group cells according to events (dividing/extruding)
This option allows you to automatically group cells that will divide or extrude into a Dividing
or Extruding
group (or other group for other events).
Click the Group from events...
button to open the parameter interface of this option.
You can choose which type of events to use to classify the cells.
Click on Apply
to automatically set all the cells that divide (or extrude, or other event types) into the Dividing
group (or Extruding
).
If the option show groups
of the main panel is selected, you will directly see which cells were assigned to this group when the processing will be finished.
ROI options
This option allows to do operations on several neighboring cells at once, by selecting a region.

When you select the Selection option
in the Edit
panel, press the first button Draw/Select ROI
to draw a new shape or select an existing one. The shapes should be in the Drawings
layer, by default not visible. When you click on this button, the layer will be visible and active.
Choose the drawing tool that you want (ellipse, polygon, rectangle, triangle), the shape should be a closed one (so not a line). Draw the contour of the region that you want to use. The selected cells will be all the ones that have their centroids inside the drawn shape in the current frame.
If the selected cells (labels) are present in other frames (tracking has been done), they will also be selected.
Remove cells inside ROI
This will remove all the cells that are inside the currently selected shape/ROI. However, if some of those cells are "checked", they will not be removed.
If no shape is selected, but there is exactly one shape in the Drawings
layer, this shape will be selected. Otherwise, an error message will show off.
Seeds options
This option performs an automatic segmentation of cells starting from manually placed points (seeds).
Manual positioning of seeds
To place/add seeds, you can either check the Seed options
parameter in the Edit
panel, press create seeds layer
if it's not there yet and select the +
button in the top left panel to add points.
Segmentation
layer is active, and each left-click will place a new seed if there is no cell below. right-click to stop adding seeds.
Automatic positioning of seeds from previous time point
In the case of movies, we can use the information from the previous frame to place the seeds in the region that are not segmented yet. This option Load seeds from previous time point
simply takes the centers of each cell of the previous frame as a seed.
Automatic segmentation from seeds
Several methods to segment the cells from the seeds are proposed:
- Intensity-based: classic watershed method, starting filling from the seeds and stopping at high intensity gradient
- Distance-based: purely based on the distance to the seed points, voronoi-like segmentation.
- Diffusion-based: random walk approach from the seeds. The segmentation is spread by diffusion from the seeds through similar intensity pixels in the image (sensitive to both the distance and the intensity).
The parameter max cell radius
controls the maximum cell size. It will constrained the segmentation for the Distance-based
method and is used to crop the image around the seeds for computation efficiency with the two other methods.
Select the segmentation method and click on Segment cells from seeds
to run it.