de.unihalle.informatik.MiToBo.fields
Class GradientFieldCalculator2D

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.GradientFieldCalculator2D
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator

@ALDAOperator(genericExecutionMode=ALL,
              level=STANDARD)
public class GradientFieldCalculator2D
extends MTBOperator

Class to calculate a gradient vector field of a given image.

Some methods to get derivatives on several operators are implemented like central and forward differences and the Sobel operator.

Author:
Birgit Möller, Danny Misiak

Nested Class Summary
static class GradientFieldCalculator2D.GradientMode
          Provided calculation modes for calculation the gradient image.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  GradientFieldCalculator2D.GradientMode gradientMode
          The used gradient mode for field calculation.
private  int height
          Height of the image.
private  MTBImage inputImage
          The input image to get the gradient values and differences.
private  MTBVectorField2D vectorField
          The resulting 2D vector field.
private  MTBImageDouble vectorFieldImage
          The resulting 2D vector field stored to an image.
private  int width
          Width of the image.
protected  double[] xFlow
          Vector field flow in x-direction.
protected  double[] yFlow
          Vector field flow in y-direction.
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
GradientFieldCalculator2D()
          Standard constructor.
GradientFieldCalculator2D(MTBImage inImg, GradientFieldCalculator2D.GradientMode mode)
          Constructor.
 
Method Summary
 GradientFieldCalculator2D.GradientMode getGradientMode()
          Get the used gradient mode for field calculation.
 void getGradientMode(GradientFieldCalculator2D.GradientMode mode)
          Set the used gradient mode for field calculation.
 int getHeight()
          Get image height.
 MTBImage getInputImage()
          Get the underlying input image of the gradient field..
protected  void getPartialDiffX_forward()
          Calculate first order partial derivative in x-direction using forward differences.
protected  void getPartialDiffX_sobel()
          Calculate first order partial derivative in x-direction using Sobel.
protected  void getPartialDiffX()
          Calculate first order partial derivative in x-direction using central differences.
protected  void getPartialDiffY_forward()
          Calculate first order partial derivative in y-direction using forward differences.
protected  void getPartialDiffY_sobel()
          Calculate first order partial derivative in y-direction using Sobel.
protected  void getPartialDiffY()
          Calculate first order partial derivative in y-direction using central differences.
 MTBVectorField2D getVectorField()
          Get the resulting 2D vector field.
 int getWidth()
          Get image width.
protected  void operate()
          This method does the actual work.
 void setHeight(int h)
          Set image height.
 void setInputImage(MTBImage inImg)
          Set the underlying input image of the gradient 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
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gradientMode

@Parameter(label="Approximation Mode",
           required=true,
           direction=IN,
           dataIOOrder=-8,
           description="Type of the gradient mode")
private GradientFieldCalculator2D.GradientMode gradientMode
The used gradient mode for field calculation.


height

private transient int height
Height of the image.


inputImage

@Parameter(label="Input Image",
           required=true,
           direction=IN,
           dataIOOrder=-10,
           description="Input image")
private transient MTBImage inputImage
The input image to get the gradient values and differences.


vectorField

@Parameter(label="Vector Field",
           direction=OUT,
           description="Gradient field of the 2D image.")
private transient MTBVectorField2D vectorField
The resulting 2D vector field.


vectorFieldImage

@Parameter(label="Vector Field Image",
           direction=OUT,
           description="Gradient field image.")
private transient MTBImageDouble vectorFieldImage
The resulting 2D vector field stored to an image.

The image has to layers where the first one contains the values of the x-direction and the second one the values of the y-direction.


width

private transient int width
Width of the image.


xFlow

protected double[] xFlow
Vector field flow in x-direction.


yFlow

protected double[] yFlow
Vector field flow in y-direction.

Constructor Detail

GradientFieldCalculator2D

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

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

GradientFieldCalculator2D

public GradientFieldCalculator2D(MTBImage inImg,
                                 GradientFieldCalculator2D.GradientMode mode)
                          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor. A new operator object is initialized.

Parameters:
inImg - image to work on
mode - gradient calculation mode
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

getGradientMode

public GradientFieldCalculator2D.GradientMode getGradientMode()
Get the used gradient mode for field calculation.


getGradientMode

public void getGradientMode(GradientFieldCalculator2D.GradientMode mode)
Set the used gradient mode for field calculation.


getHeight

public int getHeight()
Get image height.


getInputImage

public MTBImage getInputImage()
Get the underlying input image of the gradient field..


getPartialDiffX_forward

protected void getPartialDiffX_forward()
Calculate first order partial derivative in x-direction using forward differences.


getPartialDiffX_sobel

protected void getPartialDiffX_sobel()
Calculate first order partial derivative in x-direction using Sobel.


getPartialDiffX

protected void getPartialDiffX()
Calculate first order partial derivative in x-direction using central differences.


getPartialDiffY_forward

protected void getPartialDiffY_forward()
Calculate first order partial derivative in y-direction using forward differences.


getPartialDiffY_sobel

protected void getPartialDiffY_sobel()
Calculate first order partial derivative in y-direction using Sobel.


getPartialDiffY

protected void getPartialDiffY()
Calculate first order partial derivative in y-direction using central differences.


getVectorField

public MTBVectorField2D getVectorField()
Get the resulting 2D vector field.


getWidth

public int getWidth()
Get image width.


operate

protected void operate()
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

setHeight

public void setHeight(int h)
Set image height.


setInputImage

public void setInputImage(MTBImage inImg)
Set the underlying input image of the gradient field.


setWidth

public void setWidth(int w)
Set image width.