Package adams.flow.transformer
Class SpectralAngleMapper
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.transformer.AbstractTransformer
-
- adams.flow.transformer.SpectralAngleMapper
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.ShallowCopySupporter<adams.flow.core.Actor>
,adams.core.SizeOfHandler
,adams.core.Stoppable
,adams.core.StoppableWithFeedback
,adams.core.TechnicalInformationHandler
,adams.core.VariablesInspectionHandler
,adams.event.VariableChangeListener
,adams.flow.control.StorageUser
,adams.flow.core.Actor
,adams.flow.core.ErrorHandler
,adams.flow.core.InputConsumer
,adams.flow.core.OutputProducer
,Serializable
,Comparable
public class SpectralAngleMapper extends adams.flow.transformer.AbstractTransformer implements adams.flow.control.StorageUser, adams.core.TechnicalInformationHandler
Performs Spectral Angle Mapping on a set of spectra. Each spectrum is treated as a vector in band-space (where each spectral band is considered a basis), and the angle between the input and reference spectra is calculated to determine similarity. Emits an array of angles, one for each reference spectrum provided.
For more information see:
Kruse, Fred A, Lefkoff, AB, Boardman, JW, Heidebrecht, KB, Shapiro, AT, Barloon, PJ, Goetz, AFH (1993). The spectral image processing system (SIPS)—interactive visualization and analysis of imaging spectrometer data. Remote sensing of environment. 44(2-3):145--163.
Oshigami, Shoko, Yamaguchi, Yasushi, Uezato, Tatsumi, Momose, Atsushi, Arvelyna, Yessy, Kawakami, Yuu, Yajima, Taro, Miyatake, Shuichi, Nguno, Anna (2013). Mineralogical mapping of southern Namibia by application of continuum-removal MSAM method to the HyMap data. International journal of remote sensing. 34(15):5282--5295.
@article{Kruse1993, author = {Kruse, Fred A and Lefkoff, AB and Boardman, JW and Heidebrecht, KB and Shapiro, AT and Barloon, PJ and Goetz, AFH}, journal = {Remote sensing of environment}, number = {2-3}, pages = {145--163}, publisher = {Elsevier}, title = {The spectral image processing system (SIPS)—interactive visualization and analysis of imaging spectrometer data}, volume = {44}, year = {1993} } @article{Oshigami2013, author = {Oshigami, Shoko and Yamaguchi, Yasushi and Uezato, Tatsumi and Momose, Atsushi and Arvelyna, Yessy and Kawakami, Yuu and Yajima, Taro and Miyatake, Shuichi and Nguno, Anna}, journal = {International journal of remote sensing}, number = {15}, pages = {5282--5295}, publisher = {Taylor & Francis}, title = {Mineralogical mapping of southern Namibia by application of continuum-removal MSAM method to the HyMap data}, volume = {34}, year = {2013} }
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: SpectralAngleMapper
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow execution at this level gets stopped in case this actor encounters an error; the error gets propagated; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false
-references <adams.flow.control.StorageName> (property: references) The name of the storage location where the reference spectra are stored. default: storage
-cache <adams.core.base.BaseString> (property: cache) The name of the LRU cache to get the reference storage from. An empty value specifies that regular storage should be used. default:
-check-wave-number-alignment <boolean> (property: checkWaveNumberAlignment) Whether to check that all provided spectra have the same set of wave-numbers. default: true
-modified <boolean> (property: modified) Whether to use the modified algorithm described in Oshigami et al. default: false
- Author:
- Corey Sterling (csterlin at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.core.base.BaseString
m_Cache
The LRU cache to get the storage value from.protected boolean
m_CheckWaveNumberAlignment
Whether to check wave-numbers match between spectra.protected adams.flow.control.StorageName
m_ReferencesStorage
Storage of the reference spectra.protected boolean
m_UseModifiedAlgorithm
Whether to use the modified algorithm described in Oshigami et al.-
Fields inherited from class adams.flow.transformer.AbstractTransformer
BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
-
Constructor Summary
Constructors Constructor Description SpectralAngleMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.String
cacheTipText()
Gets the tip-text for the cache option.protected double[]
calculateSpectralAngles(Spectrum input, Spectrum[] references)
Performs the calculation of spectral angles between the input spectrum and each reference spectrum.protected void
checkInput(Spectrum input)
Checks the input spectrum for validity.protected void
checkInputVersusReferences(Spectrum input, Spectrum[] references)
Checks that the input and the references are able to be angle-mapped.protected void
checkReferences(Spectrum[] references)
Checks the reference spectra for validity.protected void
checkWaveNumberAlignment(Spectrum input, Spectrum[] references)
Checks that the input and reference spectra have the same wave-number profile.String
checkWaveNumberAlignmentTipText()
Gets the tip-text for the checkWaveNumberAlignment option.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the flow item.Class[]
generates()
Returns the class of objects that it generates.adams.core.base.BaseString
getCache()
Gets the name of the LRU cache to use.boolean
getCheckWaveNumberAlignment()
Gets whether wave-number alignment should be checked.protected Spectrum
getInput()
Gets the input spectrum from the input token.boolean
getModified()
Gets whether to use the modified algorithm.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.adams.flow.control.StorageName
getReferences()
Gets the name of the storage location for reference spectra.protected Spectrum[]
getReferences(adams.flow.control.StorageName name, String cache)
Retrieves the reference spectra from storage.adams.core.TechnicalInformation
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.String
globalInfo()
Returns a string describing the object.boolean
isUsingStorage()
Returns whether storage items are being used.String
modifiedTipText()
Gets the tip-text for the modified option.String
referencesTipText()
Gets the tip-text for the references option.void
setCache(adams.core.base.BaseString value)
Sets the name of the LRU cache to use.void
setCheckWaveNumberAlignment(boolean value)
Sets whether wave-number alignment should be checked.void
setModified(boolean value)
Sets whether to use the modified algorithm.protected void
setOutput(double[] angles)
Sets the output token to the given array of angles.void
setReferences(adams.flow.control.StorageName value)
Sets the name of the storage location for reference spectra.protected double[]
toDoubleArray(Spectrum spectrum)
Converts a spectrum into a double array of its wave amplitudes.-
Methods inherited from class adams.flow.transformer.AbstractTransformer
backupState, currentInput, execute, hasInput, hasPendingOutput, input, output, postExecute, restoreState, wrapUp
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, pruneBackup, reset, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
-
-
-
Field Detail
-
m_ReferencesStorage
protected adams.flow.control.StorageName m_ReferencesStorage
Storage of the reference spectra.
-
m_Cache
protected adams.core.base.BaseString m_Cache
The LRU cache to get the storage value from.
-
m_CheckWaveNumberAlignment
protected boolean m_CheckWaveNumberAlignment
Whether to check wave-numbers match between spectra.
-
m_UseModifiedAlgorithm
protected boolean m_UseModifiedAlgorithm
Whether to use the modified algorithm described in Oshigami et al.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.flow.core.AbstractActor
-
getReferences
public adams.flow.control.StorageName getReferences()
Gets the name of the storage location for reference spectra.- Returns:
- The storage name.
-
setReferences
public void setReferences(adams.flow.control.StorageName value)
Sets the name of the storage location for reference spectra.- Parameters:
value
- The storage name.
-
referencesTipText
public String referencesTipText()
Gets the tip-text for the references option.- Returns:
- The tip-text as a string.
-
getCache
public adams.core.base.BaseString getCache()
Gets the name of the LRU cache to use.- Returns:
- The name of the cache.
-
setCache
public void setCache(adams.core.base.BaseString value)
Sets the name of the LRU cache to use.- Parameters:
value
- The name of the cache.
-
cacheTipText
public String cacheTipText()
Gets the tip-text for the cache option.- Returns:
- The tip-text as a string.
-
getCheckWaveNumberAlignment
public boolean getCheckWaveNumberAlignment()
Gets whether wave-number alignment should be checked.- Returns:
- True if the check should be performed, false if not.
-
setCheckWaveNumberAlignment
public void setCheckWaveNumberAlignment(boolean value)
Sets whether wave-number alignment should be checked.- Parameters:
value
- True if the check should be performed, false if not.
-
checkWaveNumberAlignmentTipText
public String checkWaveNumberAlignmentTipText()
Gets the tip-text for the checkWaveNumberAlignment option.- Returns:
- The tip-text as a string.
-
getModified
public boolean getModified()
Gets whether to use the modified algorithm.- Returns:
- Whether to use the modified algorithm.
-
setModified
public void setModified(boolean value)
Sets whether to use the modified algorithm.- Parameters:
value
- Whether to use the modified algorithm.
-
modifiedTipText
public String modifiedTipText()
Gets the tip-text for the modified option.- Returns:
- The tip-text as a string.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.
Default implementation returns null.- Specified by:
getQuickInfo
in interfaceadams.flow.core.Actor
- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Overrides:
getQuickInfo
in classadams.flow.core.AbstractActor
- Returns:
- null if no info available, otherwise short string
-
getTechnicalInformation
public adams.core.TechnicalInformation getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.- Specified by:
getTechnicalInformation
in interfaceadams.core.TechnicalInformationHandler
- Returns:
- the technical information about this class
-
getInput
protected Spectrum getInput()
Gets the input spectrum from the input token.- Returns:
- The input spectrum.
-
checkInput
protected void checkInput(Spectrum input)
Checks the input spectrum for validity.- Parameters:
input
- The input spectrum to check;
-
getReferences
protected Spectrum[] getReferences(adams.flow.control.StorageName name, String cache)
Retrieves the reference spectra from storage.- Parameters:
name
- The name of the storage value to get from.cache
- The name of the LRU cache to use.- Returns:
- The array of reference spectra.
-
checkReferences
protected void checkReferences(Spectrum[] references)
Checks the reference spectra for validity.- Parameters:
references
- The reference spectra to check.
-
checkInputVersusReferences
protected void checkInputVersusReferences(Spectrum input, Spectrum[] references)
Checks that the input and the references are able to be angle-mapped.- Parameters:
input
- The input spectrum.references
- The reference spectra.
-
checkWaveNumberAlignment
protected void checkWaveNumberAlignment(Spectrum input, Spectrum[] references)
Checks that the input and reference spectra have the same wave-number profile.- Parameters:
input
- The input spectrum.references
- The reference spectra.
-
calculateSpectralAngles
protected double[] calculateSpectralAngles(Spectrum input, Spectrum[] references)
Performs the calculation of spectral angles between the input spectrum and each reference spectrum.- Parameters:
input
- The input spectrum.references
- The reference spectra.- Returns:
- An array of angles, one for each reference spectrum.
-
toDoubleArray
protected double[] toDoubleArray(Spectrum spectrum)
Converts a spectrum into a double array of its wave amplitudes.- Parameters:
spectrum
- The spectrum to convert.- Returns:
- The array of amplitudes.
-
setOutput
protected void setOutput(double[] angles)
Sets the output token to the given array of angles.- Parameters:
angles
- The angles to output.
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classadams.flow.core.AbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
accepts
in interfaceadams.flow.core.InputConsumer
- Returns:
- the Class of objects that can be processed
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generates
in interfaceadams.flow.core.OutputProducer
- Returns:
- the Class of the generated tokens
-
isUsingStorage
public boolean isUsingStorage()
Returns whether storage items are being used.- Specified by:
isUsingStorage
in interfaceadams.flow.control.StorageUser
- Returns:
- true if storage items are used
-
-