USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::CubeCalculator Class Reference
[Math]

Calculator for arrays. More...

#include <CubeCalculator.h>

Inherits Isis::Calculator.

List of all members.

Public Member Functions

 CubeCalculator ()
 Constructor.
void Clear ()
 This method completely resets the calculator.
void PrepareCalculations (iString equation, QVector< Cube * > &inCubes, Cube *outCube)
 This method builds a list of actions to perform based on the postfix expression.
QVector< double > RunCalculations (QVector< Buffer * > &cubeData, int line, int band)
 This method will execute the calculations built up when PrepareCalculations was called.

Private Member Functions

void Negative ()
 Pops an element, negates it, then pushes the result.
void Multiply ()
 Pops two elements, multiplies them, then pushes the product on the stack.
void Add ()
 Pops two elements, adds them, then pushes the sum on the stack.
void Subtract ()
 Pops two elements, subtracts them, then pushes the difference on the stack.
void Divide ()
 Pops two, divides them, then pushes the quotient on the stack.
void Modulus ()
 Pops two elements, mods them, then pushes the result on the stack.
void Exponent ()
 Pops two elements, computes the power then pushes the result on the stack The exponent has to be a scalar.
void SquareRoot ()
 Pop an element, compute its square root, then push the root on the stack.
void AbsoluteValue ()
 Pop an element, compute its absolute value, then push the result on the stack.
void Log ()
 Pop an element, compute its log, then push the result on the stack.
void Log10 ()
 Pop an element, compute its base 10 log, then push the result on the stack.
void LeftShift ()
 Pop the top element, then perform a left shift with zero fill.
void RightShift ()
 Pop the top element, then perform a right shift with zero fill.
void MinimumPixel ()
 Pop two elements, then push the minimum on a pixel by pixel basis back on the stack.
void MaximumPixel ()
 Pop two elements, then push the maximum on a pixel by pixel basis back on the stack.
void MinimumLine ()
 Pop one element, then push the minimum on the stack.
void MaximumLine ()
 Pop one element, then push the maximum on the stack.
void Minimum2 ()
void Maximum2 ()
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.
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.
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.
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.
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.
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.
void And ()
 Pop two elements, AND them, then push the result on the stack.
void Or ()
 Pop two elements, OR them, then push the result on the stack.
void Sine ()
 Pops one element and push the sine.
void Cosine ()
 Pops one element and push the cosine.
void Tangent ()
 Pops one element and push the tangent.
void Secant ()
 Pops one element and push the secant.
void Cosecant ()
 Pops one element and push the cosecant.
void Cotangent ()
 Pops one element and push the cotangent.
void Arcsine ()
 Pops one element and push the arcsine.
void Arccosine ()
 Pops one element and push the arccosine.
void Arctangent ()
 Pops one element and push the arctangent.
void Arctangent2 ()
 Pops two elements and push the arctangent.
void SineH ()
 Pops one element and push the hyperbolic sine.
void CosineH ()
 Pops one element and push the hyperbolic cosine.
void TangentH ()
 Pops one element and push the hyperbolic tangent.
void ArcsineH ()
 Pops one element and push the inverse hyperbolic sine.
void ArccosineH ()
 Pops one element and push the inverse hyperbolic cosine.
void ArctangentH ()
 Pops one element and push the inverse hyperbolic tangent.
void Push (double scalar)
 Push a scalar onto the stack.
void Push (Buffer &buff)
 Push a buffer onto the stack.
void Push (QVector< double > &vect)
 Push a vector onto the stack.
QVector< double > Pop (bool keepSpecials=false)
 Pop an element off the stack.
void PrintTop ()
 Print the vector at the top of the stack.
bool Empty ()
 Check if the stack is empty.
void PerformOperation (QVector< double > &results, QVector< double >::iterator arg1Start, QVector< double >::iterator arg1End, double operation(double))
 Performs the mathematical operations on each argument.
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.
int StackSize ()
 Returns the current stack size.

Detailed Description

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.

Author:
2008-03-26 Steven Lambright

Constructor & Destructor Documentation

Isis::CubeCalculator::CubeCalculator (  ) 

Constructor.


Member Function Documentation

void Isis::CubeCalculator::Clear (  )  [virtual]

This method completely resets the calculator.

The prepared calculations will be erased when this is called.

Reimplemented from Isis::Calculator.

Referenced by PrepareCalculations().

void Isis::CubeCalculator::PrepareCalculations ( iString  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.

Parameters:
equation The equation in postfix notation
inCubes The input cubes
outCube The output cube

References _FILEINFO_, Isis::Calculator::AbsoluteValue(), Isis::Calculator::Add(), Isis::Calculator::Arccosine(), Isis::Calculator::Arcsine(), Isis::Calculator::Arctangent(), Isis::Calculator::Arctangent2(), Isis::DataValue::band, Clear(), Isis::DataValue::constant, Isis::Calculator::Cosecant(), Isis::Calculator::Cosine(), Isis::Calculator::CosineH(), Isis::Calculator::Cotangent(), Isis::DataValue::cubeData, Isis::Calculator::Divide(), Isis::E(), Isis::Calculator::Equal(), Isis::Calculator::Exponent(), Isis::Cube::getSampleCount(), Isis::Calculator::GreaterThan(), Isis::Calculator::GreaterThanOrEqual(), Isis::Calculator::LeftShift(), Isis::Calculator::LessThan(), Isis::Calculator::LessThanOrEqual(), Isis::DataValue::line, Isis::Calculator::Log(), Isis::Calculator::Log10(), Isis::iException::Math, Isis::Calculator::MaximumLine(), Isis::Calculator::MaximumPixel(), Isis::iException::Message(), Isis::Calculator::MinimumLine(), Isis::Calculator::MinimumPixel(), Isis::Calculator::Modulus(), Isis::Calculator::Multiply(), Isis::Calculator::Negative(), Isis::Calculator::NotEqual(), Isis::PI(), Isis::Calculator::RightShift(), Isis::DataValue::sample, Isis::Calculator::Secant(), Isis::Calculator::Sine(), Isis::Calculator::SineH(), Isis::Calculator::SquareRoot(), Isis::Calculator::Subtract(), Isis::Calculator::Tangent(), Isis::Calculator::TangentH(), Isis::iString::ToDouble(), 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.

Parameters:
cubeData The input cubes' data
curLine The current line in the output cube
curBand The current band in the output cube
Returns:
std::vector<double> The results of the calculations (with Isis Special Pixels)
Exceptions:
Isis::iException::Math 

References _FILEINFO_, Isis::DataValue::band, Isis::DataValue::constant, Isis::DataValue::cubeData, Isis::DataValue::getContant(), Isis::DataValue::getCubeIndex(), Isis::DataValue::getType(), Isis::DataValue::line, Isis::iException::Math, Isis::iException::Message(), Isis::Calculator::Pop(), Isis::Calculator::Push(), Isis::DataValue::sample, and Isis::Calculator::StackSize().


The documentation for this class was generated from the following files: