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 class
AbstractDenoiser.DenoiserJob<T extends DataContainer>
A job class specific to denoisers.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_RecordRegions
whether to record elution regions as well.protected List<T>
m_Regions
the 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 void
checkData(T data)
The default implementation only checks whether there is any data set.void
cleanUp()
Cleans up data structures, frees up memory.int
compareTo(Object o)
Compares this object with the specified object for order.void
defineOptions()
Adds options to the internal list of options.T
denoise(T data)
Returns the denoised data.void
destroy()
Frees up memory in a "destructive" non-reversible way.boolean
equals(Object o)
Returns whether the two objects are the same.static AbstractDenoiser
forCommandLine(String cmdline)
Instantiates the denoiser algorithm from the given commandline (i.e., classname and optional options).static AbstractDenoiser
forName(String classname, String[] options)
Instantiates the denoiser algorithm with the given options.static String[]
getDenoisers()
Returns a list with classnames of denoiser algorithms.boolean
getRecordRegions()
Returns whether noisy regions are recorded.List<T>
getRegions()
Returns the noisy regions that were recorded.protected T
postprocessData(T original, T denoised)
Post-processes the data.protected abstract T
processData(T data)
Performs the actual denoising.String
recordRegionsTipText()
Returns the tip text for this property.protected void
reset()
Resets the noise algorithm.void
setRecordRegions(boolean value)
Sets whether the noisy regions are recorded as well.AbstractDenoiser
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractDenoiser
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.String
toStringRegions()
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:
reset
in classAbstractOptionHandler
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory. Sets the input data to null.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Calls cleanUp() and cleans up the options.- Specified by:
destroy
in interfaceDestroyable
- Overrides:
destroy
in classAbstractOptionHandler
- See Also:
AbstractOptionHandler.cleanUpOptions()
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setRecordRegions
public void setRecordRegions(boolean value)
Sets whether the noisy regions are recorded as well.- Specified by:
setRecordRegions
in 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:
getRecordRegions
in 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:
recordRegionsTipText
in 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:
getRegions
in 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:
compareTo
in 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:
shallowCopy
in 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:
shallowCopy
in 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
-
-