Wavelengths Class Reference

A convenience class for working with wavelength values. More...

#include <Wavelengths.h>

List of all members.

Public Member Functions

virtual bool setStartValues (const std::vector< double > &startValues, WavelengthUnitsType valueUnits)=0
virtual const std::vector
< double > & 
getStartValues () const =0
virtual bool hasStartValues () const =0
virtual bool setCenterValues (const std::vector< double > &centerValues, WavelengthUnitsType valueUnits)=0
virtual const std::vector
< double > & 
getCenterValues () const =0
virtual bool hasCenterValues () const =0
virtual bool setEndValues (const std::vector< double > &endValues, WavelengthUnitsType valueUnits)=0
virtual const std::vector
< double > & 
getEndValues () const =0
virtual bool hasEndValues () const =0
virtual void setUnits (WavelengthUnitsType units, bool convertValues=true)=0
virtual WavelengthUnitsType getUnits () const =0
virtual void clear ()=0
virtual bool isEmpty () const =0
virtual unsigned int getNumWavelengths () const =0
virtual void scaleValues (double dScaleFactor)=0
virtual void calculateFwhm (double dConstant=1.0)=0
virtual std::vector< double > getFwhm ()=0
virtual bool initializeFromWavelengths (const Wavelengths *pWavelengths)=0
virtual bool initializeFromDynamicObject (const DynamicObject *pData, bool convertToDisplayUnits)=0
virtual bool applyToDynamicObject (DynamicObject *pData)=0

Static Public Member Functions

static unsigned int getNumWavelengths (const DynamicObject *pData)
static double convertValue (double value, WavelengthUnitsType valueUnits, WavelengthUnitsType newUnits)
static std::string WavelengthType ()
static std::string WavelengthsArg ()
static std::string WavelengthFileArg ()

Protected Member Functions

virtual ~Wavelengths ()


Detailed Description

A convenience class for working with wavelength values.

This class provides a common object for working with wavelength values. It contains start, center, and end wavelength values and the units associated with the values. The values and units can be set directly or initialized from special metadata attributes in a DynamicObject or from another Wavelengths object. The Wavelengths object can be used as an input or output plug-in arg. Additional convenience static methods are provided to convert wavelength values between units and to query the number of wavelength values in a DynamicObject.

Wavelength objects should be created with an object factory resource as follows:

  FactoryResource<Wavelengths> pWavelengths;

When the Wavelengths object is created, the start, center, and end value vectors are empty (i.e. isEmpty() returns true), and the units are set to WavelengthUnitsType::MICRONS.

See also:
Special Metadata

Definition at line 44 of file Wavelengths.h.


Constructor & Destructor Documentation

virtual Wavelengths::~Wavelengths (  )  [protected, virtual]

This should be destroyed by calling ObjectFactory::destroyObject().

Definition at line 492 of file Wavelengths.h.


Member Function Documentation

virtual bool Wavelengths::setStartValues ( const std::vector< double > &  startValues,
WavelengthUnitsType  valueUnits 
) [pure virtual]

Sets starting wavelength values.

The number of starting values must equal the number of center and ending values if they are present.

Parameters:
startValues The starting wavelength values.
valueUnits The units of the starting wavelength values. If the units are not the same units returned by getUnits(), the values are automatically converted before they are set.
Returns:
Returns true if the start values are successfully set; returns false if any of the following occur:
  • startValues is not empty and valueUnits is invalid
  • startValues is not empty and the size is different than the number of center and ending values (if present)
  • startValues contains all zero or negative values
See also:
setCenterValues(), setEndValues(), convertValue()

virtual const std::vector<double>& Wavelengths::getStartValues (  )  const [pure virtual]

Returns the starting wavelength values.

Returns:
Returns the starting wavelength values. The values are in the units as returned by getUnits().
See also:
getCenterValues(), getEndValues()

virtual bool Wavelengths::hasStartValues (  )  const [pure virtual]

Queries whether starting wavelength values are present.

This is a convenience method that is equivalent to calling !getStartValues().empty().

Returns:
Returns true if starting wavelengths are present; otherwise returns false.
See also:
getStartValues(), isEmpty()

virtual bool Wavelengths::setCenterValues ( const std::vector< double > &  centerValues,
WavelengthUnitsType  valueUnits 
) [pure virtual]

Sets center wavelength values.

The number of center values must equal the number of starting and ending values if they are present.

Parameters:
centerValues The center wavelength values.
valueUnits The units of the center wavelength values. If the units are not the same units returned by getUnits(), the values are automatically converted before they are set.
Returns:
Returns true if the center values are successfully set; returns false if any of the following occur:
  • centerValues is not empty and valueUnits is invalid
  • centerValues is not empty and the size is different than the number of starting and ending values (if present)
  • centerValues contains all zero or negative values
See also:
setStartValues(), setEndValues(), convertValue()

virtual const std::vector<double>& Wavelengths::getCenterValues (  )  const [pure virtual]

Returns the center wavelength values.

Returns:
Returns the center wavelength values. The values are in the units as returned by getUnits().
See also:
getStartValues(), getEndValues()

virtual bool Wavelengths::hasCenterValues (  )  const [pure virtual]

Queries whether center wavelength values are present.

This is a convenience method that is equivalent to calling !getCenterValues().empty().

Returns:
Returns true if center wavelengths are present; otherwise returns false.
See also:
getCenterValues(), isEmpty()

virtual bool Wavelengths::setEndValues ( const std::vector< double > &  endValues,
WavelengthUnitsType  valueUnits 
) [pure virtual]

Sets ending wavelength values.

The number of ending values must equal the number of starting and center values if they are present.

Parameters:
endValues The ending wavelength values.
valueUnits The units of the ending wavelength values. If the units are not the same units returned by getUnits(), the values are automatically converted before they are set.
Returns:
Returns true if the ending values are successfully set; returns false if any of the following occur:
  • endValues is not empty and valueUnits is invalid
  • endValues is not empty and the size is different than the number of starting and center values (if present)
  • endValues contains all zero or negative values
See also:
setStartValues(), setCenterValues(), convertValue()

virtual const std::vector<double>& Wavelengths::getEndValues (  )  const [pure virtual]

Returns the ending wavelength values.

Returns:
Returns the ending wavelength values. The values are in the units as returned by getUnits().
See also:
getStartValues(), getCenterValues()

virtual bool Wavelengths::hasEndValues (  )  const [pure virtual]

Queries whether ending wavelength values are present.

This is a convenience method that is equivalent to calling !getEndValues().empty().

Returns:
Returns true if ending wavelengths are present; otherwise returns false.
See also:
getEndValues(), isEmpty()

virtual void Wavelengths::setUnits ( WavelengthUnitsType  units,
bool  convertValues = true 
) [pure virtual]

Assigns units to the wavelength values.

Parameters:
units The new wavelength units.
convertValues If set to true, all wavelength values are converted to the new units. If set to false, no wavelength values are modified.
See also:
getUnits(), convertValue()

virtual WavelengthUnitsType Wavelengths::getUnits (  )  const [pure virtual]

Returns the units of the start, center, and end wavelength values.

Returns:
The wavelength units.
See also:
getEndValues(), isEmpty()

virtual void Wavelengths::clear (  )  [pure virtual]

Clears the wavelength values and units.

This method clears the start, center, and end wavelength values, and sets the units to WavelengthUnitsType::MICRONS. After calling this method, isEmpty() returns true.

virtual bool Wavelengths::isEmpty (  )  const [pure virtual]

Queries whether start, center, or end wavelength values are present.

Returns:
Returns true if start, center, and end wavelengths are not present (i.e. all wavelength vectors are empty); otherwise returns false.
See also:
getNumWavelengths()

virtual unsigned int Wavelengths::getNumWavelengths (  )  const [pure virtual]

Returns the number of wavelength values.

Returns:
Returns the number of wavelengths values if start, center, or end wavelength values are present; otherwise returns 0.
See also:
isEmpty(), getNumWavelengths(const DynamicObject*)

virtual void Wavelengths::scaleValues ( double  dScaleFactor  )  [pure virtual]

Adjusts all wavelength values by a given scale factor.

This method multiplies the start, center, and end wavelengths by the given scale factor. The units are not changed.

Parameters:
dScaleFactor The scale factor by which to adjust the wavelength values. This method does nothing if the scale factor is zero or negative.
See also:
calculateFwhm()

virtual void Wavelengths::calculateFwhm ( double  dConstant = 1.0  )  [pure virtual]

Populates the start and end wavelengths by calculating the full width at half maximum (FWHM) of the center wavelength values.

This method does nothing if center wavelength values are not set.

Parameters:
dConstant An optional constant that is multiplied by the wavelength width when calculating the FWHM.
See also:
getFwhm(), scaleValues()

virtual std::vector<double> Wavelengths::getFwhm (  )  [pure virtual]

Returns the calculated full width at half maximum (FWHM) values.

If start or end wavelengths are not set, this method calculates the FWHM and returns the values for each wavelength.

Returns:
The FWHM for each center wavelength value.
See also:
calculateFwhm(), scaleValues()

virtual bool Wavelengths::initializeFromWavelengths ( const Wavelengths pWavelengths  )  [pure virtual]

Sets the start, center, and end wavelength values and units to those of another Wavelengths object.

Parameters:
pWavelengths The Wavelengths object from which to set the wavelength values and units.
Returns:
Returns true if the start, center, and end values and units are successfully set from the Wavelengths object; otherwise returns false.
See also:
initializeFromDynamicObject()

virtual bool Wavelengths::initializeFromDynamicObject ( const DynamicObject pData,
bool  convertToDisplayUnits 
) [pure virtual]

Sets the start, center, and end wavelength values and units based on special metadata attributes.

Parameters:
pData The DynamicObject containing the special metadata attributes from which to set the wavelength values and units.
convertToDisplayUnits If set to true, all wavelength values are converted to the units set in the WAVELENGTH_DISPLAY_UNITS_METADATA_NAME special metadata attribute. If set to false, the units will be set to WavelengthUnitsType::MICRONS, which is how the values are stored in the DynamicObject.
Returns:
Returns true if the start, center, and end values and units are successfully set from the special metadata attributes; otherwise returns false.
See also:
initializeFromWavelengths(), Special Metadata

virtual bool Wavelengths::applyToDynamicObject ( DynamicObject pData  )  [pure virtual]

Sets wavelength values and units special metadata attributes in a DynamicObject.

If starting, center, or ending values are not present, the existing special metadata attribute is removed. If isEmpty() returns true, the units attribute is removed.

The wavelength values are set into the DynamicObject in microns, regardless of the units returned by getUnits(). The units returned by getUnits() are set into the WAVELENGTH_DISPLAY_UNITS_METADATA_NAME attribute as the display units.

Parameters:
pData The DynamicObject in which to set the wavelength values and units special metadata attributes.
Returns:
Returns true if the start, center, and end values and units special metadata attributes are successfully updated in the DynamicObject; otherwise returns false.
See also:
initializeFromDynamicObject(), Special Metadata

static unsigned int Wavelengths::getNumWavelengths ( const DynamicObject pData  )  [static]

Returns the number of wavelength values contained in the special metadata attributes of a DynamicObject.

This method is a convenience method to get the number of wavelength values in a DynamicObject without creating a Wavelengths instance and without making copies of its wavelength vectors.

Parameters:
pData The DynamicObject from which to get the number of wavelength values contained in the special metadata attributes. This should be the DynamicObject containing the "Special" attribute.
Returns:
Returns the number of wavelengths values in the DynamicObject if start, center, or end wavelength values are present; otherwise returns 0.
See also:
getNumWavelengths(), isEmpty(), Special Metadata

Definition at line 364 of file Wavelengths.h.

static double Wavelengths::convertValue ( double  value,
WavelengthUnitsType  valueUnits,
WavelengthUnitsType  newUnits 
) [static]

Converts a wavelength value from one set of units to another.

Parameters:
value The wavelength value to convert.
valueUnits The units of the given value.
newUnits The units to which the value should be converted.
Returns:
Returns the converted wavelength value in the new units. Returns value if either units parameter is invalid.

Definition at line 409 of file Wavelengths.h.

static std::string Wavelengths::WavelengthType (  )  [static]

The type string that should be returned from PlugIn::getType() for types of plug-ins that import or export wavelengths.

Returns:
Returns a string populated with "Wavelength".

Definition at line 459 of file Wavelengths.h.

static std::string Wavelengths::WavelengthsArg (  )  [static]

A default name for a Wavelengths plug-in argument.

Returns:
Returns a string populated with "Wavelengths".
See also:
WavelengthFileArg()

Definition at line 471 of file Wavelengths.h.

static std::string Wavelengths::WavelengthFileArg (  )  [static]

A default name for a wavelengths file plug-in argument.

Returns:
Returns a string populated with "Wavelength File".
See also:
WavelengthsArg()

Definition at line 483 of file Wavelengths.h.


Software Development Kit - Opticks 4.9.0 Build 16218