public class RegionAdjacencyGraph extends Object
Contains several methods for extracting the set of adjacencies between regions in a label image.
The value zero is assumed to be background, and is not computed for adjacencies. Moreover, in order to take into account label images obtained after a watershed transform, adjacencies are computed by comparing label values with the values of neighbors shifted by two pixels in the X, Y or Z directions.
Usage:
 // create demo image with four regions, and four adjacencies 
 byte[] data = new byte[]{
 			1, 1, 1, 0, 2, 2, 
 			1, 1, 1, 0, 2, 2, 
 			0, 0, 0, 0, 2, 2, 
 			3, 3, 0, 0, 0, 0,  
 			3, 3, 0, 4, 4, 4,  
 			3, 3, 0, 4, 4, 4};
 ImageProcessor image = new ByteProcessor(6, 6, data);
 	
 // compute adjacencies, and return result as a set of label pairs
 Set<RegionAdjacencyGraph.LabelPair> adjacencies =
     RegionAdjacencyGraph.computeAdjacencies(image);
 
 // display which regions are adjacent 
 for (RegionAdjacencyGraph.LabelPair pair : adjacencies)
 {
     System.out.println("(" + pair.label1 + "," + pair.label2 + ")");
 }
 | Modifier and Type | Class and Description | 
|---|---|
static class  | 
RegionAdjacencyGraph.LabelPair
Used to stores the adjacency information between two regions. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static Set<RegionAdjacencyGraph.LabelPair> | 
computeAdjacencies(ij.ImagePlus image)
Returns the set of region adjacencies in an ImagePlus, that can contains
 either an ImageProcessor or an ImageStack. 
 | 
static Set<RegionAdjacencyGraph.LabelPair> | 
computeAdjacencies(ij.process.ImageProcessor image)
Returns the set of region adjacencies in an ImageProcessor of labels. 
 | 
static Set<RegionAdjacencyGraph.LabelPair> | 
computeAdjacencies(ij.ImageStack image)
Returns the set of region adjacencies in an ImageProcessor of labels. 
 | 
public static final Set<RegionAdjacencyGraph.LabelPair> computeAdjacencies(ij.ImagePlus image)
image - an ImagePlus containing a 2D or 3D label imagepublic static final Set<RegionAdjacencyGraph.LabelPair> computeAdjacencies(ij.process.ImageProcessor image)
image - an ImageProcesor containing a label imagepublic static final Set<RegionAdjacencyGraph.LabelPair> computeAdjacencies(ij.ImageStack image)
image - an ImageProcesor containing a label imageCopyright © 2014–2023 INRA-IJPB Modeling and Digital Imaging lab. All rights reserved.