public class MTBLevelsetFunctionPDE extends MTBLevelsetFunctionDerivable implements Cloneable
The representation includes two classes with labels 0 and 1. Label 0 refers to the background including all pixels in the level set function's domain where the value of the function is smaller than zero. Class 1, i.e. the foreground phase of the level set function, is linked to all pixels in the domain with function values larger than zero.
The levelset function can be transformed into a signed-distance function.
| Modifier and Type | Class and Description |
|---|---|
protected class |
MTBLevelsetFunctionPDE.SortedList<EType>
A genric class representing a sorted list
|
protected class |
MTBLevelsetFunctionPDE.SortedListElement<EType>
internal representation of elements
|
MTBSegmentationInterface.SegmentationDimension| Modifier and Type | Field and Description |
|---|---|
protected int |
borderDist
Safety distance along image borders.
|
private boolean |
DEFAULT_FALL_BACK |
protected int |
depth
Depth of the input image and levelset function.
|
protected int |
height
Height of the input image and levelset function.
|
private double[][] |
helperArray
2D array of first two levelset dimension used for visualization
|
static double |
MAX_VALUE
Constant used in SDF calculations.
|
protected ArrayList<MTBPoint3D> |
narrow
Pixels in narrow-band.
|
protected double[][][] |
phi
The level set function.
|
protected HashMap<MTBPoint3D,MTBPoint3D> |
predecessors
Map of precursors on contour for each pixel in narrow-band.
|
protected boolean[][][] |
visible
Visibility array.
|
protected int |
width
Width of the input image and levelset function.
|
| Constructor and Description |
|---|
MTBLevelsetFunctionPDE(boolean nb_diag,
int w,
int h,
int d)
create a new levelsetfunction, setting a default handle for derivations
on borders
|
MTBLevelsetFunctionPDE(boolean nb_diag,
int w,
int h,
int d,
boolean default_fallback)
create a new levelsetfunction, setting a default handle for derivations
on borders
|
MTBLevelsetFunctionPDE(int w,
int h,
int d)
Create a new levelset function.
|
MTBLevelsetFunctionPDE(int w,
int h,
int d,
boolean default_fallback)
create a new levelsetfunction, setting a default handle for derivations
on borders
|
MTBLevelsetFunctionPDE(int w,
int h,
int d,
int border)
Constructor to init empty function with safety border.
|
MTBLevelsetFunctionPDE(int w,
int h,
int d,
MTBSegmentationInterface seg,
boolean default_fallback)
Constructor to build a level set function from a segmentation object.
|
MTBLevelsetFunctionPDE(int w,
int h,
int d,
MTBSegmentationInterface seg,
boolean default_fallback,
int border)
Constructor to build a level set function from a segmentation object.
|
| Modifier and Type | Method and Description |
|---|---|
double |
backwardDifferencing_X(int x,
int y,
int z)
retrieve x-derivation at nearest contourpoint to ( x, y, z ), calculated by backward euler method
|
double |
backwardDifferencing_X(int x,
int y,
int z,
boolean fallback)
retrieve x-derivation at nearest contourpoint to ( x, y, z ), calculated by backward euler
method, explicit define fallback-strategy
|
double |
backwardDifferencing_Y(int x,
int y,
int z)
retrieve x-derivation at nearest contourpoint to ( x, y, z ), calculated by backward euler method
|
double |
backwardDifferencing_Y(int x,
int y,
int z,
boolean fallback)
retrieve y-derivation at nearest contourpoint to ( x, y, z ), calculated by backward euler
method, explicit define fallback-strategy
|
double |
backwardDifferencing_Z(int x,
int y,
int z)
retrieve x-derivation at nearest contourpoint to ( x, y, z ), calculated by backward euler method
|
double |
backwardDifferencing_Z(int x,
int y,
int z,
boolean fallback)
retrieve z-derivation at nearest contourpoint to ( x, y, z ), calculated by backward euler
method, explicit define fallback-strategy
|
MTBLevelsetFunctionPDE |
clone()
generate a clone of this object
|
void |
copyTo(MTBLevelsetFunctionPDE two)
copy this object to another one
|
boolean |
equals(MTBLevelsetFunctionPDE ls2d)
are these two LevelSets equal?
|
double |
forwardDifferencing_X(int x,
int y,
int z,
boolean fallback)
retrieve x-derivation at nearest contourpoint to ( x, y, z ), calculated by forward euler method,
explicit define fallback-strategy
|
double |
forwardDifferencing_Y(int x,
int y,
int z,
boolean fallback)
retrieve y-derivation at nearest contourpoint to ( x, y, z ), calculated by forward euler method,
explicit define fallback-strategy
|
double |
forwardDifferencing_Z(int x,
int y,
int z,
boolean fallback)
retrieve z-derivation at nearest contourpoint to ( x, y, z ), calculated by forward euler method,
explicit define fallback-strategy
|
double |
get(int x,
int y,
int z)
get the value of this function at the position of the predecessor of ( x, y, z )
|
MTBImageByte |
getBinaryMask()
Get a binary mask of the represented segmentation.
|
int |
getClass(int x,
int y)
Returns the class label of position (x,y).
|
int |
getClass(int x,
int y,
int z)
Returns the class label of position (x,y,z).
|
double |
getCurvature(int x,
int y,
int z)
compute the curvature at at nearest contourpoint to (x,y,z)
if x or y are not in the boundaries it returns 0
if z is not in the boundaries it returns the 2d cuvature
|
double |
getDerivativeX(int x,
int y,
int z)
retrieve x-derivation at nearest contourpoint to ( x, y, z ), calculated by forward euler method
|
double |
getDerivativeXX(int x,
int y,
int z)
computes the the derivation in x direction 2 times at nearest contourpoint to (x,y,z)
|
double |
getDerivativeXY(int x,
int y,
int z)
computes the the derivation in x and y direction at nearest contourpoint to (x,y,z)
|
double |
getDerivativeXZ(int x,
int y,
int z)
computes the the derivation in x and z direction at nearest contourpoint to (x,y,z)
|
double |
getDerivativeY(int x,
int y,
int z)
retrieve y-derivation at nearest contourpoint to ( x, y, z ), calculated by forward euler method
|
double |
getDerivativeYY(int x,
int y,
int z)
computes the the derivation in y direction 2 times at nearest contourpoint to (x,y,z)
|
double |
getDerivativeYZ(int x,
int y,
int z)
computes the the derivation in y and z direction at nearest contourpoint to (x,y,z)
|
double |
getDerivativeZ(int x,
int y,
int z)
retrieve z-derivation at nearest contourpoint to ( x, y, z ), calculated by forward euler method
|
double |
getDerivativeZZ(int x,
int y,
int z)
computes the the derivation in z direction 2 times at nearest contourpoint to (x,y,z)
|
MTBSegmentationInterface.SegmentationDimension |
getDimension()
Returns the dimension of the segmentation.
|
double |
getForegroundSum() |
MTBImage |
getMask(int class_)
Gets the mask of the specified class (0 Background, 255 Foreground)
|
int |
getMaxLabel()
Returns the maximal label used in the segmentation representation.
|
Iterator<MTBPoint3D> |
getNarrowIterator()
get an iterator through narrow band
|
int |
getNumberOfClasses()
Returns the number of classes represented by the segmentation.
|
MTBImageRGB |
getPhiColorImage2D(MTBImageRGB targetImg)
Get visualization of current level set function in red-blue color map.
|
MTBImageShort |
getPhiImage()
Get visualization of current level set function.
|
MTBPoint3D |
getPredecessorOnContour(int x,
int y,
int z)
gets the value of the nearest contourpoint to point (x,y,z)
|
int |
getSizeX()
Get width of level set function.
|
int |
getSizeY()
Get height of level set function.
|
int |
getSizeZ()
Get depth of level set function.
|
double |
getWeight(int x,
int y)
Returns the pixel weight of position (x,y).
|
double |
getWeight(int x,
int y,
int z)
Returns the pixel weight of position (x,y,z).
|
boolean |
isVisible(int x,
int y)
True, if position (x,y) is visible.
|
boolean |
isVisible(int x,
int y,
int z)
is this pixel visible?
|
void |
set(int x,
int y,
int z,
double value)
assign a value to the matrix at position ( x, y, z )
|
void |
setClass(int x,
int y,
int c)
Deprecated.
|
void |
setClass(int x,
int y,
int z,
int c)
Deprecated.
|
void |
setInvisible(int x,
int y)
Set position (x,y) invisible.
|
void |
setInvisible(int x,
int y,
int z)
Set position (x,y,z) invisible.
|
boolean |
setVisible(boolean[][][] mask)
Set visibility of positions.
|
void |
setVisible(int x,
int y)
Set position (x,y) visible.
|
void |
setVisible(int x,
int y,
int z)
Set position (x,y,z) visible.
|
void |
setWeight(int x,
int y,
double c)
Sets the pixel weight of position (x,y) to c.
|
void |
setWeight(int x,
int y,
int z,
double c)
Sets the pixel weight of position (x,y,z) to c.
|
private double |
sgnSum(int x,
int y,
int z)
Computes scaled sign in neighborhood.
|
void |
signDistance(double b)
Transform function into signed distance function.
|
private void |
signedExpandation(MTBLevelsetFunctionPDE.SortedList<MTBPoint3D> slist,
double maximum,
double toAdd)
Expand signed distances around zero-level.
|
boolean |
valid(int x,
int y,
int z)
is this pixel valid?
|
nearZero, sgnpublic static final double MAX_VALUE
protected double[][][] phi
protected boolean[][][] visible
protected int height
protected int width
protected int depth
protected int borderDist
Pixels closer to border than this distance are ignored in calculations.
protected ArrayList<MTBPoint3D> narrow
The array is updated on transforming the function into a SDF.
protected HashMap<MTBPoint3D,MTBPoint3D> predecessors
The map is updated on transforming the function into a SDF.
private double[][] helperArray
private boolean DEFAULT_FALL_BACK
public MTBLevelsetFunctionPDE(int w,
int h,
int d)
The default handle for calculations of derivatives along borders is set to fall back to other methods to calculate the derivatives.
w - Width of function.h - Height of function.d - Depth of function.public MTBLevelsetFunctionPDE(int w,
int h,
int d,
int border)
w - Width of levelset function (x-size).h - Height of levelset function (y-size).d - Depth of levelset function (z-size).border - Width of border to ignore in calculations.public MTBLevelsetFunctionPDE(int w,
int h,
int d,
boolean default_fallback)
w - length of functionh - height of functiond - depth of functiondefault_fallback - default strategy for border, true -> fall back,
false -> cancel with NaNpublic MTBLevelsetFunctionPDE(boolean nb_diag,
int w,
int h,
int d)
width - length of functionheight - height of functiondepth - depth of function
false -> cancel with NaNpublic MTBLevelsetFunctionPDE(boolean nb_diag,
int w,
int h,
int d,
boolean default_fallback)
width - length of functionheight - height of functiondepth - depth of functiondefault_fallback - default strategy for border, true -> fall back,
false -> cancel with NaNpublic MTBLevelsetFunctionPDE(int w,
int h,
int d,
MTBSegmentationInterface seg,
boolean default_fallback)
The level set function is initialized with value -1 for the background and +1 for the foreground. Note that the size of the given segmentation is allowed to differ from the target size of the function. Positions being undefined in the segmentation are assigned to the background class.
w - Target width of the level set function domain.h - Target height of the level set function domain.d - Target depth of the level set function domain.seg - Initial segmentation.default_fallback - public MTBLevelsetFunctionPDE(int w,
int h,
int d,
MTBSegmentationInterface seg,
boolean default_fallback,
int border)
The level set function is initialized with value -1 for the background and +1 for the foreground. Note that the size of the given segmentation is allowed to differ from the target size of the function. Positions being undefined in the segmentation are assigned to the background class.
w - Target width of the level set function domain.h - Target height of the level set function domain.d - Target depth of the level set function domain.seg - Initial segmentation.default_fallback - border - Width of border to be ignored.public boolean setVisible(boolean[][][] mask)
mask - Visibility mask.public double get(int x,
int y,
int z)
get in class MTBLevelsetFunctionDerivablex - position x in matrixy - position y in matrixz - position z in matrixpublic MTBPoint3D getPredecessorOnContour(int x, int y, int z)
x - y - z - public void set(int x,
int y,
int z,
double value)
x - position x in matrixy - position y in matrixz - position z in matrixvalue - value to save an this positionpublic int getSizeX()
getSizeX in interface MTBSegmentationInterfacepublic int getSizeY()
getSizeY in interface MTBSegmentationInterfacepublic int getSizeZ()
getSizeZ in interface MTBSegmentationInterfacepublic double getDerivativeX(int x,
int y,
int z)
getDerivativeX in class MTBLevelsetFunctionDerivablex - position x in matrixy - position y in matrixz - position z in matrixpublic double getDerivativeY(int x,
int y,
int z)
getDerivativeY in class MTBLevelsetFunctionDerivablex - position x in matrixy - position y in matrixz - position z in matrixpublic double getDerivativeZ(int x,
int y,
int z)
getDerivativeZ in class MTBLevelsetFunctionDerivablex - position x in matrixy - position y in matrixz - position z in matrixpublic double forwardDifferencing_X(int x,
int y,
int z,
boolean fallback)
x - position x in matrixy - position y in matrixz - position z in matrixfallback - fall back to other methods at border?public double forwardDifferencing_Y(int x,
int y,
int z,
boolean fallback)
x - position x in matrixy - position y in matrixz - position z in matrixfallback - fall back to other methods at border?public double forwardDifferencing_Z(int x,
int y,
int z,
boolean fallback)
x - position x in matrixy - position y in matrixz - position z in matrixfallback - fall back to other methods at border?public double backwardDifferencing_X(int x,
int y,
int z)
x - position x in matrixy - position y in matrixz - position z in matrixpublic double backwardDifferencing_Y(int x,
int y,
int z)
x - position x in matrixy - position y in matrixz - position z in matrixpublic double backwardDifferencing_Z(int x,
int y,
int z)
x - position x in matrixy - position y in matrixz - position z in matrixpublic double backwardDifferencing_X(int x,
int y,
int z,
boolean fallback)
x - position x in matrixy - position y in matrixz - position z in matrixfallback - fall back to other methods at border?public double backwardDifferencing_Y(int x,
int y,
int z,
boolean fallback)
x - position x in matrixy - position y in matrixz - position z in matrixfallback - fall back to other methods at border?public double backwardDifferencing_Z(int x,
int y,
int z,
boolean fallback)
x - position x in matrixy - position y in matrixz - position z in matrixfallback - fall back to other methods at border?public double getDerivativeXX(int x,
int y,
int z)
getDerivativeXX in class MTBLevelsetFunctionDerivablex - y - z - public double getDerivativeYY(int x,
int y,
int z)
getDerivativeYY in class MTBLevelsetFunctionDerivablex - y - z - public double getDerivativeZZ(int x,
int y,
int z)
getDerivativeZZ in class MTBLevelsetFunctionDerivablex - y - z - public double getDerivativeXY(int x,
int y,
int z)
getDerivativeXY in class MTBLevelsetFunctionDerivablex - y - z - public double getDerivativeXZ(int x,
int y,
int z)
getDerivativeXZ in class MTBLevelsetFunctionDerivablex - y - z - public double getDerivativeYZ(int x,
int y,
int z)
getDerivativeYZ in class MTBLevelsetFunctionDerivablex - y - z - public double getCurvature(int x,
int y,
int z)
getCurvature in class MTBLevelsetFunctionDerivablex - x coordinatey - y coordinatez - z coordinatepublic boolean valid(int x,
int y,
int z)
valid in class MTBLevelsetFunctionDerivablex - x coordinatey - y coordinatez - z coordinatepublic boolean isVisible(int x,
int y,
int z)
isVisible in interface MTBSegmentationInterfacex - x coordinatey - y coordinatez - z coordinatepublic void signDistance(double b)
The transformation can be restricted to a narrow-band around the zero level by setting the width parameter to a value larger or equal to one.
b - Width of narrow-band around zero level.private void signedExpandation(MTBLevelsetFunctionPDE.SortedList<MTBPoint3D> slist, double maximum, double toAdd)
Helper function for method signDistance.
slist - Dynamic sorted list of points to expand.maximum - Maximal distance value, just for narrow-band.toAdd - Value to add to next level value, usually 1.private double sgnSum(int x,
int y,
int z)
x - x coord of point.y - y coord of point.z - z coord of point.public MTBLevelsetFunctionPDE clone()
public void copyTo(MTBLevelsetFunctionPDE two)
public boolean equals(MTBLevelsetFunctionPDE ls2d)
ls2d - LevelSet to checkpublic Iterator<MTBPoint3D> getNarrowIterator()
public MTBImageByte getBinaryMask()
public MTBImageRGB getPhiColorImage2D(MTBImageRGB targetImg)
This function only considers the first dimension in z.
public MTBImageShort getPhiImage()
public double getForegroundSum()
public MTBSegmentationInterface.SegmentationDimension getDimension()
MTBSegmentationInterfacegetDimension in interface MTBSegmentationInterfacepublic int getNumberOfClasses()
MTBSegmentationInterfacegetNumberOfClasses in interface MTBSegmentationInterfacepublic int getMaxLabel()
MTBSegmentationInterfaceNote that the maximal label is not required to coincide with the number of classes represented by the segmentation. Labels should usually, but do not necessarily need to be positive.
getMaxLabel in interface MTBSegmentationInterfacepublic boolean isVisible(int x,
int y)
MTBSegmentationInterfaceisVisible in interface MTBSegmentationInterfacepublic void setVisible(int x,
int y)
MTBSegmentationInterfacesetVisible in interface MTBSegmentationInterfacepublic void setVisible(int x,
int y,
int z)
MTBSegmentationInterfacesetVisible in interface MTBSegmentationInterfacepublic void setInvisible(int x,
int y)
MTBSegmentationInterfacesetInvisible in interface MTBSegmentationInterfacepublic void setInvisible(int x,
int y,
int z)
MTBSegmentationInterfacesetInvisible in interface MTBSegmentationInterfacepublic int getClass(int x,
int y)
MTBSegmentationInterfacegetClass in interface MTBSegmentationInterfacepublic int getClass(int x,
int y,
int z)
MTBSegmentationInterfacegetClass in interface MTBSegmentationInterface@Deprecated public void setClass(int x, int y, int c)
MTBSegmentationInterfacesetClass in interface MTBSegmentationInterface@Deprecated public void setClass(int x, int y, int z, int c)
MTBSegmentationInterfacesetClass in interface MTBSegmentationInterfacepublic double getWeight(int x,
int y)
MTBSegmentationInterfacegetWeight in interface MTBSegmentationInterfacepublic double getWeight(int x,
int y,
int z)
MTBSegmentationInterfacegetWeight in interface MTBSegmentationInterfacepublic void setWeight(int x,
int y,
double c)
MTBSegmentationInterfacesetWeight in interface MTBSegmentationInterfacepublic void setWeight(int x,
int y,
int z,
double c)
MTBSegmentationInterfacesetWeight in interface MTBSegmentationInterfacepublic MTBImage getMask(int class_)
MTBSegmentationInterfacegetMask in interface MTBSegmentationInterfaceCopyright © 2010–2025 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.