Page history Edit this page How do I edit this website?
Original MediaWiki page

Segmentation

The content of this page has not been vetted since shifting away from MediaWiki. If you’d like to help, check out the how to help guide!

💡

See this helpful workshop on Image Segmentation for another great overview of Segmentation!

Introduction

Image segmentation is “the process of partitioning a digital image into multiple segments.” (Wikipedia)

It is typically used to locate objects and boundaries.

More precisely, image segmentation is the process of assigning a label to every pixel in an image such that pixels with the same label share certain visual characteristics.

Easy workflow

One plugin which is designed to be very powerful, yet easy to use for non-experts in image processing:

Plugin Name

Short Description

Highlights

Plugin Snapshot

Trainable Weka Segmentation

A tool that combines a collection of machine learning algorithms with a set of selected image features to produce pixel-based segmentations.

  • Can be trained to learn from the user input and perform later the same task in unknown (test) data
  • Makes use of all the powerful tools and classifiers from the latest version of Weka
  • Provides a labeled result based on the training of a chosen classifier
  • Ease of use due to its graphical user interfaces

Give it a try—you might like it!

Flexible workflow

One good workflow for segmentation in ImageJ is as follows:

  1. Preprocess the given images
  2. Apply an Auto Threshold
  3. Create and manipulate a mask
  4. Create and transfer a selection from a mask to your original image
  5. Analyze the resulting data

Preprocessing

Preprocess the image using filters, to make later thresholding more effective. Which filter(s) to use is highly dependent on your data, but some commonly useful filters include:

Adjusting Threshold

threshold-tree

Tree ring sample image with a threshold applied for a B&W image

Ideally you want to use one of the auto-threshold methods, rather than manually tweaking, so that your result is reproducible later on the same data, and on multiple other datasets.

  • Open your image
  • Select ImageAdjustThreshold…
  • Specify whether or not the background should be dark or light
  • Adjust the minimum and maximum sliders until you are satisfied with the saturation level of your image

Creating Masks

eroded-tree

Over-saturated mask is eroded around the center tree ring

  • Select EditSelectionCreate Mask
  • Based on the image and set threshold, some portions of the image may be over/under saturated
    • Select the portion of the image that needs to be adjusted
    • Select Dilate to grow the included pixels to further saturate this portion of the image or Erode to remove saturation
  • One quick way to split overlapping objects is the Watershed command.

Selections

selection-tree

Selections on the mask

Creating Selections

  • Select EditSelectionCreate Selection to select the objects within the mask
  • To deselect a portion of the image, select ⇧ Shift +  Left Click
reverted-tree

Selections on the reverted image

Transferring Selections

  • Before transferring the mask’s selections, revert the image to its original form by selecting ⇧ Shift + E
  • Select first the mask, then the original image, and select ⇧ Shift + E to transfer the mask’s selections

Analysis

Do some numerical analysis on the selected data:

  • Measure the entire selection directly.
  • Use Analyze Particles to extract desirable objects from your selection and report individual statistics on them.
  • Use the ROI Manager to Add the selection and then Split it (under the More button), then use Multi Measure (also under More) to report statistics on the objects.
  • Write a macro to automate this sort of analysis, loop over objects in the ROI manager, measure and manipulate them, etc.

See also