Isis 3 Developer Reference
|
Calculator for arrays. More...
#include <CubeCalculator.h>
Public Member Functions | |
CubeCalculator () | |
Constructs a CubeCalculator. More... | |
~CubeCalculator () | |
Destroys the CubeCalculator object. More... | |
void | Clear () |
This method completely resets the calculator. More... | |
void | prepareCalculations (QString equation, QVector< Cube *> &inCubes, Cube *outCube) |
This method builds a list of actions to perform based on the postfix expression. More... | |
QVector< double > | runCalculations (QVector< Buffer *> &cubeData, int line, int band) |
This method will execute the calculations built up when PrepareCalculations was called. More... | |
Private Member Functions | |
void | Negative () |
Pops an element, negates it, then pushes the result. More... | |
void | Multiply () |
Pops two elements, multiplies them, then pushes the product on the stack. More... | |
void | Add () |
Pops two elements, adds them, then pushes the sum on the stack. More... | |
void | Subtract () |
Pops two elements, subtracts them, then pushes the difference on the stack. More... | |
void | Divide () |
Pops two, divides them, then pushes the quotient on the stack. More... | |
void | Modulus () |
Pops two elements, mods them, then pushes the result on the stack. More... | |
void | Exponent () |
Pops two elements, computes the power then pushes the result on the stack The exponent has to be a scalar. More... | |
void | SquareRoot () |
Pop an element, compute its square root, then push the root on the stack. More... | |
void | AbsoluteValue () |
Pop an element, compute its absolute value, then push the result on the stack. More... | |
void | Log () |
Pop an element, compute its log, then push the result on the stack. More... | |
void | Log10 () |
Pop an element, compute its base 10 log, then push the result on the stack. More... | |
void | LeftShift () |
Pop the top element, then perform a left shift with zero fill. More... | |
void | RightShift () |
Pop the top element, then perform a right shift with zero fill. More... | |
void | MinimumPixel () |
Pop two elements, then push the minimum on a pixel by pixel basis back on the stack. More... | |
void | MaximumPixel () |
Pop two elements, then push the maximum on a pixel by pixel basis back on the stack. More... | |
void | MinimumLine () |
Pop one element, then push the minimum on the stack. More... | |
void | MaximumLine () |
Pop one element, then push the maximum on the stack. More... | |
void | Minimum2 () |
Not implemented in Calculator.cpp. More... | |
void | Maximum2 () |
Not implemented in Calculator.cpp. More... | |
void | GreaterThan () |
Pop two elements off the stack and compare them to see where one is greater than the other, then push the results on the stack. More... | |
void | LessThan () |
Pop two elements off the stack and compare them to see where one is less than the other, then push the results on the stack. More... | |
void | Equal () |
Pop two elements off the stack and compare them to see where one is equal to the other, then push the results on the stack. More... | |
void | LessThanOrEqual () |
Pop two elements off the stack and compare them to see where one is less than or equal to the other, then push the results on the stack. More... | |
void | GreaterThanOrEqual () |
Pop two elements off the stack and compare them to see where one is greater than or equal to the other, then push the results on the stack. More... | |
void | NotEqual () |
Pop two elements off the stack and compare them to see where one is not equal to the other, then push the results on the stack. More... | |
void | And () |
Pop two elements, AND them, then push the result on the stack. More... | |
void | Or () |
Pop two elements, OR them, then push the result on the stack. More... | |
void | Sine () |
Pops one element and push the sine. More... | |
void | Cosine () |
Pops one element and push the cosine. More... | |
void | Tangent () |
Pops one element and push the tangent. More... | |
void | Secant () |
Pops one element and push the secant. More... | |
void | Cosecant () |
Pops one element and push the cosecant. More... | |
void | Cotangent () |
Pops one element and push the cotangent. More... | |
void | Arcsine () |
Pops one element and push the arcsine. More... | |
void | Arccosine () |
Pops one element and push the arccosine. More... | |
void | Arctangent () |
Pops one element and push the arctangent. More... | |
void | Arctangent2 () |
Pops two elements and push the arctangent. More... | |
void | SineH () |
Pops one element and push the hyperbolic sine. More... | |
void | CosineH () |
Pops one element and push the hyperbolic cosine. More... | |
void | TangentH () |
Pops one element and push the hyperbolic tangent. More... | |
void | ArcsineH () |
Pops one element and push the inverse hyperbolic sine. More... | |
void | ArccosineH () |
Pops one element and push the inverse hyperbolic cosine. More... | |
void | ArctangentH () |
Pops one element and push the inverse hyperbolic tangent. More... | |
void | Push (double scalar) |
Push a scalar onto the stack. More... | |
void | Push (Buffer &buff) |
Push a buffer onto the stack. More... | |
void | Push (QVector< double > &vect) |
Push a vector onto the stack. More... | |
QVector< double > | Pop (bool keepSpecials=false) |
Pop an element off the stack. More... | |
void | PrintTop () |
Print the vector at the top of the stack. More... | |
bool | Empty () |
Check if the stack is empty. More... | |
void | PerformOperation (QVector< double > &results, QVector< double >::iterator arg1Start, QVector< double >::iterator arg1End, double operation(double)) |
Performs the mathematical operations on each argument. More... | |
void | PerformOperation (QVector< double > &results, QVector< double >::iterator arg1Start, QVector< double >::iterator arg1End, QVector< double >::iterator arg2Start, QVector< double >::iterator arg2End, double operation(double, double)) |
Performs the mathematical operation on each pair of arguments, or a set of agruments against a single argument. More... | |
int | StackSize () |
Returns the current stack size. More... | |
Calculator for arrays.
This class is a RPN calculator on cubes. The base Calculator class is used in conjunction with methods to retrieve data from a cube and perform calculations.
Isis::CubeCalculator::CubeCalculator | ( | ) |
Constructs a CubeCalculator.
Isis::CubeCalculator::~CubeCalculator | ( | ) |
Destroys the CubeCalculator object.
|
virtual |
This method completely resets the calculator.
Frees dynamic memory in container members.
The prepared calculations will be erased when this is called.
Reimplemented from Isis::Calculator.
void Isis::CubeCalculator::prepareCalculations | ( | QString | equation, |
QVector< Cube *> & | inCubes, | ||
Cube * | outCube | ||
) |
This method builds a list of actions to perform based on the postfix expression.
Error checking is done using the inCubeInfos, and the outCubeInfo is necessary to tell the dimensions of the output cube. Call this method before calling RunCalculations(). This method will also erase all calculator history before building up a new set of calculations to run.
equation | The equation in postfix notation |
inCubes | The input cubes |
outCube | The output cube |
IException::Unknown | "Invalid file number" |
IException::Unknown | "Unidentified operator" |
References _FILEINFO_, Isis::E, Isis::PI, Isis::Cube::sampleCount(), Isis::IString::ToDouble(), Isis::IString::ToInteger(), and Isis::IString::Token().
QVector< double > Isis::CubeCalculator::runCalculations | ( | QVector< Buffer *> & | cubeData, |
int | curLine, | ||
int | curBand | ||
) |
This method will execute the calculations built up when PrepareCalculations was called.
cubeData | The input cubes' data |
curLine | The current line in the output cube |
curBand | The current band in the output cube |
IException::Unknown | "Too many operands in the equation." |
References _FILEINFO_, Isis::DataValue::constant(), Isis::DataValue::cubeIndex(), and Isis::DataValue::type().