Package inra.ijpb.watershed
Class MarkerControlledWatershedTransform2D
java.lang.Object
inra.ijpb.watershed.WatershedTransform2D
inra.ijpb.watershed.MarkerControlledWatershedTransform2D
public class MarkerControlledWatershedTransform2D extends WatershedTransform2D
Marker-controlled version of the watershed transform in 2D.
References:
[1] Fernand Meyer and Serge Beucher. "Morphological segmentation."
Journal of visual communication and image representation 1.1 (1990): 21-46.
[2] Peer Neubert and Peter Protzel. "Compact Watershed and Preemptive SLIC:
On improving trade-offs of superpixel segmentation algorithms."
22nd international conference on pattern recognition. IEEE, 2014.
- Author:
- Ignacio Arganda-Carreras
-
Constructor Summary
Constructors Constructor Description MarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask)
Initialize a marker-controlled watershed transformMarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, double compactness)
Initialize a marker-controlled watershed transform.MarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, int connectivity)
Initialize a marker-controlled watershed transformMarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, int connectivity, double compactness)
Initialize a marker-controlled watershed transform. -
Method Summary
Modifier and Type Method Description ij.process.ImageProcessor
applyWithPriorityQueue()
Apply watershed transform on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage.ij.process.ImageProcessor
applyWithPriorityQueueAndDams()
Apply watershed transform on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage (optionally).ij.process.ImageProcessor
applyWithSortedList()
Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.ij.process.ImageProcessor
applyWithSortedListAndDams()
Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.java.util.LinkedList<PixelRecord>
extractPixelValues(ij.process.ImageProcessor inputImage, ij.process.ImageProcessor markerImage, int[][] tabLabels)
Extract pixel values from input and labeled marker images.java.util.PriorityQueue<PixelRecord>
extractPixelValuesPriorityQueue(ij.process.ImageProcessor inputImage, ij.process.ImageProcessor seedImage, int[][] tabLabels)
Extract pixel values from input and seed imagesij.ImagePlus
getAnimationPriorityQueue()
Get animation of each h-step of the watershed transform on the inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage.ij.ImagePlus
getAnimationPriorityQueueAndDams()
Get an animation of the different steps of the watershed transform applied on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage (optionally).ij.ImagePlus
getAnimationSortedList()
Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.ij.ImagePlus
getAnimationSortedListAndDams()
Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.Methods inherited from class inra.ijpb.watershed.WatershedTransform2D
apply, apply, extractPixelValues, getAnimation, getConnectivity, setConnectivity, setVerbose
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MarkerControlledWatershedTransform2D
public MarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask)Initialize a marker-controlled watershed transform- Parameters:
input
- grayscale image (usually a gradient image)marker
- image containing the labeled markers to start the watershedmask
- binary mask to restrict the region of interest (null to use whole input image)
-
MarkerControlledWatershedTransform2D
public MarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, int connectivity)Initialize a marker-controlled watershed transform- Parameters:
input
- grayscale image (usually a gradient image)marker
- image containing the labeled markers to start the watershedmask
- binary mask to restrict the region of interest (null to use whole input image)connectivity
- pixel connectivity (4 or 8)
-
MarkerControlledWatershedTransform2D
public MarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, double compactness)Initialize a marker-controlled watershed transform. If the compactness constraint is larger than 0, the Compact Watershed algorithm will be executed (Peer Neubert and Peter Protzel. "Compact Watershed and Preemptive SLIC: On improving trade-offs of superpixel segmentation algorithms." 22nd international conference on pattern recognition. IEEE, 2014).- Parameters:
input
- grayscale image (usually a gradient image)marker
- image containing the labeled markers to start the watershedmask
- binary mask to restrict the region of interest (null to use whole input image)compactness
- compactness constrain parameter (values larger than 0 imply using compact watershed)
-
MarkerControlledWatershedTransform2D
public MarkerControlledWatershedTransform2D(ij.process.ImageProcessor input, ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, int connectivity, double compactness)Initialize a marker-controlled watershed transform. If the compactness constraint is larger than 0, the Compact Watershed algorithm will be executed (Peer Neubert and Peter Protzel. "Compact Watershed and Preemptive SLIC: On improving trade-offs of superpixel segmentation algorithms." 22nd international conference on pattern recognition. IEEE, 2014).- Parameters:
input
- grayscale image (usually a gradient image)marker
- image containing the labeled markers to start the watershedmask
- binary mask to restrict the region of interest (null to use whole input image)connectivity
- pixel connectivity (4 or 8)compactness
- compactness constrain parameter (values larger than 0 imply using compact watershed)
-
-
Method Details
-
applyWithSortedList
@Deprecated public ij.process.ImageProcessor applyWithSortedList()Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.Apply watershed transform on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage. This implementation visits all pixels by ascending gray value.- Returns:
- watershed domains image (no dams)
-
getAnimationSortedList
@Deprecated public ij.ImagePlus getAnimationSortedList()Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.Get animation of the different steps in the watershed transform on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage. This implementation visits all pixels by ascending gray value.- Returns:
- animation of watershed domains image (no dams)
-
applyWithSortedListAndDams
@Deprecated public ij.process.ImageProcessor applyWithSortedListAndDams()Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.Apply watershed transform on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage. This implementation visits all pixels by ascending gray value.- Returns:
- watershed domains image (with dams)
-
getAnimationSortedListAndDams
@Deprecated public ij.ImagePlus getAnimationSortedListAndDams()Deprecated.The algorithm with a sorted list does not visit the pixels based on their h value and proximity to markers so it is not a true watershed method.Get animation of the different steps in the watershed transform applied to the inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage. This implementation visits all pixels by ascending gray value.- Returns:
- image stack with the steps of the watershed transform (with dams)
-
applyWithPriorityQueue
public ij.process.ImageProcessor applyWithPriorityQueue()Apply watershed transform on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage. This implementation visits first the pixels on the surroundings of the labeled markers.- Returns:
- watershed domains image (no dams)
-
getAnimationPriorityQueue
public ij.ImagePlus getAnimationPriorityQueue()Get animation of each h-step of the watershed transform on the inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage. This implementation visits first the pixels on the surroundings of the labeled markers.- Returns:
- animation of the watershed domains image (no dams)
-
getAnimationPriorityQueueAndDams
public ij.ImagePlus getAnimationPriorityQueueAndDams()Get an animation of the different steps of the watershed transform applied on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage (optionally). This implementation uses a priority queue to visit first the pixels on the surroundings of the labeled markers (Meyer's flooding algorithm). Meyer's flooding algorithm: Label the regional minima with different colors Repeat | Select a pixel p, not colored, not watershed, | adjacent to some colored pixels, | and having the lowest possible gray level | If p is adjacent to exactly one color then | label p with this color | If p is adjacent to more than one color then | label p as watershed Until no such pixel exists More information at - Serge Beucher's site: http://cmm.ensmp.fr/~beucher/wtshed.html - G. Bertrand's Topological Watershed site: http://www.esiee.fr/~info/tw/index.html- Returns:
- animation stack with watershed domains by each h level (with dams)
-
applyWithPriorityQueueAndDams
public ij.process.ImageProcessor applyWithPriorityQueueAndDams()Apply watershed transform on inputImage, using the labeled markers from markerImage and restricted to the white areas of maskImage (optionally). This implementation uses a priority queue to visit first the pixels on the surroundings of the labeled markers (Meyer's flooding algorithm). Meyer's flooding algorithm: Label the regional minima with different colors Repeat | Select a pixel p, not colored, not watershed, | adjacent to some colored pixels, | and having the lowest possible gray level | If p is adjacent to exactly one color then | label p with this color | If p is adjacent to more than one color then | label p as watershed Until no such pixel exists More information at - Serge Beucher's site: http://cmm.ensmp.fr/~beucher/wtshed.html - G. Bertrand's Topological Watershed site: http://www.esiee.fr/~info/tw/index.html- Returns:
- watershed domains image (with dams)
-
extractPixelValuesPriorityQueue
public java.util.PriorityQueue<PixelRecord> extractPixelValuesPriorityQueue(ij.process.ImageProcessor inputImage, ij.process.ImageProcessor seedImage, int[][] tabLabels)Extract pixel values from input and seed images- Parameters:
inputImage
- input image (2D)seedImage
- seed image (2D)tabLabels
- output label array- Returns:
- priority queue of pixels neighboring the seeds
-
extractPixelValues
public java.util.LinkedList<PixelRecord> extractPixelValues(ij.process.ImageProcessor inputImage, ij.process.ImageProcessor markerImage, int[][] tabLabels)Extract pixel values from input and labeled marker images. The input grayscale values will be return in a list of PixelRecord and the markers will be stored intabLabels
.- Parameters:
inputImage
- input grayscale image (usually a gradient image)markerImage
- labeled marker imagetabLabels
- output label array- Returns:
- list of input pixel values
-