public interface UnitService extends ImageJService
Modifier and Type | Method and Description |
---|---|
void |
defineUnit(String unitName,
String baseUnit,
Calibrator calibrator)
Defines a unit conversion that can be referred to via the value() method.
|
void |
defineUnit(String unitName,
String baseUnit,
double scale)
Defines a unit conversion that can be referred to via the value() method.
|
void |
defineUnit(String unitName,
String baseUnit,
double scale,
double offset)
Defines a unit conversion that can be referred to via the value() method.
|
double |
value(double inputValue,
String inputUnit,
String outputUnit)
Returns a value after conversion between two compatible types of units.
|
initialize, registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
dispose
double value(double inputValue, String inputUnit, String outputUnit)
inputValue
- The double representing the number of input units.inputUnit
- The string representing the input unit.outputUnit
- The string representing the output unit.IllegalArgumentException
- if conversion fails with the given
arguments (e.g., if the units are incompatible).void defineUnit(String unitName, String baseUnit, double scale)
unitName
- The name of the unit being defined e.g. "fliggs".baseUnit
- The unit the defined unit is based upon e.g. "m/s^2".scale
- The ratio of defined units to base units e.g. 14.2.void defineUnit(String unitName, String baseUnit, double scale, double offset)
unitName
- The name of the unit being defined e.g. "fliggs".baseUnit
- The unit the defined unit is based upon e.g. "m/s^2".scale
- The ratio of defined units to base units e.g. 14.2.offset
- The offset of defined units to base units e.g. 3.3.void defineUnit(String unitName, String baseUnit, Calibrator calibrator)
Calibrator
that handles conversion. The Calibrator allows any kind of conversion
between units including nonlinear ones (i.e. can support log units).unitName
- The name of the unit being defined e.g. "fliggs".baseUnit
- The unit the defined unit is based upon e.g. "m/s^2".calibrator
- The Calibrator the maps between the two unit spaces.Copyright © 2014–2022 ImageJ. All rights reserved.