de.unihalle.informatik.MiToBo.filters.linear.anisotropic
Class GaborFilter2D

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.filters.linear.anisotropic.OrientedFilter2D
              extended by de.unihalle.informatik.MiToBo.filters.linear.anisotropic.GaborFilter2D
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener, loci.common.StatusReporter

@ALDDerivedClass
@ALDAOperator(genericExecutionMode=ALL,
              level=APPLICATION)
public class GaborFilter2D
extends OrientedFilter2D

2D Gabor filter.

The implementation is based on the following definition of the Gabor family:

%preamble{\usepackage{amssymb}}
This definition is basically the one to be found in J.G. Daugmann, "Uncertainty relation for resolution in space, spatial frequency, and orientation optimized by two-dimensional visual cortical filters", J. Opt. Soc. Am. A/Vol. 2, No. 7, July 1985.

The only difference is the scaling factor of the Gaussian which is sometimes omitted.

The filter mask is rotated by transforming the x and y coordinates as follows:

%preamble{\usepackage{amssymb}}

Author:
Birgit Moeller

Nested Class Summary
protected static class GaborFilter2D.KernelPart
          Allows to request kernel masks for real and complex parts independently.
static class GaborFilter2D.ResultType
          Reponse mode.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
protected  double frequency
          Filter frequency.
protected  double gaussStdDevX
          Standard deviation of the Gaussian in x.
protected  double gaussStdDevY
          Standard deviation of the Gaussian in x.
protected  boolean invertMask
          Flag to invert filter mask.
protected  int kernelSize
          Size of the (squared) kernel window.
protected  GaborFilter2D.KernelPart kPart
          Variable to configure which part of kernel mask is calculated.
protected  GaborFilter2D.ResultType resultType
          Desired type of result.
 
Fields inherited from class de.unihalle.informatik.MiToBo.filters.linear.anisotropic.OrientedFilter2D
angle, inputImg, resultImg, statusListeners
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
GaborFilter2D()
          Default constructor.
 
Method Summary
protected  MTBImageDouble getComplexKernel(double _angle)
          Generates the sinus filter mask of the complex part of the Gabor filter.
protected  MTBImageDouble getGaussianKernel(double _angle)
          Generates the Gaussian part of the Gabor kernel for a given orientation.
 MTBImageDouble getKernel(double _angle)
          Calculates kernel for given angle and pre-defined sigmas.
protected  MTBImageDouble getRealKernel(double _angle)
          Generates the cosine filter mask of the complex part of the Gabor filter.
protected  void operate()
           
protected  Object readResolve()
          Init function for deserialized objects.
 void setFrequency(double f)
          Specify frequency.
 void setInvertMask(boolean b)
          Enable/disable inversion of mask.
protected  void setKernelPart(GaborFilter2D.KernelPart k)
          Specify which kernel part should be generated.
 void setKernelSize(int s)
          Specify size of the kernel.
 void setResultType(GaborFilter2D.ResultType t)
          Specify result type.
 void setSigmaX(double sx)
          Specify Gaussian standard deviation in x.
 void setSigmaY(double sy)
          Specify Gaussian standard deviation in y.
 
Methods inherited from class de.unihalle.informatik.MiToBo.filters.linear.anisotropic.OrientedFilter2D
addStatusListener, getResultImage, notifyListeners, removeStatusListener, setAngle, setInputImage
 
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

gaussStdDevX

@Parameter(label="\u03c3 of Gaussian in x",
           required=false,
           dataIOOrder=2,
           direction=IN,
           mode=STANDARD,
           description="Std. deviation of Gaussian in x.")
protected double gaussStdDevX
Standard deviation of the Gaussian in x.

The mask width is derived from the standard deviation of the Gaussian,
i.e. the width is given by %preamble{\usepackage{amssymb, amsmath}}.
Note that the minimum width is 3.


gaussStdDevY

@Parameter(label="\u03c3 of Gaussian in y",
           required=false,
           dataIOOrder=3,
           direction=IN,
           mode=STANDARD,
           description="Std. deviation of Gaussian in y.")
protected double gaussStdDevY
Standard deviation of the Gaussian in x.

The mask width is derived from the standard deviation of the Gaussian,
i.e. the width is given by %preamble{\usepackage{amssymb, amsmath}} .
Note that the minimum width is 3.


frequency

@Parameter(label="Filter Frequency \u03c6",
           required=true,
           direction=IN,
           mode=STANDARD,
           description="Frequency of the filter.",
           dataIOOrder=3)
protected double frequency
Filter frequency.


invertMask

@Parameter(label="Invert Mask",
           required=false,
           dataIOOrder=4,
           direction=IN,
           mode=STANDARD,
           description="If true, filter mask is inverted.")
protected boolean invertMask
Flag to invert filter mask.


resultType

@Parameter(label="Result Type",
           required=false,
           dataIOOrder=6,
           direction=IN,
           mode=STANDARD,
           description="Type of desired result.")
protected GaborFilter2D.ResultType resultType
Desired type of result.


kernelSize

@Parameter(label="Kernel Size",
           required=false,
           dataIOOrder=5,
           direction=IN,
           mode=STANDARD,
           description="Size of kernel window, if set to -1 it\'s determined automatically.")
protected int kernelSize
Size of the (squared) kernel window.

If set to -1, the size is automatically derived from the given standard deviations in x and y.


kPart

protected GaborFilter2D.KernelPart kPart
Variable to configure which part of kernel mask is calculated.

This variable is mainly used internally for generating parts of the Gabor filter mask independently, and for unit testing. Due to this the variable is not annotated as parameter.

Constructor Detail

GaborFilter2D

public GaborFilter2D()
              throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Default constructor.

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

readResolve

protected Object readResolve()
Description copied from class: MTBOperator
Init function for deserialized objects.

This function is called on an instance of this class being deserialized from file, prior to handing the instance over to the user. It takes care of a proper initialization of transient member variables as they are not initialized to the default values during deserialization.

Overrides:
readResolve in class OrientedFilter2D
Returns:
Updated deserialized object.

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                       de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Overrides:
operate in class OrientedFilter2D
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

getKernel

public MTBImageDouble getKernel(double _angle)
Calculates kernel for given angle and pre-defined sigmas.

Dependend on the value of this.kPart either the real or the complex part of the kernel mask is returned.

Specified by:
getKernel in class OrientedFilter2D
Parameters:
_angle - Rotation angle in degrees.
Returns:
Kernel image.

getGaussianKernel

protected MTBImageDouble getGaussianKernel(double _angle)
Generates the Gaussian part of the Gabor kernel for a given orientation.

Parameters:
_angle - Filter orientation.
Returns:
Kernel image.

getRealKernel

protected MTBImageDouble getRealKernel(double _angle)
Generates the cosine filter mask of the complex part of the Gabor filter.

Parameters:
_angle - Orientation of the filter.
Returns:
Kernel image.

getComplexKernel

protected MTBImageDouble getComplexKernel(double _angle)
Generates the sinus filter mask of the complex part of the Gabor filter.

Parameters:
_angle - Filter orientation.
Returns:
Kernel image.

setSigmaX

public void setSigmaX(double sx)
Specify Gaussian standard deviation in x.

Parameters:
sx - Standard deviation.

setSigmaY

public void setSigmaY(double sy)
Specify Gaussian standard deviation in y.

Parameters:
sy - Standard deviation.

setFrequency

public void setFrequency(double f)
Specify frequency.

Parameters:
f - Frequency.

setResultType

public void setResultType(GaborFilter2D.ResultType t)
Specify result type.

Parameters:
t - Desired type of result.

setInvertMask

public void setInvertMask(boolean b)
Enable/disable inversion of mask.

Parameters:
b - Flag for inversion.

setKernelSize

public void setKernelSize(int s)
Specify size of the kernel.

Parameters:
s - Size to apply.

setKernelPart

protected void setKernelPart(GaborFilter2D.KernelPart k)
Specify which kernel part should be generated.

Parameters:
k - Part of kernel to apply, i.e. real or complex part.


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