de.unihalle.informatik.MiToBo.morphology
Class ImgTophat

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

@ALDAOperator(genericExecutionMode=ALL)
public class ImgTophat
extends MTBOperator

This class implements the tophat operator.

Attention: if masksize is even, errors may result due to lack of operator symmetry

Author:
moeller

Nested Class Summary
static class ImgTophat.tophatMode
          Available operating modes.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
private  MTBImage inImg
           
private  int masksize
           
(package private)  MTBImage mtbImg
          MTB input image to work on.
private  ImgTophat.tophatMode processMode
           
private  MTBImage resultImg
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, portHashAccess, verbose, versionProvider
 
Constructor Summary
ImgTophat()
          Default constructor.
ImgTophat(MTBImage ip, ImgTophat.tophatMode op, int msize)
          Constructor with parameters.
 
Method Summary
 MTBImage getInputImage()
          Get reference to the current input image.
 int getMasksize()
          Get current masksize.
 ImgTophat.tophatMode getMode()
          Get the desired operator mode.
 MTBImage getResultImage()
          Get the result image after applying the operator.
protected  void operate()
           
 void setResultImage(MTBImage rimage)
          Set the result image.
private  MTBImage tophat_concave(MTBImage img, int msize)
          Apply a top hat operator to the image for concavity detection.
private  MTBImage tophat_convex(MTBImage img, int msize)
          Apply a top hat operator to the image for convexity detection.
 
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

inImg

@Parameter(label="Input image",
           required=true,
           direction=IN,
           description="Input image")
private transient MTBImage inImg

masksize

@Parameter(label="Masksize",
           required=true,
           direction=IN,
           description="Masksize")
private int masksize

mtbImg

MTBImage mtbImg
MTB input image to work on.


processMode

@Parameter(label="processMode",
           required=false,
           direction=IN,
           description="Process mode")
private ImgTophat.tophatMode processMode

resultImg

@Parameter(label="Result image",
           required=true,
           direction=OUT,
           description="Result image")
private transient MTBImage resultImg
Constructor Detail

ImgTophat

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

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

ImgTophat

public ImgTophat(MTBImage ip,
                 ImgTophat.tophatMode op,
                 int msize)
          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with parameters.

Parameters:
ip - Image to work on.
op - Operator mode.
masksize - Size of squared mask.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

getInputImage

public MTBImage getInputImage()
Get reference to the current input image.

Returns:
Input image to work on.

getMasksize

public int getMasksize()
Get current masksize.

Returns:
Masksize of dilation mask.

getMode

public ImgTophat.tophatMode getMode()
Get the desired operator mode.

Returns:
Modus of operator.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

getResultImage

public MTBImage getResultImage()
Get the result image after applying the operator. Attention, reference might be null.

Returns:
Reference to result image.

operate

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

setResultImage

public void setResultImage(MTBImage rimage)
Set the result image.

Parameters:
rimage - Result image.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

tophat_concave

private MTBImage tophat_concave(MTBImage img,
                                int msize)
                         throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Apply a top hat operator to the image for concavity detection.

The operation is performed assuming a squared structural element with specified mask size and grayscale entries of 0.

Parameters:
img - Input image.
msize - Size of mask.
Returns:
Detection result (positiv answers = white).
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

tophat_convex

private MTBImage tophat_convex(MTBImage img,
                               int msize)
                        throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                               de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Apply a top hat operator to the image for convexity detection.

The operation is performed assuming a squared structural element with specified mask size and grayscale entries of 0.

Parameters:
img - Input image.
msize - Size of mask.
Returns:
Detection result (positiv answers = white).
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException