BDV LabelEditor / Objects Counter (IJ2) for dealing with labelings in ImageJ [USAGE]

Hi all,

who is working with image labelings in Fiji and would like to test the newest JugLab project, the LabelEditor? It will enable you to interact with labelings in the BigDataViewer.

You can get it by installing this update site:

This is a month old project so it is likely to come across issues. Please let us know!

Running the Objects Counter (IJ2)

  • open an image (currently supported: 2D or 3D datasets with one channel)
  • run Analyze > Objects Counter (IJ2)
  • it will guide you through two steps where you can change options
    • thresholding (will run the net.imagej.plugins.commands.binary.Binarize command)
    • connected component analysis (will run the net.imagej.ops.labeling.cca.DefaultCCA op)

Afterwards, the LabelEditor window should open and you should be able to interact with the detected objects, e.g. clicking on them, shift-click for multiselect, CTRL+A for selecting all etc.

There should also be a right-click menu giving you a few more options.

There are for example a few export options:

Running example scripts (groovy)

There is more you can do via script, have a look at the templates:

You can display an ImgLabeling with the LabelEditor via the UIService (here shown with groovy)…

#@ OpService ops
#@ IOService io
#@ UIService ui

import net.imglib2.algorithm.labeling.ConnectedComponents.StructuringElement

input ="")

binary = ops.threshold().otsu(input)
labeling = ops.labeling().cca(binary, StructuringElement.EIGHT_CONNECTED)

You can import label maps…

#@ Img input
#@ IOService io
#@ UIService ui

import sc.fiji.labeleditor.core.model.DefaultLabelEditorModel

model = DefaultLabelEditorModel.initFromLabelMap(input)

You can assign tags to labels and color them differently…

model = new DefaultLabelEditorModel(labeling, input)

TAG1 = "tag1"
TAG2 = "tag2"

model.tagging().addTagToLabel(TAG1, new Integer(1))
model.tagging().addTagToLabel(TAG2, new Integer(7))

model.colors().getFaceColor(TAG1).set(255,50, 0)
model.colors().getBorderColor(TAG1).set(0, 50, 255)

You can assign tags with a specific value (e.g. "label 1 has a size of 30, so I assign tag SIZE with value 30) and color them depending on this value…

We made this specifically because we have to deal with conflicting segmentation results so there is a conflict selection mode (only available as a Java example for now)…

Current state of development

For now, it is more of a selector than an editor. In January we will join forces with Labkit and make pixelwise label editing possible while also hopefully integrating the LabelEditor features into Labkit.

Next steps:

  • make colors and behaviors better configurable via BDV interface / settings files
  • export label information to a table (size, center point, tag values…)
  • provide a way to tag labels with some default values like size, maybe circularity, …
  • support images with more dimensions
  • explore how to connect this to ROIs

I’ll make another post about the development to keep the discussion a bit separated.


:clap: This is super cool.

E09, 3D labeling doesn’t show up in the version on the update site, and I’d love to export labels to SciView. We’ve baked our own code so far (, but I’d rather use LabelEditor.

1 Like

Thanks :slight_smile:

Jepp sorry, the screenshot is incorrect, E09 did not make it to Groovy, but the Java 3D example exists. Here is how the result looks like (not spectacular, just random spheres…):

I’ll add my thoughts on SciView integration to the development thread!

1 Like