de.unihalle.informatik.MiToBo.fields
Class FieldOperations2D

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

@ALDAOperator(genericExecutionMode=NONE,
              level=STANDARD)
public class FieldOperations2D
extends MTBOperator

Class implements several operations on a 2D vector field.

Author:
Danny Misiak

Nested Class Summary
static class FieldOperations2D.FieldOperation
          Several operation types on a 2D vector field.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  int fieldSizeX
          Vector field size in x-direction.
private  int fieldSizeY
          Vector field size in y-direction.
private  FieldOperations2D.FieldOperation operationType
          The operation which should be applied to the input vector field.
private  MTBImage resultImage
          Several result formats.
private  double[] U
          U-component-vector of the vector field.
private  double[] V
          V-component-vector of the vector field.
private  MTBVectorField2D vectorField
          The 2D vector field for several operations.
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
FieldOperations2D()
          Standard constructor.
FieldOperations2D(MTBVectorField2D inField, FieldOperations2D.FieldOperation op)
          Constructor to create a new field operation operator.
 
Method Summary
protected  MTBImageRGB colorPlot()
           Plots the field in colored image.
protected  MTBImage getDiffX_image()
          Calculate the image from the first order partial derivative in x-direction from the vectors U and V.
protected  MTBImage getDiffY_image()
          Calculate the image from the first order partial derivative in y-direction from the vectors U and V.
 int getFieldSizeX()
          Get the field size in x-direction.
 int getFieldSizeY()
          Get the field size in y-direction.
protected  MTBImage getMagImage()
          Calculate the gradient magnitude image from the vectors U and V.
protected  MTBImage getNormedMagImage()
          Normalize the gradient magnitude values into a range of [0,1].
 FieldOperations2D.FieldOperation getOperationType()
          Get the operation type which should be applied to the input vector field.
 MTBImage getResultImage()
          Get result image of the operation on the vector field.
 MTBVectorField2D getVectorField()
          Get the operation based 2D vector field.
protected  void operate()
          This method does the actual work.
 void setFieldSizeX(int sizeX)
          Set the field size in x-direction.
 void setFieldSizeY(int sizeY)
          Set the field size in y-direction.
 void setOperationType(FieldOperations2D.FieldOperation type)
           
 void setVectorField(MTBVectorField2D inField)
          Set the operation based 2D vector field.
 
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

fieldSizeX

@Parameter(label="fieldSizeX",
           required=true,
           direction=IN,
           description="Size of the vector field in x-direction")
private int fieldSizeX
Vector field size in x-direction.


fieldSizeY

@Parameter(label="fieldSizeY",
           required=true,
           direction=IN,
           description="Size of the vector field in y-direction")
private int fieldSizeY
Vector field size in y-direction.


operationType

@Parameter(label="Operation Type",
           required=true,
           direction=IN,
           description="Type of used field operation.")
private FieldOperations2D.FieldOperation operationType
The operation which should be applied to the input vector field.


resultImage

@Parameter(label="Result Image",
           required=false,
           direction=OUT,
           description="Result image.")
private transient MTBImage resultImage
Several result formats. Only MTBImage's for the moment.


U

private transient double[] U
U-component-vector of the vector field.


V

private transient double[] V
V-component-vector of the vector field.


vectorField

@Parameter(label="Vector Field",
           required=true,
           direction=IN,
           description="2D vector field input")
private transient MTBVectorField2D vectorField
The 2D vector field for several operations.

Constructor Detail

FieldOperations2D

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

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

FieldOperations2D

public FieldOperations2D(MTBVectorField2D inField,
                         FieldOperations2D.FieldOperation op)
                  throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor to create a new field operation operator.

Parameters:
inField - input 2D vector field
op - operator type
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

colorPlot

protected MTBImageRGB colorPlot()
 Plots the field in colored image. The colors derived from the field
    vectors
 magnitude (length of the vector) and their direction (degree from x-axis
    to
 y-axis). HSI color spaced is used to represent direction and magnitude.
 To view the field, HSI color space is converted to RGBcolor space.
 
 H: (the used color) is derived from the angle of the vector.
 S: (saturation) of color H is derived from the vector magnitude.
 I: (color intensity) is set to 1.0 (100%), to get colors only from
 0% saturation of color H (white) to 100% saturation of color H.
 
 Ranges of HSI:
 H in [0, 360) (representing degrees),
 S and I in [0, 1] (representing [0, 100 %]).
 

Returns:
RGB image, visualizing the vector field.

getDiffX_image

protected MTBImage getDiffX_image()
Calculate the image from the first order partial derivative in x-direction from the vectors U and V.

Returns:
Gradient magnitude image.

getDiffY_image

protected MTBImage getDiffY_image()
Calculate the image from the first order partial derivative in y-direction from the vectors U and V.

Returns:
Gradient magnitude image.

getFieldSizeX

public int getFieldSizeX()
Get the field size in x-direction.


getFieldSizeY

public int getFieldSizeY()
Get the field size in y-direction.


getMagImage

protected MTBImage getMagImage()
Calculate the gradient magnitude image from the vectors U and V.

Returns:
Gradient magnitude image.

getNormedMagImage

protected MTBImage getNormedMagImage()
Normalize the gradient magnitude values into a range of [0,1].

Returns:
MTBimage with normalized gradient magnitude values.

getOperationType

public FieldOperations2D.FieldOperation getOperationType()
Get the operation type which should be applied to the input vector field.

Returns:
Field operation type.

getResultImage

public MTBImage getResultImage()
Get result image of the operation on the vector field.


getVectorField

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


operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
This method does the actual work.

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

setFieldSizeX

public void setFieldSizeX(int sizeX)
Set the field size in x-direction.


setFieldSizeY

public void setFieldSizeY(int sizeY)
Set the field size in y-direction.


setOperationType

public void setOperationType(FieldOperations2D.FieldOperation type)

setVectorField

public void setVectorField(MTBVectorField2D inField)
Set the operation based 2D vector field.