de.unihalle.informatik.MiToBo.segmentation.snakes.datatypes
Class MTBSnake

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDData
      extended by de.unihalle.informatik.MiToBo.core.datatypes.MTBPolygon2D
          extended by de.unihalle.informatik.MiToBo.segmentation.snakes.datatypes.MTBSnake
All Implemented Interfaces:
MTBSegmentationInterface, java.lang.Cloneable

@ALDDerivedClass
public class MTBSnake
extends MTBPolygon2D
implements MTBSegmentationInterface

Active Contour (Snake) datatype.

The snake is implemented with its control points and a large variety of convenience methods for using the snakes, e.g., methods to plot the snake to an image. A snake can be open or closed. In the latter case it also has an orientation, i.e., the snake points are ordered clockwise or counter-clockwise.

The snake interior is always located left of the snake segments. In case of a closed snake in counter-clockwise ordering the area enclosed by the snake polygon is defined as its interior. In case of counter-clockwise ordering the enclosed region is the exterior part of the domain or the background, respectively.

The snake datatype implements the MTBSegmentationInterface, i.e., allows for querying if certain pixels belong to foreground/interior or background/exterior. Note that the interior or foreground class is always labeled with 1, the background or exterior region always with 0.

Author:
misiak, moeller

Nested Class Summary
private  class MTBSnake.SnakeCloner
          Operator class to construct new snake object from a given one.
 
Nested classes/interfaces inherited from interface de.unihalle.informatik.MiToBo.segmentation.basics.MTBSegmentationInterface
MTBSegmentationInterface.SegmentationDimension
 
Field Summary
protected  int[][] classmap
          2D map marking the region enclosed by the snake.
private  int labelInside
          Marker for label of enclosed area.
protected  int mapHeight
          Height of class/visibility maps.
protected  int mapMaxX
          Maximal x coordinate of class/visibility maps.
protected  int mapMaxY
          Maximal y coordinate of class/visibility maps.
protected  int mapMinX
          Minimal x coordinate of class/visibility maps.
protected  int mapMinY
          Minimal y coordinate of class/visibility maps.
protected  int mapWidth
          Width of class/visibility maps.
private  double scaleFactor
          Scale factor of the snake for normalization.
protected  boolean segmentationUpToDate
          Flag indicating if the classmap fits the current snake.
protected  boolean[][] visiblemap
          Visibility map for hiding individual pixels.
 
Fields inherited from class de.unihalle.informatik.MiToBo.core.datatypes.MTBPolygon2D
isClosed, points
 
Constructor Summary
MTBSnake()
          Standard constructor to create a new and empty snake object.
MTBSnake(java.util.Vector<MTBSnakePoint2D> spoints, boolean cycle)
          Constructor to create a new Snake object.
MTBSnake(java.util.Vector<MTBSnakePoint2D> spoints, boolean cycle, double scale, boolean isScaled)
          Constructor to create a new Snake object.
 
Method Summary
 void addPoint(double x, double y)
          Overwrites Polygon2D method.
private  void calcDefaultDomain()
          Calculates snake bounding box (in non-normalized coordinates!).
 MTBSnake clone()
          Override java.lang.Object.clone() to create and return a copy of this object.
static MTBSnake convertContourToSnake(MTBContour2D contour)
          Converts a contour into a snake.
static MTBPolygon2DSet convertRegionsToSnakes(MTBImage image)
          Converts the regions of a label/binary image into a set of snakes.
static MTBSnake convertRegionToSnake(MTBRegion2D region)
          Converts a region into a snake.
 void denormalize()
          Denormalizes the snake coordinates.
 void drawPolygon(MTBImage img, int color)
          Draw snake into an image.
 void drawPolygonPoints(MTBImage img, int color, int mode)
          Draw snake points into an image (as crosses).
 int[][] getBinaryMask(int w, int h)
          Generates binary mask for inside part of the snake.
private  int[][] getBinaryMask(int w, int h, int xoff, int yoff)
          Generates binary mask for inside part of the snake.
 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 getCOMx()
          Returns the center of mass of the snake in x-direction.
 double getCOMy()
          Returns the center of mass of the snake in y-direction.
 MTBSegmentationInterface.SegmentationDimension getDimension()
          Returns the dimension of the given membership.
 int getMaxLabel()
          Returns the maximal label used in the membership representation.
 int getNumberOfClasses()
          Returns the number of classes represented in the membership.
 double getPartialDiffX(int position)
          Get approximation of partial derivative in x-direction at point with given index.
 double getPartialDiffY(int position)
          Get approximation of partial derivative in y-direction at point with given index.
 double getScaleFactor()
          Get the scaling factor of the snake.
 int getSizeX()
          Returns the size of the segmentation domain in x direction.
 int getSizeY()
          Returns the size of the segmentation domain in y direction.
 int getSizeZ()
          Returns the size of the segmentation domain in z direction.
 java.util.Vector<MTBSnakePoint2D> getSnakePoints()
          Get snake points as vector of SnakePoint2D objects.
 double getSndPartialDiffX(int position)
          Get approximation of 2nd order partial derivative in x-direction.
 double getSndPartialDiffY(int position)
          Get approximation of 2nd order partial derivative in y-direction.
 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).
 int getXMaxCoordinate()
          Returns maximal x coordinate represented in class/visibility maps.
 int getXMinCoordinate()
          Returns minimal x coordinate represented in class/visibility maps.
 int getYMaxCoordinate()
          Returns maximal y coordinate represented in class/visibility maps.
 int getYMinCoordinate()
          Returns minimal y coordinate represented in class/visibility maps.
 boolean isVisible(int x, int y)
          True, if position (x,y) is visible.
 boolean isVisible(int x, int y, int z)
          True, if position (x,y,z) is visible.
 void jni_makePolySimple()
          JNI method for eliminating loops in polygons.
 void normalize(double scale)
          Normalizes the snake coordinates.
 void printPoints()
          Prints points of snake to standard output stream.
 void resample(double segLength)
           Method to re-sample the line segments of the snake in a range of a given segment length.
 void reversePolypoints()
          Overwrite reversePolypoints method of Polygon2D.
 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.
 void setPoints(java.util.Vector<java.awt.geom.Point2D.Double> ps)
          Overwrite Polygon2D method to set all points of the snake from the specified point vector object.
 void setSegmentationDomain(int xmin, int xmax, int ymin, int ymax)
          Specify the domain of the underlying segmentation.
 void setSnakePoints(java.util.Vector<MTBSnakePoint2D> ps)
          Set all points of the snake from the specified SnakePoint2D vector object.
 void setValidmask(boolean[][] mask)
          Set the valid mask from external mask data.
 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.
 void shift(double shift, int imageSizeX, int imageSizeY)
          Method to shift the whole snake outward (positive value) ore inward (negative value) to its normal vector from every line segment.
 MTBImage toMTBImage(java.lang.String file, MTBImage img)
          Method to draw and save the snake in a given MTBImage.
 MTBImageByte toMTBImageByte(java.lang.String file, int w, int h)
          Method to draw and save the snake in a binary image.
private  void updateIDs(java.util.Vector<MTBSnakePoint2D> newPoints)
          Update method for snake point ID's after make snake simple.
private  void updateSnakeSegmentation()
          Convenience function for updating the segmentation.
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.datatypes.MTBPolygon2D
contains, drawPolygon, drawPolygonPoints, getBoundingBox, getLength, getPointNum, getPoints, getPolygon, getSignedArea, isClosed, isSimple, isSortedCounterClockwise, jni_containsPoint, jni_isClockwiseOriented, jni_isConvex, jni_isCounterClockwiseOriented, jni_isSimple, jni_orientation, setClosed, setOpen, simplify, standardization
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDData
cloneProperties, getLocation, getProperty, getPropertyKeys, print, setLocation, setProperty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classmap

protected int[][] classmap
2D map marking the region enclosed by the snake.

Note that the enclosed region contains always values of 1, independent of the order of the snake. The getClass()-methods take care of returning correct class labels.


labelInside

private int labelInside
Marker for label of enclosed area.


mapHeight

protected int mapHeight
Height of class/visibility maps.


mapMaxX

protected int mapMaxX
Maximal x coordinate of class/visibility maps.


mapMaxY

protected int mapMaxY
Maximal y coordinate of class/visibility maps.


mapMinX

protected int mapMinX
Minimal x coordinate of class/visibility maps.


mapMinY

protected int mapMinY
Minimal y coordinate of class/visibility maps.


mapWidth

protected int mapWidth
Width of class/visibility maps.


scaleFactor

private double scaleFactor
Scale factor of the snake for normalization.


segmentationUpToDate

protected boolean segmentationUpToDate
Flag indicating if the classmap fits the current snake.


visiblemap

protected boolean[][] visiblemap
Visibility map for hiding individual pixels.

Constructor Detail

MTBSnake

public MTBSnake()
Standard constructor to create a new and empty snake object.


MTBSnake

public MTBSnake(java.util.Vector<MTBSnakePoint2D> spoints,
                boolean cycle)
Constructor to create a new Snake object.

Parameters:
spoints - vector of 2D snake points as control points for the snake
cycle - true if snake forms a closed polygon

MTBSnake

public MTBSnake(java.util.Vector<MTBSnakePoint2D> spoints,
                boolean cycle,
                double scale,
                boolean isScaled)
Constructor to create a new Snake object.

Parameters:
spoints - vector of 2D snake points as control points for the snake
cycle - true if snake forms a closed polygon
scale - scaling factor
isScaled - true if snake is already scaled
Method Detail

addPoint

public void addPoint(double x,
                     double y)
Overwrites Polygon2D method. Appends a new point to the end of the snake. Old position of the point is set to -1 by default.

Overrides:
addPoint in class MTBPolygon2D
Parameters:
x - Point x coordinate.
y - Point y coordinate.

calcDefaultDomain

private void calcDefaultDomain()
Calculates snake bounding box (in non-normalized coordinates!).


clone

public MTBSnake clone()
Override java.lang.Object.clone() to create and return a copy of this object.

Overrides:
clone in class MTBPolygon2D
Throws:
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

convertContourToSnake

public static MTBSnake convertContourToSnake(MTBContour2D contour)
                                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                             de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Converts a contour into a snake.

Parameters:
contour - Incoming contour.
Returns:
Snake object.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

convertRegionsToSnakes

public static MTBPolygon2DSet convertRegionsToSnakes(MTBImage image)
                                              throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                                     de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Converts the regions of a label/binary image into a set of snakes.

Parameters:
image - Incoming image.
Returns:
Resulting snake objects.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

convertRegionToSnake

public static MTBSnake convertRegionToSnake(MTBRegion2D region)
                                     throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                            de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Converts a region into a snake.

Parameters:
region - Incoming region.
Returns:
Resulting snake object.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

denormalize

public void denormalize()
Denormalizes the snake coordinates.

The internally stored scale factor is used for the denormalization and subsequently set to 1.0.


drawPolygon

public void drawPolygon(MTBImage img,
                        int color)
Draw snake into an image.

Overrides:
drawPolygon in class MTBPolygon2D
Parameters:
img - Image where to draw the polygon into.

drawPolygonPoints

public void drawPolygonPoints(MTBImage img,
                              int color,
                              int mode)
Draw snake points into an image (as crosses).

Overrides:
drawPolygonPoints in class MTBPolygon2D
Parameters:
img - Image where to draw the polygon points into.
color - Color to be used.
mode - Shape of points to be applied.

getBinaryMask

public int[][] getBinaryMask(int w,
                             int h)
Generates binary mask for inside part of the snake.

The area enclosed by the snake will be painted in white. Note that the coordinates of the mask start with (0,0).

Overrides:
getBinaryMask in class MTBPolygon2D
Parameters:
w -
h -
Returns:
Binary mask, 0= outside / 1=inside
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getBinaryMask

private int[][] getBinaryMask(int w,
                              int h,
                              int xoff,
                              int yoff)
Generates binary mask for inside part of the snake.

The area enclosed by the snake will be painted in white.

Parameters:
w - Width of the mask.
h - Height of the mask.
xoff - Offset in x-direction.
yoff - Offset in y-direction.
Returns:
Binary mask, 1=enclosed region
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getClass

public int getClass(int x,
                    int y)
Description copied from interface: MTBSegmentationInterface
Returns the class label of position (x,y).

Specified by:
getClass in interface MTBSegmentationInterface

getClass

public int getClass(int x,
                    int y,
                    int z)
Description copied from interface: MTBSegmentationInterface
Returns the class label of position (x,y,z).

Specified by:
getClass in interface MTBSegmentationInterface

getCOMx

public double getCOMx()
Returns the center of mass of the snake in x-direction.


getCOMy

public double getCOMy()
Returns the center of mass of the snake in y-direction.


getDimension

public MTBSegmentationInterface.SegmentationDimension getDimension()
Returns the dimension of the given membership.

Specified by:
getDimension in interface MTBSegmentationInterface

getMaxLabel

public int getMaxLabel()
Returns the maximal label used in the membership representation.

Specified by:
getMaxLabel in interface MTBSegmentationInterface

getNumberOfClasses

public int getNumberOfClasses()
Returns the number of classes represented in the membership.

Specified by:
getNumberOfClasses in interface MTBSegmentationInterface

getPartialDiffX

public double getPartialDiffX(int position)
Get approximation of partial derivative in x-direction at point with given index.

For calculating partial derivatives point differences are used, i.e. forward differences. Note, that the partial derivative for the last point of a non-closed snake is always zero!

Parameters:
position - Index of snake point.
Returns:
Value of discrete approximation of x-derivative.

getPartialDiffY

public double getPartialDiffY(int position)
Get approximation of partial derivative in y-direction at point with given index.

For calculating partial derivatives point differences are used, i.e. forward differences. Note, that the partial derivative for the last point of a non-closed snake is always zero!

Parameters:
position - Index of snake point.
Returns:
Value of discrete approximation of y-derivative.

getScaleFactor

public double getScaleFactor()
Get the scaling factor of the snake.

Returns:
Scaling factor.

getSizeX

public int getSizeX()
Description copied from interface: MTBSegmentationInterface
Returns the size of the segmentation domain in x direction.

Specified by:
getSizeX in interface MTBSegmentationInterface

getSizeY

public int getSizeY()
Description copied from interface: MTBSegmentationInterface
Returns the size of the segmentation domain in y direction.

Specified by:
getSizeY in interface MTBSegmentationInterface

getSizeZ

public int getSizeZ()
Description copied from interface: MTBSegmentationInterface
Returns the size of the segmentation domain in z direction.

Specified by:
getSizeZ in interface MTBSegmentationInterface

getSnakePoints

public java.util.Vector<MTBSnakePoint2D> getSnakePoints()
Get snake points as vector of SnakePoint2D objects.

Returns:
Vector with 2D snake points.

getSndPartialDiffX

public double getSndPartialDiffX(int position)
Get approximation of 2nd order partial derivative in x-direction.

For calculating partial derivatives point differences are used, i.e. forward differences. Note, that the partial derivatives for the first and last point of a non-closed snake are always zero!

Parameters:
position - Index of snake point.
Returns:
Value of discrete approximation of 2nd order x-derivative.

getSndPartialDiffY

public double getSndPartialDiffY(int position)
Get approximation of 2nd order partial derivative in y-direction.

For calculating partial derivatives point differences are used, i.e. forward differences. Note, that the partial derivatives for the first and last point of a non-closed snake are always zero!

Parameters:
position - Index of snake point.
Returns:
Value of discrete approximation of 2nd order y-derivative.

getWeight

public double getWeight(int x,
                        int y)
Description copied from interface: MTBSegmentationInterface
Returns the pixel weight of position (x,y).

Specified by:
getWeight in interface MTBSegmentationInterface

getWeight

public double getWeight(int x,
                        int y,
                        int z)
Description copied from interface: MTBSegmentationInterface
Returns the pixel weight of position (x,y,z).

Specified by:
getWeight in interface MTBSegmentationInterface

getXMaxCoordinate

public int getXMaxCoordinate()
Returns maximal x coordinate represented in class/visibility maps.


getXMinCoordinate

public int getXMinCoordinate()
Returns minimal x coordinate represented in class/visibility maps.


getYMaxCoordinate

public int getYMaxCoordinate()
Returns maximal y coordinate represented in class/visibility maps.


getYMinCoordinate

public int getYMinCoordinate()
Returns minimal y coordinate represented in class/visibility maps.


isVisible

public boolean isVisible(int x,
                         int y)
Description copied from interface: MTBSegmentationInterface
True, if position (x,y) is visible.

Specified by:
isVisible in interface MTBSegmentationInterface

isVisible

public boolean isVisible(int x,
                         int y,
                         int z)
Description copied from interface: MTBSegmentationInterface
True, if position (x,y,z) is visible.

Specified by:
isVisible in interface MTBSegmentationInterface

jni_makePolySimple

public void jni_makePolySimple()
JNI method for eliminating loops in polygons. ATTENTION!!! The returned polygon is CLOCKWISE ORIENTED!!!

Overrides:
jni_makePolySimple in class MTBPolygon2D

normalize

public void normalize(double scale)
Normalizes the snake coordinates.

All snake points are scaled by the given scale factor. A factor larger than 1.0 expands the snake, a factor smaller than 1.0 shrinks it, and the default factor of 1.0 does not change anything. The factor is stored internally for later de-normalization of the snake.

Parameters:
scale - Scale factor for normalization.

printPoints

public void printPoints()
Prints points of snake to standard output stream.


resample

public void resample(double segLength)
 
 Method to re-sample the line segments of the snake in a range of a given
 segment length. The range is calculated from the given length of a segment
 by calculation: 
 - minimum = segment length * 0.5
 - maximum = segment length * 1.5
 
 If a line segment (p,q) is too small, the point q is removed from the list.
 Then the new line segment (p,r) is observed, where r is the successor of q.
 
 If a line segment (p,q) is too large, new points will be added.
 The number of new points is calculated by the possible number of points
 (depending on the given segment length) that fit into the line segment
 between p and q.
 
 The old index of the snake point position in the previous snake is kept for
 all existing snake points. For new snake points the old position index is
 set to -1 by default.
 
 

Overrides:
resample in class MTBPolygon2D

reversePolypoints

public void reversePolypoints()
Overwrite reversePolypoints method of Polygon2D. Changes the ordering of the snake points.

If the snake points are ordered clockwise afterwards they are ordered counter-clockwise and vice versa. The old id of a snake point is kept.

Overrides:
reversePolypoints in class MTBPolygon2D

setClass

@Deprecated
public void setClass(int x,
                                int y,
                                int c)
Deprecated. 

Description copied from interface: MTBSegmentationInterface
Set the label of position (x,y) to c.

Specified by:
setClass in interface MTBSegmentationInterface

setClass

@Deprecated
public void setClass(int x,
                                int y,
                                int z,
                                int c)
Deprecated. 

Description copied from interface: MTBSegmentationInterface
Set the label of position (x,y,z) to c.

Specified by:
setClass in interface MTBSegmentationInterface

setInvisible

public void setInvisible(int x,
                         int y)
Description copied from interface: MTBSegmentationInterface
Set position (x,y) invisible.

Specified by:
setInvisible in interface MTBSegmentationInterface

setInvisible

public void setInvisible(int x,
                         int y,
                         int z)
Description copied from interface: MTBSegmentationInterface
Set position (x,y,z) invisible.

Specified by:
setInvisible in interface MTBSegmentationInterface

setPoints

public void setPoints(java.util.Vector<java.awt.geom.Point2D.Double> ps)
Overwrite Polygon2D method to set all points of the snake from the specified point vector object. Intern a vector of SnakePoint2D object is created. The old position of every point within the snake is set to -1 by default.

Overrides:
setPoints in class MTBPolygon2D
Parameters:
ps - vector with new points of the polygon

setSegmentationDomain

public void setSegmentationDomain(int xmin,
                                  int xmax,
                                  int ymin,
                                  int ymax)
Specify the domain of the underlying segmentation.

Class and visibility information is only available for pixels lying in the domain.

Parameters:
xmin - Minimal coordinate in x-direction.
xmax - Maximal coordinate in x-direction.
ymin - Minimal coordinate in y-direction.
ymax - Maximal coordinate in y-direction.

setSnakePoints

public void setSnakePoints(java.util.Vector<MTBSnakePoint2D> ps)
Set all points of the snake from the specified SnakePoint2D vector object. The old position of every point within the snake is kept.


setValidmask

public void setValidmask(boolean[][] mask)
Set the valid mask from external mask data.

Note that the parameter object is cloned for internal representation!


setVisible

public void setVisible(int x,
                       int y)
Description copied from interface: MTBSegmentationInterface
Set position (x,y) visible.

Specified by:
setVisible in interface MTBSegmentationInterface

setVisible

public void setVisible(int x,
                       int y,
                       int z)
Description copied from interface: MTBSegmentationInterface
Set position (x,y,z) visible.

Specified by:
setVisible in interface MTBSegmentationInterface

setWeight

public void setWeight(int x,
                      int y,
                      double c)
Description copied from interface: MTBSegmentationInterface
Sets the pixel weight of position (x,y) to c.

Specified by:
setWeight in interface MTBSegmentationInterface

setWeight

public void setWeight(int x,
                      int y,
                      int z,
                      double c)
Description copied from interface: MTBSegmentationInterface
Sets the pixel weight of position (x,y,z) to c.

Specified by:
setWeight in interface MTBSegmentationInterface

shift

public void shift(double shift,
                  int imageSizeX,
                  int imageSizeY)
Method to shift the whole snake outward (positive value) ore inward (negative value) to its normal vector from every line segment.

ATTENTION!!! After shifting a snake, it can happen that the snake is not simple !!!

Overrides:
shift in class MTBPolygon2D
Parameters:
shift - positive ore negative value to shift the snake
imageSizeX - width of the image to test whether the coordinates of the shifted snake are valid
imageSizeY - height of the image to test whether the coordinates of the shifted snake are valid

toMTBImage

public MTBImage toMTBImage(java.lang.String file,
                           MTBImage img)
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                           de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Method to draw and save the snake in a given MTBImage.

Parameters:
file - file to save the image with the snake on the disk. File can be null, then no file is stored on disk
img - image where the snake should be drawn in
Returns:
MTBImage from type of the given image, including the snake as white contour line.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

toMTBImageByte

public MTBImageByte toMTBImageByte(java.lang.String file,
                                   int w,
                                   int h)
                            throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                   de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Method to draw and save the snake in a binary image.

Parameters:
file - file to save the image with the snake on the disk. File can be null, then no file is stored on disk
w - image width
h - image height
Returns:
MTBImageByte including the snake as white contour line on a black background.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

updateIDs

private void updateIDs(java.util.Vector<MTBSnakePoint2D> newPoints)
Update method for snake point ID's after make snake simple. Method is necessary for jni_makePolySimple().

Parameters:
newPoints - points after using jni_makePolySimple but without the former ID's for all points.

updateSnakeSegmentation

private void updateSnakeSegmentation()
Convenience function for updating the segmentation.