de.unihalle.informatik.MiToBo.fields
Class GVFFieldCalculator2D

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.fields.GVFFieldCalculator2D
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDAOperator(genericExecutionMode=NONE,
              level=STANDARD)
@ALDMetaInfo(export=ALLOWED)
public class GVFFieldCalculator2D
extends MTBOperator

Class to calculate a special 2D vector field, a Gradient Vector Flow Field (GVF) with its x- and y-flows from the given image. The GVF field is used as external energy in the snake calculation.

Author:
Danny Misiak

Nested Class Summary
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
protected  double[] myX
          The flows of the field in x- and y-direction.
protected  double[] myY
          The flows of the field in x- and y-direction.
protected  double[] xFlow
          The flows of the field in x- and y-direction.
protected  double[] yFlow
          The flows of the field in x- and y-direction.
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
GVFFieldCalculator2D()
          Standard constructor.
GVFFieldCalculator2D(MTBImage inImg, int iterations)
          Constructor.
 
Method Summary
protected  double[] Abl_X(double[] values, int w, int h)
          Calculate the x-derivative of the gradient image.
protected  double[] Abl_Y(double[] values, int w, int h)
          Calculate the y-derivative of the gradient image.
protected  double[] BoundEnsure(double[] A, int w, int h)
          Test the image boundary.
protected  double[] BoundExpand(double[] A, int w, int h)
          Expand the image boundary.
protected  double[] BoundShrink(double[] A, int w, int h)
          Shrink the image boundary.
protected  void calcGVF()
          Calculate the GVF field with the given number of iterations on the given input image.
 int getHeight()
          Get image height.
 MTBImage getInputImage()
          Get input image.
 int getNumIterations()
          Get number of iterations for the GVF field.
 MTBImage.MTBImageType getType()
          Get input image type.
protected  double[] getValues()
          Get the double values of the given image.
 MTBVectorField2D getVectorField()
          Get calculated GVF vector field..
 int getWidth()
          Get image width.
protected  void normValues()
          Normalize the values in the gvf field in a range of [-1,1].
protected  void operate()
          This method does the actual work.
 void setHeight(int h)
          Set image height.
 void setInputImage(MTBImage inImg)
          Set input image.
 void setNumIterations(int iterations)
          Set number of iterations for the GVF field.
 void setWidth(int w)
          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
 

Field Detail

myX

protected transient double[] myX
The flows of the field in x- and y-direction.


myY

protected transient double[] myY
The flows of the field in x- and y-direction.


xFlow

protected transient double[] xFlow
The flows of the field in x- and y-direction.


yFlow

protected transient double[] yFlow
The flows of the field in x- and y-direction.

Constructor Detail

GVFFieldCalculator2D

public GVFFieldCalculator2D()
                     throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Standard constructor. A new empty operator object is initialized.

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

GVFFieldCalculator2D

public GVFFieldCalculator2D(MTBImage inImg,
                            int iterations)
                     throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor. A new operator object is initialized.

Parameters:
inImg - image to work on
iterations - number of iterations for the gvf field
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

getInputImage

public MTBImage getInputImage()
Get input image.


setInputImage

public void setInputImage(MTBImage inImg)
Set input image.


getNumIterations

public int getNumIterations()
Get number of iterations for the GVF field.


setNumIterations

public void setNumIterations(int iterations)
Set number of iterations for the GVF field.


getType

public MTBImage.MTBImageType getType()
Get input image type.


getVectorField

public MTBVectorField2D getVectorField()
Get calculated GVF vector field..


getWidth

public int getWidth()
Get image width.


setWidth

public void setWidth(int w)
Set image width.


getHeight

public int getHeight()
Get image height.


setHeight

public void setHeight(int h)
Set image height.


operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
This method does the actual work. Each subclass needs to overwrite this method. As parameter a MiToBo parameter object is passed to the function where all required data and operator configuration information can be found.

Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

calcGVF

protected void calcGVF()
Calculate the GVF field with the given number of iterations on the given input image.


getValues

protected double[] getValues()
Get the double values of the given image.

Returns:
Double values of the given image in a one dimensional double array.

normValues

protected void normValues()
Normalize the values in the gvf field in a range of [-1,1].


Abl_X

protected double[] Abl_X(double[] values,
                         int w,
                         int h)
Calculate the x-derivative of the gradient image.

Parameters:
values - gradient values of the image
w - width of the given image
h - height of the given image
Returns:
A one dimensional array including the x-derivative values

Abl_Y

protected double[] Abl_Y(double[] values,
                         int w,
                         int h)
Calculate the y-derivative of the gradient image.

Parameters:
values - gradient values of the image
w - width of the given image
h - height of the given image
Returns:
A one dimensional array including the y-derivative values

BoundExpand

protected double[] BoundExpand(double[] A,
                               int w,
                               int h)
Expand the image boundary. It's necessary to calculate the derivatives in the border pixels of the image.

Parameters:
A - gradient image of the given image
w - width of the given image
h - height of the given image

BoundEnsure

protected double[] BoundEnsure(double[] A,
                               int w,
                               int h)
Test the image boundary. It's necessary to calculate the derivatives in the border pixels of the image.

Parameters:
A - gradient image of the given image
w - width of the given image
h - height of the given image

BoundShrink

protected double[] BoundShrink(double[] A,
                               int w,
                               int h)
Shrink the image boundary. It's necessary to calculate the derivatives in the border pixels of the image.

Parameters:
A - gradient image of the given image
w - width of the given image
h - height of the given image


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