public abstract class MTBTopologicalNumber extends Object
See
Han, X. and Xu, C. and Prince, J.L., A topology preserving level set method for geometric deformable models},
PAMI, pages 755-768, 2003
for definitions and notation.
Modifier and Type | Class and Description |
---|---|
private class |
MTBTopologicalNumber.PixelIndexIterator |
class |
MTBTopologicalNumber.PixelOffsetIterator |
static class |
MTBTopologicalNumber.Point3D
This class is used as a light weight 3D point implementation
|
Modifier and Type | Field and Description |
---|---|
protected ArrayList<MTBTopologicalNumber.Point3D>[] |
coordinatesNeighborNeighbors
For each neighbor in the neighborhood
this collection holds coordinates of all other pixels in the neighborhood
which are connected to the neighbor under consideration with regard the
the neighborhood definition.
|
protected ArrayList<MTBTopologicalNumber.Point3D>[][][] |
coordinatesNeighborNeighborsByCoord
As this array gives
for each neighbor in the neighborhood coordinates of its neighbors
(i.e. neighborneighbors).
|
protected MTBTopologicalNumber.Point3D[] |
coordinatesNeighbors
For each neighbor in the neighborhood
this gives their coordinates in a 3x3x3 array center around the
current pixel (of which the neighborhood is represented).
|
protected static boolean |
debug
debug flag
|
protected int |
dimension
Dimension of image
|
protected float |
maxDist
Maximal distance of points within the neighborhood to current pixel,
i.e. the pixel which neighborhood we are considering
|
protected ArrayList<MTBTopologicalNumber.Point3D>[] |
offsetsNeighborNeighbors
As for the neighbors this collection is in analogy to
coordinatesNeighborNeighbors
and gives for each neighborneighbor the offset instead of coordinates. |
protected MTBTopologicalNumber.Point3D[] |
offsetsNeighbors
In analogy to
coordinatesNeighbors this array hold the offsets of the neighbors. |
protected int |
sizeNeighborhood
The size of the neighborhood, i.e. numbers of pixels in the neighborhood
|
protected boolean[][][] |
X
8- or 26 neighbors of the current pixel
used to determine topological numbers represented as an 3x3x3 array center around
the current pixel.
|
Constructor and Description |
---|
MTBTopologicalNumber() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
computeN()
Derive N_n^k from X, see Han et al.
|
ArrayList<MTBTopologicalNumber.Point3D> |
getCoordinatesNeighborNeighbors(int z,
int y,
int x) |
float |
getMaxDist() |
int |
getSizeNeighborhood() |
protected boolean |
hasOneCC()
Checks if the neighborhood represented in X has exactly one connected
component of entries set to true using the neighborhood definition as
as represented in the neighborhood arrays of the class.
|
Iterator<MTBTopologicalNumber.Point3D> |
iterator()
Returns a iterator for the coordinatesNeighbors in the order as defined
|
Iterator<MTBTopologicalNumber.Point3D> |
iteratorOffsets()
Returns a iterator for the pixelOffsets in the order as defined
|
void |
print()
Print information of this class to stdout
|
abstract boolean |
topoNumberIsOne(int[][][] nbClasses3D,
int c)
Check if topological for the class
c is one in the
neighborhood nbClassess3D . |
boolean |
topoNumberIsOne(MTBSegmentationInterface segmentation,
int x,
int y,
int z,
int c)
Check if topological for the class
c is one in the
pixel with coordinate (x,y,z) in the segmentation object
segmentation . |
private void |
visitCC(int z,
int y,
int x)
Visit (x,y,z): reset the corresponding entry in X to false
and recursively visit all neighbors of (x,y,z) in X.
|
protected static boolean debug
protected int sizeNeighborhood
protected float maxDist
protected int dimension
protected MTBTopologicalNumber.Point3D[] coordinatesNeighbors
protected MTBTopologicalNumber.Point3D[] offsetsNeighbors
coordinatesNeighbors
this array hold the offsets of the neighbors.
Each offset may also be considered as the coordinates of a neighbor in a
a 3x3x3 array center around the
current pixel where
the coordinates of this current pixel are (0,0,0).
The order of neighbors within the array are the same as for coordinatesNeighbors
.
protected ArrayList<MTBTopologicalNumber.Point3D>[] coordinatesNeighborNeighbors
coordinatesNeighbors
while the order of neighborneighbors in the collection is arbitrary.protected ArrayList<MTBTopologicalNumber.Point3D>[][][] coordinatesNeighborNeighborsByCoord
coordinatesNeighbors
.protected ArrayList<MTBTopologicalNumber.Point3D>[] offsetsNeighborNeighbors
coordinatesNeighborNeighbors
and gives for each neighborneighbor the offset instead of coordinates.protected boolean[][][] X
nbClasses3D[z][y][x]
.
First it is assigned to the array X
of Han et al, i.e.:
An entry is true if class in neighborhood is equal to the class under consideration,
false otherwise.
Subsequently to the array N_n^k
And finally altered to compute number of components.
This array is recycled for efficiency.
public abstract boolean topoNumberIsOne(int[][][] nbClasses3D, int c)
c
is one in the
neighborhood nbClassess3D
. Specifically, all pixels in
nbClasses3D
with equal values to c
are considered as elements of X, the rest as not in X.
nbClassess3D
is a 3D volume of size 3x3x3
where the current pixel is located in the center, i.e. with coordinates (1,1,1).
Memory layout is nbClasses3D[z][y][x]
.
The values give the classes or phases to which the pixels belong to.
Neighborhood definitions are define in derived sub classes.
If this is a 2D neighborhood, only the z=0
slice of
nbClasses3D
will be considered and accessed.
public boolean topoNumberIsOne(MTBSegmentationInterface segmentation, int x, int y, int z, int c)
c
is one in the
pixel with coordinate (x,y,z)
in the segmentation object
segmentation
.
Specifically, all pixels in
neighborhood with equal values to c
are considered as elements of X, the rest as not in X.
Neighborhood definitions are define in derived sub classes.
If this segmentation is 2D a 2D topology is to be used
TODO: conceive how to handle invalid pixels
protected abstract void computeN()
protected boolean hasOneCC()
private void visitCC(int z, int y, int x)
public void print()
public Iterator<MTBTopologicalNumber.Point3D> iterator()
public Iterator<MTBTopologicalNumber.Point3D> iteratorOffsets()
public int getSizeNeighborhood()
public float getMaxDist()
public ArrayList<MTBTopologicalNumber.Point3D> getCoordinatesNeighborNeighbors(int z, int y, int x)
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.