Package adams.data.noise
Class AbstractDenoiser<T extends DataContainer>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.noise.AbstractDenoiser<T>
-
- Type Parameters:
T- the type of data the denoiser is handling
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<AbstractDenoiser>,SizeOfHandler,RegionRecorder<T>,Serializable,Comparable
- Direct Known Subclasses:
AbstractDatabaseConnectionDenoiser,PassThrough
public abstract class AbstractDenoiser<T extends DataContainer> extends AbstractOptionHandler implements RegionRecorder<T>, Comparable, CleanUpHandler, ShallowCopySupporter<AbstractDenoiser>
An abstract super class for algorithms that remove noise from data.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractDenoiser.DenoiserJob<T extends DataContainer>A job class specific to denoisers.
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_RecordRegionswhether to record elution regions as well.protected List<T>m_Regionsthe collected elution regions.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractDenoiser()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckData(T data)The default implementation only checks whether there is any data set.voidcleanUp()Cleans up data structures, frees up memory.intcompareTo(Object o)Compares this object with the specified object for order.voiddefineOptions()Adds options to the internal list of options.Tdenoise(T data)Returns the denoised data.voiddestroy()Frees up memory in a "destructive" non-reversible way.booleanequals(Object o)Returns whether the two objects are the same.static AbstractDenoiserforCommandLine(String cmdline)Instantiates the denoiser algorithm from the given commandline (i.e., classname and optional options).static AbstractDenoiserforName(String classname, String[] options)Instantiates the denoiser algorithm with the given options.static String[]getDenoisers()Returns a list with classnames of denoiser algorithms.booleangetRecordRegions()Returns whether noisy regions are recorded.List<T>getRegions()Returns the noisy regions that were recorded.protected TpostprocessData(T original, T denoised)Post-processes the data.protected abstract TprocessData(T data)Performs the actual denoising.StringrecordRegionsTipText()Returns the tip text for this property.protected voidreset()Resets the noise algorithm.voidsetRecordRegions(boolean value)Sets whether the noisy regions are recorded as well.AbstractDenoisershallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.AbstractDenoisershallowCopy(boolean expand)Returns a shallow copy of itself, i.e., based on the commandline options.StringtoStringRegions()Turns the recorded regions as a string.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_RecordRegions
protected boolean m_RecordRegions
whether to record elution regions as well.
-
m_Regions
protected List<T extends DataContainer> m_Regions
the collected elution regions.
-
-
Method Detail
-
reset
protected void reset()
Resets the noise algorithm. Derived classes must call this method in set-methods of parameters to assure the invalidation of previously generated data.- Overrides:
resetin classAbstractOptionHandler
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory. Sets the input data to null.- Specified by:
cleanUpin interfaceCleanUpHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Calls cleanUp() and cleans up the options.- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classAbstractOptionHandler- See Also:
AbstractOptionHandler.cleanUpOptions()
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setRecordRegions
public void setRecordRegions(boolean value)
Sets whether the noisy regions are recorded as well.- Specified by:
setRecordRegionsin interfaceRegionRecorder<T extends DataContainer>- Parameters:
value- if true the regions will be recorded- See Also:
getRegions()
-
getRecordRegions
public boolean getRecordRegions()
Returns whether noisy regions are recorded.- Specified by:
getRecordRegionsin interfaceRegionRecorder<T extends DataContainer>- Returns:
- true if the regions are recorded
- See Also:
getRegions()
-
recordRegionsTipText
public String recordRegionsTipText()
Returns the tip text for this property.- Specified by:
recordRegionsTipTextin interfaceRegionRecorder<T extends DataContainer>- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getRegions
public List<T> getRegions()
Returns the noisy regions that were recorded.- Specified by:
getRegionsin interfaceRegionRecorder<T extends DataContainer>- Returns:
- the regions
- See Also:
m_RecordRegions
-
checkData
protected void checkData(T data)
The default implementation only checks whether there is any data set.- Parameters:
data- the data to process
-
processData
protected abstract T processData(T data)
Performs the actual denoising.- Parameters:
data- the data to process- Returns:
- the denoised data
-
postprocessData
protected T postprocessData(T original, T denoised)
Post-processes the data.
Default implementation only returns the denoised data as it is.- Parameters:
original- the original input datadenoised- the denoised data- Returns:
- the postprocessed data
-
denoise
public T denoise(T data)
Returns the denoised data.- Parameters:
data- the data to denoise- Returns:
- the denoised data
-
toStringRegions
public String toStringRegions()
Turns the recorded regions as a string.- Returns:
- the regions
-
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:
compareToin interfaceComparable<T extends DataContainer>- 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.
-
shallowCopy
public AbstractDenoiser shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<T extends DataContainer>- Returns:
- the shallow copy
-
shallowCopy
public AbstractDenoiser shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<T extends DataContainer>- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
getDenoisers
public static String[] getDenoisers()
Returns a list with classnames of denoiser algorithms.- Returns:
- the denoiser algorithm classnames
-
forName
public static AbstractDenoiser forName(String classname, String[] options)
Instantiates the denoiser algorithm with the given options.- Parameters:
classname- the classname of the denoiser algorithm to instantiateoptions- the options for the denoiser algorithm- Returns:
- the instantiated denoiser algorithm or null if an error occurred
-
forCommandLine
public static AbstractDenoiser forCommandLine(String cmdline)
Instantiates the denoiser algorithm from the given commandline (i.e., classname and optional options).- Parameters:
cmdline- the classname (and optional options) of the denoiser algorithm to instantiate- Returns:
- the instantiated denoiser algorithm or null if an error occurred
-
-