de.unihalle.informatik.MiToBo.morphology
Class DistanceTransform

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.morphology.DistanceTransform
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDAOperator(genericExecutionMode=ALL,
              level=APPLICATION)
@ALDMetaInfo(export=MANDATORY)
public class DistanceTransform
extends MTBOperator

 
 Class to calculate a distance map / field from a binary image using the
 Champfer-algorithm from
 
 G. Borgefors, "Distance transformations in digital images", Computer
 Vision, Graphics, and Image Processing, vol. 34, pp. 344–371, 1986.
 
 Several distance metrics (Euclide, Chessboard, Cityblock) and the foreground
 (0 for black and 1 for white) can be specified. A 8-way neighborhood is used.
 
 NOTE!
 The distance is calculated for each background pixel to the nearest
 foreground pixel. For example, if the distance should be calculated inside a
 white object, the black background should be set as foreground color.
 
 The distance field is created as MTBImage or as a two dimensional double array.
 First dimension specifies the y-coordinate of the field, and the
 second dimension specifies the x-coordinate of the field.
 
 

Author:
misiak

Nested Class Summary
static class DistanceTransform.DistanceMetric
          Several distance metrics.
static class DistanceTransform.ForegroundColor
          Color of binary image foreground.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
DistanceTransform()
          Standard constructor.
DistanceTransform(MTBImageByte image, DistanceTransform.DistanceMetric dm, DistanceTransform.ForegroundColor fg)
          Constructor to create a new DistanceTransform object.
 
Method Summary
 MTBImage getDistanceImage()
          Get the calculated distance map image.
 double[][] getDistanceMap()
          Get the calculated distance map.
 DistanceTransform.DistanceMetric getDistMetric()
          Get the used distance metric.
 DistanceTransform.ForegroundColor getForeground()
          Get the used foreground color.
 int getHeight()
          Get image height.
 MTBImageByte getInImg()
          Get the input image.
 int getWidth()
          Get image width.
protected  void operate()
           
 void setDistMetric(DistanceTransform.DistanceMetric metric)
          Set the distance metric.
 void setForeground(DistanceTransform.ForegroundColor fColor)
          Set the foreground color.
 void setHeight(int height)
          Set image height.
 void setInImg(MTBImageByte inImg)
          Set the input image.
 void setWidth(int width)
          Set image width.
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
readResolve
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistanceTransform

public DistanceTransform()
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Standard constructor.

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

DistanceTransform

public DistanceTransform(MTBImageByte image,
                         DistanceTransform.DistanceMetric dm,
                         DistanceTransform.ForegroundColor fg)
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor to create a new DistanceTransform object.

Parameters:
image - the input image to calculate the distance map on it
dm - the distance metric
fg - set foreground white or black
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

getInImg

public MTBImageByte getInImg()
Get the input image.

Returns:
Input image.

setInImg

public void setInImg(MTBImageByte inImg)
Set the input image.


getDistMetric

public DistanceTransform.DistanceMetric getDistMetric()
Get the used distance metric.

Returns:
Distance metric.

setDistMetric

public void setDistMetric(DistanceTransform.DistanceMetric metric)
Set the distance metric.


getForeground

public DistanceTransform.ForegroundColor getForeground()
Get the used foreground color.

Returns:
Foreground color.

setForeground

public void setForeground(DistanceTransform.ForegroundColor fColor)
Set the foreground color.


getDistanceImage

public MTBImage getDistanceImage()
Get the calculated distance map image.

Returns:
Distance map image.

getDistanceMap

public double[][] getDistanceMap()
Get the calculated distance map. First dimension specifies the y-coordinate of the field, and the second dimension specifies the x-coordinate of the field.

Returns:
Distance map.

getWidth

public int getWidth()
Get image width.


setWidth

public void setWidth(int width)
Set image width.


getHeight

public int getHeight()
Get image height.


setHeight

public void setHeight(int height)
Set image height.


operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.