|
| LatticeExprNode () |
| Default constructor.
|
|
| LatticeExprNode (Int64 constant) |
| Unary constant expression constructors.
|
|
| LatticeExprNode (Int constant) |
|
| LatticeExprNode (uInt constant) |
|
| LatticeExprNode (Long constant) |
|
| LatticeExprNode (Float constant) |
|
| LatticeExprNode (Double constant) |
|
| LatticeExprNode (const Complex &constant) |
|
| LatticeExprNode (const DComplex &constant) |
|
| LatticeExprNode (Bool constant) |
|
| LatticeExprNode (const IPosition &) |
| Constructor from an IPosition (containing indices or axes).
|
|
| LatticeExprNode (const Lattice< Float > &lattice) |
| Lattice expression (gets Lattice pixels) constructors.
|
|
| LatticeExprNode (const Lattice< Double > &lattice) |
|
| LatticeExprNode (const Lattice< Complex > &lattice) |
|
| LatticeExprNode (const Lattice< DComplex > &lattice) |
|
| LatticeExprNode (const Lattice< Bool > &lattice) |
|
| LatticeExprNode (const MaskedLattice< Float > &lattice) |
|
| LatticeExprNode (const MaskedLattice< Double > &lattice) |
|
| LatticeExprNode (const MaskedLattice< Complex > &lattice) |
|
| LatticeExprNode (const MaskedLattice< DComplex > &lattice) |
|
| LatticeExprNode (const MaskedLattice< Bool > &lattice) |
|
| LatticeExprNode (const LCRegion ®ion) |
| Create a lattice expression from a region.
|
|
| LatticeExprNode (const Slicer &slicer) |
|
| LatticeExprNode (const LattRegionHolder ®ion) |
|
LatticeExprNode | operator[] (const LatticeExprNode &cond) const |
| Masking operator using a condition.
|
|
| LatticeExprNode (const LatticeExprNode &other) |
| Copy constructor (reference semantics)
|
|
virtual | ~LatticeExprNode () |
| Destructor, does nothing.
|
|
LatticeExprNode & | operator= (const LatticeExprNode &other) |
| Assignment (reference semantics)
|
|
const IPosition & | getIPosition () const |
| Get the IPosition.
|
|
std::shared_ptr< LELInterface< Float > > | makeFloat () const |
| Convert the expression to another data type.
|
|
std::shared_ptr< LELInterface< Double > > | makeDouble () const |
|
std::shared_ptr< LELInterface< Complex > > | makeComplex () const |
|
std::shared_ptr< LELInterface< DComplex > > | makeDComplex () const |
|
std::shared_ptr< LELInterface< Bool > > | makeBool () const |
|
void | eval (LELArray< Float > &result, const Slicer §ion) const |
| Evaluate the expression.
|
|
void | eval (LELArray< Double > &result, const Slicer §ion) const |
|
void | eval (LELArray< Complex > &result, const Slicer §ion) const |
|
void | eval (LELArray< DComplex > &result, const Slicer §ion) const |
|
void | eval (LELArray< Bool > &result, const Slicer §ion) const |
|
void | evalRef (LELArrayRef< Float > &result, const Slicer §ion) const |
| Evaluate the expression.
|
|
void | evalRef (LELArrayRef< Double > &result, const Slicer §ion) const |
|
void | evalRef (LELArrayRef< Complex > &result, const Slicer §ion) const |
|
void | evalRef (LELArrayRef< DComplex > &result, const Slicer §ion) const |
|
void | evalRef (LELArrayRef< Bool > &result, const Slicer §ion) const |
|
void | eval (Float &result) const |
| Evaluate the expression (in case it is a scalar).
|
|
void | eval (Double &result) const |
|
void | eval (Complex &result) const |
|
void | eval (DComplex &result) const |
|
void | eval (Bool &result) const |
|
Float | getFloat () const |
|
Double | getDouble () const |
|
Complex | getComplex () const |
|
DComplex | getDComplex () const |
|
Bool | getBool () const |
|
Array< Float > | getArrayFloat () const |
| Evaluate the expression (in case it is a constant array).
|
|
Array< Double > | getArrayDouble () const |
|
Array< Complex > | getArrayComplex () const |
|
Array< DComplex > | getArrayDComplex () const |
|
Array< Bool > | getArrayBool () const |
|
DataType | dataType () const |
| Get the data type of the expression.
|
|
Bool | isRegion () const |
| Is the expression node a region?
|
|
Bool | isScalar () const |
| Is the result of "eval" a scalar?
|
|
Bool | isMasked () const |
| Is the result of "eval" masked?
|
|
Bool | isInvalidScalar () const |
| Holds the node an invalid scalar?
|
|
const IPosition & | shape () const |
| Return the shape of the Lattice including all degenerate axes (ie.
|
|
const LELAttribute & | getAttribute () const |
| Get the attribute object of the expression.
|
|
Bool | replaceScalarExpr () |
| Replace a scalar subexpression by its result.
|
|
| LatticeExprNode (const std::shared_ptr< LELInterface< Float > > &expr) |
| Make the object from a std::shared_ptr<LELInterface> pointer.
|
|
| LatticeExprNode (const std::shared_ptr< LELInterface< Double > > &expr) |
|
| LatticeExprNode (const std::shared_ptr< LELInterface< Complex > > &expr) |
|
| LatticeExprNode (const std::shared_ptr< LELInterface< DComplex > > &expr) |
|
| LatticeExprNode (const std::shared_ptr< LELInterface< Bool > > &expr) |
|
Bool | lock (FileLocker::LockType, uInt nattempts) |
| Handle locking of the LatticeExpr which is delegated to all of its parts.
|
|
void | unlock () |
|
Bool | hasLock (FileLocker::LockType) const |
|
void | resync () |
|
|
static Bool | areRegions (const LatticeExprNode &left, const LatticeExprNode &right) |
| Test if both operands represent a region.
|
|
static LatticeExprNode | newNumUnary (LELUnaryEnums::Operation oper, const LatticeExprNode &expr) |
| Create a new node for a numerical unary operation.
|
|
static LatticeExprNode | newNumFunc1D (LELFunctionEnums::Function func, const LatticeExprNode &expr) |
| Create a new node for a numerical function with 1 argument.
|
|
static LatticeExprNode | newRealFunc1D (LELFunctionEnums::Function func, const LatticeExprNode &expr) |
| Create a new node for a real numerical function with 1 argument.
|
|
static LatticeExprNode | newComplexFunc1D (LELFunctionEnums::Function func, const LatticeExprNode &expr) |
| Create a new node for a complex numerical function with 1 argument.
|
|
static LatticeExprNode | newNumReal1D (LELFunctionEnums::Function func, const LatticeExprNode &expr) |
| Create a new node for a numerical function with 1 argument that returns a real number.
|
|
static LatticeExprNode | newNumFunc2D (LELFunctionEnums::Function func, const LatticeExprNode &left, const LatticeExprNode &right) |
| Create a new node for a numerical function with 2 arguments.
|
|
static LatticeExprNode | newNumBinary (LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right) |
| Create a new node for a numerical binary operator.
|
|
static LatticeExprNode | newLogBinary (LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right) |
| Create a new node for a logical binary operator.
|
|
static LatticeExprNode | newBinaryCmp (LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right) |
| Create a new node for a comparison binary operator.
|
|
static Int | makeEqualDim (LatticeExprNode &expr0, LatticeExprNode &expr1) |
| Make (if needed and if possible) the expression nodes such that the dimensionalities are equal.
|
|
|
LatticeExprNode | operator+ (const LatticeExprNode &expr) |
| All global functions need to be declared as friends.
|
|
LatticeExprNode | operator- (const LatticeExprNode &expr) |
|
LatticeExprNode | operator! (const LatticeExprNode &expr) |
|
LatticeExprNode | operator+ (const LatticeExprNode &left, const LatticeExprNode &right) |
| Numerical binary operators.
|
|
LatticeExprNode | operator- (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator* (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator/ (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator% (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator^ (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator== (const LatticeExprNode &left, const LatticeExprNode &right) |
| Relational binary operators.
|
|
LatticeExprNode | operator> (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator>= (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator< (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator<= (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator!= (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | operator&& (const LatticeExprNode &left, const LatticeExprNode &right) |
| Logical binary operators.
|
|
LatticeExprNode | operator|| (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | sin (const LatticeExprNode &expr) |
| Numerical 1-argument functions.
|
|
LatticeExprNode | sinh (const LatticeExprNode &expr) |
|
LatticeExprNode | asin (const LatticeExprNode &expr) |
|
LatticeExprNode | cos (const LatticeExprNode &expr) |
|
LatticeExprNode | cosh (const LatticeExprNode &expr) |
|
LatticeExprNode | acos (const LatticeExprNode &expr) |
|
LatticeExprNode | tan (const LatticeExprNode &expr) |
|
LatticeExprNode | tanh (const LatticeExprNode &expr) |
|
LatticeExprNode | atan (const LatticeExprNode &expr) |
|
LatticeExprNode | exp (const LatticeExprNode &expr) |
|
LatticeExprNode | log (const LatticeExprNode &expr) |
|
LatticeExprNode | log10 (const LatticeExprNode &expr) |
|
LatticeExprNode | sqrt (const LatticeExprNode &expr) |
|
LatticeExprNode | sign (const LatticeExprNode &expr) |
|
LatticeExprNode | round (const LatticeExprNode &expr) |
|
LatticeExprNode | ceil (const LatticeExprNode &expr) |
|
LatticeExprNode | floor (const LatticeExprNode &expr) |
|
LatticeExprNode | conj (const LatticeExprNode &expr) |
|
LatticeExprNode | atan2 (const LatticeExprNode &left, const LatticeExprNode &right) |
| Numerical 2-argument functions.
|
|
LatticeExprNode | pow (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | fmod (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | min (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | max (const LatticeExprNode &left, const LatticeExprNode &right) |
|
LatticeExprNode | formComplex (const LatticeExprNode &left, const LatticeExprNode &right) |
| Form a complex number from two real numbers.
|
|
LatticeExprNode | abs (const LatticeExprNode &expr) |
| Numerical 1-argument functions which result in a real number regardless of input expression type.
|
|
LatticeExprNode | arg (const LatticeExprNode &expr) |
|
LatticeExprNode | real (const LatticeExprNode &expr) |
|
LatticeExprNode | imag (const LatticeExprNode &expr) |
|
LatticeExprNode | min (const LatticeExprNode &expr) |
| 1-argument functions operating on a numeric expression resulting in a scalar
|
|
LatticeExprNode | max (const LatticeExprNode &expr) |
|
LatticeExprNode | sum (const LatticeExprNode &expr) |
|
LatticeExprNode | median (const LatticeExprNode &expr) |
|
LatticeExprNode | mean (const LatticeExprNode &expr) |
|
LatticeExprNode | variance (const LatticeExprNode &expr) |
|
LatticeExprNode | stddev (const LatticeExprNode &expr) |
|
LatticeExprNode | avdev (const LatticeExprNode &expr) |
|
LatticeExprNode | fractile (const LatticeExprNode &expr, const LatticeExprNode &fraction) |
| Determine the value of the element at the part fraction from the beginning of the given lattice.
|
|
LatticeExprNode | fractileRange (const LatticeExprNode &expr, const LatticeExprNode &fraction1, const LatticeExprNode &fraction2) |
| Determine the value range of the elements at the part fraction1 and fraction2 from the beginning of the given lattice.
|
|
LatticeExprNode | fractileRange (const LatticeExprNode &expr, const LatticeExprNode &fraction) |
|
LatticeExprNode | nelements (const LatticeExprNode &expr) |
| 1-argument function to get the number of elements in a lattice.
|
|
LatticeExprNode | ndim (const LatticeExprNode &expr) |
| 1-argument function to get the dimensionality of a lattice.
|
|
LatticeExprNode | length (const LatticeExprNode &expr, const LatticeExprNode &axis) |
| 2-argument function to get the length of an axis.
|
|
LatticeExprNode | indexin (const LatticeExprNode &axis, const LatticeExprNode &indexFlags) |
| 2-argument function telling per pixel if its index on the given axis is contained in the 2nd argument.
|
|
LatticeExprNode | rebin (const LatticeExprNode &expr, const LatticeExprNode &bin) |
| 2-argument function rebinning Lattice by given factors.
|
|
LatticeExprNode | isNaN (const LatticeExprNode &expr) |
| Test if a value is a NaN.
|
|
LatticeExprNode | any (const LatticeExprNode &expr) |
| Functions operating on a logical expression resulting in a scalar; Functions "any" (are any pixels "True") and "all" (are all pixels "True") result in a Bool; functions "ntrue" and "nfalse" result in a Double.
|
|
LatticeExprNode | all (const LatticeExprNode &expr) |
|
LatticeExprNode | ntrue (const LatticeExprNode &expr) |
|
LatticeExprNode | nfalse (const LatticeExprNode &expr) |
|
LatticeExprNode | mask (const LatticeExprNode &expr) |
| This function returns the mask of the given expression.
|
|
LatticeExprNode | value (const LatticeExprNode &expr) |
| This function returns the value of the expression without a mask.
|
|
LatticeExprNode | amp (const LatticeExprNode &left, const LatticeExprNode &right) |
| This function finds sqrt(left^2+right^2) .
|
|
LatticeExprNode | pa (const LatticeExprNode &left, const LatticeExprNode &right) |
| This function finds 180/pi*atan2(left,right)/2 .
|
|
LatticeExprNode | spectralindex (const LatticeExprNode &left, const LatticeExprNode &right) |
| This function finds the spectral index alpha = log(s1/s2) / log(f1/f2) .
|
|
LatticeExprNode | iif (const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2) |
| Function resembling the ternary ?: construct in C++.
|
|
LatticeExprNode | replace (const LatticeExprNode &arg1, const LatticeExprNode &arg2) |
| This function replaces every masked-off element in the first argument with the corresponding element from the second argument.
|
|
LatticeExprNode | toFloat (const LatticeExprNode &expr) |
| Functions to convert to the given data type.
|
|
LatticeExprNode | toDouble (const LatticeExprNode &expr) |
|
LatticeExprNode | toComplex (const LatticeExprNode &expr) |
|
LatticeExprNode | toDComplex (const LatticeExprNode &expr) |
|
LatticeExprNode | toBool (const LatticeExprNode &expr) |
|
Bridging class to allow C++ expressions involving lattices
Intended use:
Public interface
Review Status
- Date Reviewed:
- yyyy/mm/dd
Prerequisite
Etymology
The name is derived from the fact that this class provides an expression interface to the user which s/he may use to write C++ expressions involving Lattices. This class actually constructs the nodes of the expression tree, hence its name. It is used by the envelope class LatticeExpr and provides a bridge to the letter classes derived from LELInterface.
Synopsis
This class is part of the interface which allows the C++ programmer to enter mathematical expressions involving Lattices. It is is part of a Letter/envelope scheme. It's actually a bridge between the envelope class (LatticeExpr) and the letter classes (derived from LELInterface) and it exists largely to handle type conversions. In a single type environment, the envelope class could have directly called the letter classes.
The envelope and bridge provide the interface which the programmer sees. The letter classes do the real work and are hidden from the programmer.
All the expression manipulation functionality that the user has access to is viewable in this class; it is here that the operators, functions and constructors are defined. These allow the programmer to write mathematical expressions which involve Lattices. The letter classes take care of the optimal traversal of the Lattice and the memory mangement thereof. Thus the Lattices are iterated through and the expressions evaluated for each chunk (usually a tile shape) of the iteration.
A description of the implementation details of these classes can be found in Note 216
The available functionality is defined by the global friend functions and operators, plus the public constructors. The other public members functions are generally not of interest to the user of this class.
Generally, if one writes an expression such as a.copyData(sin(b))
, the expression is automatically converted first to a LatticeExprNode and then to a LatticeExpr (which is a Lattice) before evaluation occurs. However, it may occur that you wish to build an expression from subexpressions. To do this, you must explcitly create objects of class LatticeExprNode. You cannot manipulate subexpressions of type LatticeExpr<T>. See below for an example.
Example
f2.set(2.0);
f1.copyData(2*f2+f2);
In this example, the values of the pixels in Lattice f1 are set to the values resulting from the expression "2*f2 + f2" I.e. the expression is evaluated for each pixel in the Lattices
Note that :
1) the Lattice::copyData function is expecting a Lattice argument.
2) LatticeExpr inherits from Lattice and therefore a LatticeExpr object is a valid argument object type 3) The expression in the copyData call is automatically converted to a LatticeExprNode by the constructors and operators in LatticeExprNode 4) The LatticeExprNode object so created is automatically converted to a LatticeExpr by casting functions in LatticeExprNode.
Example
f2.set(1.0); d.set(2.0); c.set(Complex(2.0,3.0)); b.set(
True);
friend LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode ntrue(const LatticeExprNode &expr)
friend LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type.
friend LatticeExprNode cos(const LatticeExprNode &expr)
constexpr double pi
Pi and functions thereof:
In this rather silly example, we fill Lattice "f1" with the result of the expression. The expression shows the use of constants, unary operations, binary operations, 1D and 2D functions. It also shows how mixed types can be handled. The output Lattice is a Float, whereas mixed into the expression are subexpressions involving Float, Double, Complex and Bool Lattices.
Example
f2.set(2.0);
f1.copyData(exp1+exp2);
friend LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
In this example, the expression is "sin(f2) + pow(f2,2.0)", but we have put it together from two subexpressions contained in LatticeExprNode objects exp1 and exp2. Again the LatticeExprNode object formed from summing exp1 and exp2 is automatically converted to a LatticeExpr for consumption by copyData
Motivation
The Lattice expression classes enable the C++ programmer much simpler handling of mathematical expressions involving lattices. In addition, these classes provide the infrastructure on top of which we can build an image calculator for Glish users
To Do
Definition at line 438 of file LatticeExprNode.h.