de.unihalle.informatik.MiToBo.tools.image
Class ImageValueTools

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

@ALDMetaInfo(export=ALLOWED)
@ALDAOperator(genericExecutionMode=NONE)
public class ImageValueTools
extends MTBOperator

An operator class for different simple operations on the values of an image like inversion, filling with a constant value, etc.

The policy here is to use static functions instead of constructing a new object, set its parameters and then call runOp(). Thus the source code is reduced as the functions of this class are assumed to be called quite often.

This class is meant to implement convenience functions on images to keep the image classes from bloating. Feel free to extend this class with your convenience functions. Please implement static methods for any functionality to keep the policy of this class. Be aware that the input image is changed, i.e. the input image is also the result image. (You don't need to get the result image, if you still have a reference to the input image, but this method is implemented for completeness)

Author:
Oliver Gress

Nested Class Summary
static class ImageValueTools.ImageValueModification
          Available image value modification methods.
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
  ImageValueTools()
           
protected ImageValueTools(MTBImage img)
          Constructor.
 
Method Summary
protected  void fill(MTBImage img, Color rgbvalue)
           
protected  void fill(MTBImage img, double grayvalue)
           
static void fillImage(MTBImage img, Color rgbvalue, MTBOperator callingOperator)
          Fill the image with a RGB color value.
static void fillImage(MTBImage img, double grayvalue, MTBOperator callingOperator)
          Fill the specified image with a gray value.
protected  Double getGrayValue()
           
 MTBImage getInputImage()
           
protected  double getLowerBound()
          Get lower bound of the normalization to range [lowerBound, upperBound].
protected  ImageValueTools.ImageValueModification getModification()
           
 MTBImage getResultImage()
           
protected  Color getRGBValue()
           
protected  double getUpperBound()
          Get upper bound of the normalization to range [lowerBound, upperBound].
protected  void invert(MTBImage img)
           
static void invertImage(MTBImage img, MTBOperator callingOperator)
          Invert the specified image.
protected  void normFromTo(MTBImage img)
           
static void normImageFromTo(MTBImage img, double oldMinVal, double oldMaxVal, double newMinVal, double newMaxVal, MTBOperator callingOperator)
          Normalize the image values to range [lowerBound, upperBound].
static void normImageTo(MTBImage img, double lowerBound, double upperBound, MTBOperator callingOperator)
          Normalize the image values to range [lowerBound, upperBound].
protected  void normTo(MTBImage img, double lowerBound, double upperBound)
           
protected  void operate()
           
 void setFill(Color _rgbValue)
           
 void setFill(double _grayValue)
           
 void setInputImage(MTBImage _inputImage)
           
 void setInvert()
           
 void setModification(ImageValueTools.ImageValueModification mod)
           
 void setNormFromTo(double minVal, double maxVal, double minVal_new, double maxVal_new)
           
 void setNormTo(double _lowerBound, double _upperBound)
           
 void validateCustom()
           
 
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, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageValueTools

public ImageValueTools()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

ImageValueTools

protected ImageValueTools(MTBImage img)
                   throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor. Use set-functions to set the parameters.

Parameters:
img -
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

validateCustom

public void validateCustom()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Overrides:
validateCustom in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

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

invertImage

public static void invertImage(MTBImage img,
                               MTBOperator callingOperator)
                        throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                               de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Invert the specified image. If the input image is not of type MTB_BYTE or MTB_RGB, the minimum and maximum image value are used to compute the inverted values to keep the values in the same range.

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

fillImage

public static void fillImage(MTBImage img,
                             double grayvalue,
                             MTBOperator callingOperator)
                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                             de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Fill the specified image with a gray value.

Parameters:
img -
grayvalue -
callingOperator -
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

fillImage

public static void fillImage(MTBImage img,
                             Color rgbvalue,
                             MTBOperator callingOperator)
                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                             de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Fill the image with a RGB color value. If the input image is a gray value image, the RGB value is averaged for a gray value.

Parameters:
img -
rgbvalue -
callingOperator -
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

normImageTo

public static void normImageTo(MTBImage img,
                               double lowerBound,
                               double upperBound,
                               MTBOperator callingOperator)
                        throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                               de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Normalize the image values to range [lowerBound, upperBound]. This method is useful mostly for gray value images.

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

normImageFromTo

public static void normImageFromTo(MTBImage img,
                                   double oldMinVal,
                                   double oldMaxVal,
                                   double newMinVal,
                                   double newMaxVal,
                                   MTBOperator callingOperator)
                            throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                                   de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Normalize the image values to range [lowerBound, upperBound]. This method is useful mostly for gray value images.

Parameters:
img -
lowerBound -
upperBound -
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

getInputImage

public MTBImage getInputImage()

setInputImage

public void setInputImage(MTBImage _inputImage)

getResultImage

public MTBImage getResultImage()

setInvert

public void setInvert()

setFill

public void setFill(Color _rgbValue)
             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setFill

public void setFill(double _grayValue)
             throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setNormTo

public void setNormTo(double _lowerBound,
                      double _upperBound)
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setNormFromTo

public void setNormFromTo(double minVal,
                          double maxVal,
                          double minVal_new,
                          double maxVal_new)

setModification

public void setModification(ImageValueTools.ImageValueModification mod)

getModification

protected ImageValueTools.ImageValueModification getModification()

getGrayValue

protected Double getGrayValue()

getRGBValue

protected Color getRGBValue()

getLowerBound

protected double getLowerBound()
Get lower bound of the normalization to range [lowerBound, upperBound].

Returns:
Lower bound.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

getUpperBound

protected double getUpperBound()
Get upper bound of the normalization to range [lowerBound, upperBound].

Returns:
Upper bound.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

invert

protected void invert(MTBImage img)

fill

protected void fill(MTBImage img,
                    double grayvalue)

fill

protected void fill(MTBImage img,
                    Color rgbvalue)

normTo

protected void normTo(MTBImage img,
                      double lowerBound,
                      double upperBound)

normFromTo

protected void normFromTo(MTBImage img)


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