adams.data.image
Class AbstractImageTransformer<T extends AbstractImage>

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.image.AbstractImageTransformer<T>
Type Parameters:
T - the type of image to process
All Implemented Interfaces:
CleanUpHandler, Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable, Comparable
Direct Known Subclasses:
AbstractImageJTransformer, AbstractJAITransformer

public abstract class AbstractImageTransformer<T extends AbstractImage>
extends AbstractOptionHandler
implements Comparable, CleanUpHandler

Abstract base class for AbstractImage transformations.

Version:
$Revision: 5189 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
AbstractImageTransformer()
           
 
Method Summary
protected  void checkImage(T img)
          Optional checks of the image.
 void cleanUp()
          Cleans up data structures, frees up memory.
 int compareTo(Object o)
          Compares this object with the specified object for order.
 void destroy()
          Frees up memory in a "destructive" non-reversible way.
protected abstract  T[] doTransform(T img)
          Performs the actual transforming of the image.
 boolean equals(Object o)
          Returns whether the two objects are the same.
 T shallowCopy()
          Returns a shallow copy of itself, i.e., based on the commandline options.
 T shallowCopy(boolean expand)
          Returns a shallow copy of itself, i.e., based on the commandline options.
 T[] transform(T img)
          Transforms the given image.
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, defineOptions, finishInit, getDebugLevel, getOptionManager, globalInfo, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractImageTransformer

public AbstractImageTransformer()
Method Detail

checkImage

protected void checkImage(T img)
Optional checks of the image.

Default implementation only checks whether image is null.

Parameters:
img - the image to check

doTransform

protected abstract T[] doTransform(T img)
Performs the actual transforming of the image.

Parameters:
img - the image to transform (can be modified, since it is a copy)
Returns:
the generated image(s)

transform

public T[] transform(T img)
Transforms the given image.

Parameters:
img - the image to transform
Returns:
the generated image(s)

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Only compares the commandlines of the two objects.

Specified by:
compareTo in interface Comparable
Parameters:
o - the object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this object.

equals

public boolean equals(Object o)
Returns whether the two objects are the same.

Only compares the commandlines of the two objects.

Overrides:
equals in class Object
Parameters:
o - the object to be compared
Returns:
true if the object is the same as this one

shallowCopy

public T shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.

Returns:
the shallow copy

shallowCopy

public T shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.

Parameters:
expand - whether to expand variables to their current values
Returns:
the shallow copy

cleanUp

public void cleanUp()
Cleans up data structures, frees up memory.

The default implementation does nothing.

Specified by:
cleanUp in interface CleanUpHandler

destroy

public void destroy()
Frees up memory in a "destructive" non-reversible way.

Calls cleanUp() and cleans up the options.

Specified by:
destroy in interface Destroyable
Overrides:
destroy in class AbstractOptionHandler


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.