Segmentation

Author

Karl-Heinz Kunzelmann

History

2009/09/28: First version

Source

SeededRegionGrowingForStacksWithMask.java

Installation

Copy KHKs_StackSRG.zip into a temporary directory, extract the jar file and copy it into the ImageJ > plugins directory and restart ImageJ. If you do not already have the seeded region growing plugin from Jarek Sacha, you need to copy ij-plugins_toolkit.jar and copy it to the plugins directory, too. If you like, you can use these sample data which I used for development.

Description:

This file is based on the routine “seeded region growth” by Jarek Sacha

Image/J Plugins package net.sf.ij_plugins.im3d.grow
Copyright (C) 2002–2009 Jarek Sacha
Latest release available at http://sourceforge.net/projects/ij-plugins/

Annotation Dec 2012:

Sacha provided a much better release with the same functionality as my plugin in the meantime. Use his version instead of mine!

The present file SeededRegionGrowingForStacksWithMask.java is more or less a front-end for the SRG plugin of Jarek Sacha

The idea of this file is to work through a stack slice by slice taking the seed points, which are necessary for the SRG.java from an other stack, which I call “label mask”.

The “label mask” can be created nearly automatically from grey stacks (for example either by very conservative (= narrow) thresholding alone or by a combination of thresholding and skeletonization…).

To give you an idea

We use microcomputed data of teeth. Teeth are made of dentin and enamel which have different grey values. Enamel and dentin are segmented with a very conservative (narrow, not containing all greylevels) threshold to make separate stacks for background, dentin and enamel.

Then the masks are combined according to the projects needs. The thresholded images contain usually “0” for background and “255” for foreground. If you divide the thresholded images by 255 -> now the masked pixels have a value of 1. Multiply the stack with 2 (for dentin) and 3 (for enamel). The background, dentin and enamel stacks are combined into a new stack (= resulting “mask”) with ImageJ > Process > ImageCalculator and “xor”.

According to the “conventions” of this plugin you should always use the value “1” as the value for the background label as I will assign the value 1 to all slices which have less then 2 labels.

The new stack is called “label mask” and the seedpoints are generated from this stack.

The number of seedpoints will be adjusted to the minimum number of seeds within all labels. This means, if we have 3 masks with 100, 1000 and 10000 points per label, then 100 will be the number of labels, which will be used for SRG.

If one label has more than this minimum number of pixels, then the subset of this minimum number will be selected equally distributed within this longer list.

An new 8 bit stack results from the segmentation, which has the same labels as the label mask.

Hint

I suggest to filter the raw data to improve the outcome, for example a median filter with a 3x3 or 5x5 kernel.