Isis 3.0 Object Programmers' Reference |
Home |
Calculator for arrays. More...
#include <CubeCalculator.h>
Public Member Functions | |
CubeCalculator () | |
Constructor. | |
~CubeCalculator () | |
Destroys the CubeCalculator object. | |
void | Clear () |
This method completely resets the calculator. | |
void | prepareCalculations (QString 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 Types | |
enum | Calculations { CallNextMethod, PushNextData } |
This is used to define the overall action to perform in RunCalculations(..). More... | |
Private Member Functions | |
void | addMethodCall (void(Calculator::*method)(void)) |
This is a conveinience method for PrepareCalculations(...). | |
int | lastPushToCubeStats (QVector< Cube * > &inCubes) |
int | lastPushToCubeCameras (QVector< Cube * > &inCubes) |
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. | |
Private Attributes | |
QVector< Calculations > * | m_calculations |
This is what RunCalculations(...) will loop over. | |
QVector< void(Calculator::*)(void)> * | m_methods |
This stores the addresses to the methods RunCalculations(...) will call. | |
QVector< DataValue > * | m_dataDefinitions |
This stores the addressed to the methods RunCalculations(...) will push (constants), along with placeholders for simplicity to keep synchronized with the data definitions. | |
QVector< Statistics * > * | m_cubeStats |
QVector< Camera * > * | m_cubeCameras |
This two are used for keeping cameras and camera buffers internalized for quick computations. | |
QVector< CameraBuffers * > * | m_cameraBuffers |
int | m_outputSamples |
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.
2008-05-12 Steven Lambright - Removed references to CubeInfo
2008-06-18 Steven Lambright - Fixed documentation
2009-03-03 Steven Lambright - Added missing secant method call
2010-02-23 Steven Lambright - Added min2,max2
2010-04-08 Steven Lambright - Replaced min2,max with proper implementations of cubemin, cubemax, linemin, linemax, min and max. Added support for getting statistics of a cube for constants.
2012-02-02 Jeff Anderson - Added support for camera parameters such as phase, incidence, etc
2012-02-09 Jeff Anderson - Modified to conform to ISIS coding standards
2015-01-30 Ian Humphrey - Removed unused variable m_data. Deallocated unfreed dynamic memory. Added destructor. Fixes #2082.
Definition at line 66 of file CubeCalculator.h.
|
private |
This is used to define the overall action to perform in RunCalculations(..).
Enumerator | |
---|---|
CallNextMethod |
The calculation requires calling one of the methods. |
PushNextData |
The calculation requires input data. |
Definition at line 90 of file CubeCalculator.h.
Isis::CubeCalculator::CubeCalculator | ( | ) |
Constructor.
Definition at line 37 of file CubeCalculator.cpp.
Isis::CubeCalculator::~CubeCalculator | ( | ) |
Destroys the CubeCalculator object.
Definition at line 61 of file CubeCalculator.cpp.
|
inherited |
Pop an element, compute its absolute value, then push the result on the stack.
Definition at line 420 of file Calculator.cpp.
|
inherited |
Pops two elements, adds them, then pushes the sum on the stack.
Definition at line 343 of file Calculator.cpp.
References Isis::AddOperator().
|
private |
This is a conveinience method for PrepareCalculations(...).
This will cause RunCalculations(...) to execute this method in order.
method | The method to call, i.e. &Calculator::Multiply |
Definition at line 775 of file CubeCalculator.cpp.
|
inherited |
Pop two elements, AND them, then push the result on the stack.
Definition at line 692 of file Calculator.cpp.
References Isis::BitwiseAndOperator().
|
inherited |
Pops one element and push the arccosine.
Definition at line 790 of file Calculator.cpp.
|
inherited |
Pops one element and push the inverse hyperbolic cosine.
Definition at line 820 of file Calculator.cpp.
|
inherited |
Pops one element and push the arcsine.
Definition at line 780 of file Calculator.cpp.
|
inherited |
Pops one element and push the inverse hyperbolic sine.
Definition at line 810 of file Calculator.cpp.
|
inherited |
Pops one element and push the arctangent.
Definition at line 800 of file Calculator.cpp.
|
inherited |
Pops two elements and push the arctangent.
Definition at line 840 of file Calculator.cpp.
|
inherited |
Pops one element and push the inverse hyperbolic tangent.
Definition at line 830 of file Calculator.cpp.
|
virtual |
This method completely resets the calculator.
The prepared calculations will be erased when this is called.
Reimplemented from Isis::Calculator.
Definition at line 78 of file CubeCalculator.cpp.
|
inherited |
Pops one element and push the cosecant.
Definition at line 750 of file Calculator.cpp.
References Isis::CosecantOperator().
|
inherited |
Pops one element and push the cosine.
Definition at line 730 of file Calculator.cpp.
|
inherited |
Pops one element and push the hyperbolic cosine.
Definition at line 863 of file Calculator.cpp.
|
inherited |
Pops one element and push the cotangent.
Definition at line 770 of file Calculator.cpp.
References Isis::CotangentOperator().
|
inherited |
Pops two, divides them, then pushes the quotient on the stack.
Definition at line 367 of file Calculator.cpp.
References Isis::DivideOperator().
|
inherited |
Check if the stack is empty.
Definition at line 1015 of file Calculator.cpp.
|
inherited |
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.
Definition at line 630 of file Calculator.cpp.
References Isis::EqualOperator().
|
inherited |
Pops two elements, computes the power then pushes the result on the stack The exponent has to be a scalar.
Isis::iException::Math |
Definition at line 395 of file Calculator.cpp.
|
inherited |
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.
Definition at line 600 of file Calculator.cpp.
References Isis::GreaterThanOperator().
|
inherited |
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.
Definition at line 645 of file Calculator.cpp.
References Isis::GreaterThanOrEqualOperator().
|
inherited |
Pop the top element, then perform a left shift with zero fill.
Isis::iException::Math |
Definition at line 454 of file Calculator.cpp.
References _FILEINFO_.
|
inherited |
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.
Definition at line 615 of file Calculator.cpp.
References Isis::LessThanOperator().
|
inherited |
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.
Definition at line 660 of file Calculator.cpp.
References Isis::LessThanOrEqualOperator().
|
inherited |
Pop an element, compute its log, then push the result on the stack.
Isis::iException::Math |
Definition at line 432 of file Calculator.cpp.
|
inherited |
Pop an element, compute its base 10 log, then push the result on the stack.
Definition at line 442 of file Calculator.cpp.
|
inherited |
Pop one element, then push the maximum on the stack.
Definition at line 550 of file Calculator.cpp.
References Isis::IsSpecial().
|
inherited |
Pop two elements, then push the maximum on a pixel by pixel basis back on the stack.
Definition at line 585 of file Calculator.cpp.
References Isis::MaximumOperator().
|
inherited |
Pop one element, then push the minimum on the stack.
Definition at line 531 of file Calculator.cpp.
References Isis::IsSpecial().
|
inherited |
Pop two elements, then push the minimum on a pixel by pixel basis back on the stack.
Definition at line 570 of file Calculator.cpp.
References Isis::MinimumOperator().
|
inherited |
Pops two elements, mods them, then pushes the result on the stack.
Definition at line 379 of file Calculator.cpp.
References Isis::ModulusOperator().
|
inherited |
Pops two elements, multiplies them, then pushes the product on the stack.
Definition at line 330 of file Calculator.cpp.
References Isis::MultiplyOperator().
|
inherited |
Pops an element, negates it, then pushes the result.
Definition at line 320 of file Calculator.cpp.
References Isis::NegateOperator().
|
inherited |
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.
Definition at line 675 of file Calculator.cpp.
References Isis::NotEqualOperator().
|
inherited |
Pop two elements, OR them, then push the result on the stack.
Definition at line 706 of file Calculator.cpp.
References Isis::BitwiseOrOperator().
|
protectedinherited |
Performs the mathematical operations on each argument.
results | [out] The results of the performed operation |
arg1Start | The first argument to have the operation done on |
arg1End | One argument beyond the final argument to have the operation done upon |
operation | The operation to be done on all arguments |
Definition at line 1039 of file Calculator.cpp.
|
protectedinherited |
Performs the mathematical operation on each pair of arguments, or a set of agruments against a single argument.
results | [out] The results of the performed operation |
arg1Start | The first of the primary argument to have the operation done on |
arg1End | One arguement beyond the final primary argument to have the operation done upon |
arg2Start | The first of the secondaty argument to have the operation done on |
arg2End | One arguement beyond the final secondary argument to have the operation done upon |
operation | The operation to be done on all pairs of arguments |
Definition at line 1068 of file Calculator.cpp.
References _FILEINFO_.
|
inherited |
Pop an element off the stack.
keepSpecials | If true, special pixels will be preserved; otherwise, they will be mapped to double values |
Definition at line 958 of file Calculator.cpp.
References _FILEINFO_, Isis::Hrs, Isis::Lrs, and Isis::Null.
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 |
Definition at line 226 of file CubeCalculator.cpp.
References _FILEINFO_, Isis::E(), Isis::Sensor::EmissionAngle(), Isis::Sensor::IncidenceAngle(), Isis::Sensor::PhaseAngle(), Isis::PI(), Isis::Cube::sampleCount(), Isis::Camera::SetImage(), Isis::IString::ToDouble(), Isis::IString::ToInteger(), and Isis::IString::Token().
|
inherited |
Print the vector at the top of the stack.
Definition at line 998 of file Calculator.cpp.
|
inherited |
Push a scalar onto the stack.
scalar | The scalar that will be pushed on the stack |
Definition at line 902 of file Calculator.cpp.
|
inherited |
Push a buffer onto the stack.
buff | The buffer that will be pushed on the stack |
Definition at line 914 of file Calculator.cpp.
References Isis::IsHisPixel(), Isis::IsHrsPixel(), Isis::IsLisPixel(), Isis::IsLrsPixel(), Isis::IsNullPixel(), Isis::IsSpecial(), and Isis::Buffer::size().
|
inherited |
Push a vector onto the stack.
vect | The vector that will be pushed on the stack |
Definition at line 892 of file Calculator.cpp.
|
inherited |
Pop the top element, then perform a right shift with zero fill.
Isis::iException::Math |
Definition at line 493 of file Calculator.cpp.
References _FILEINFO_.
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::Math |
Definition at line 132 of file CubeCalculator.cpp.
References _FILEINFO_.
|
inherited |
Pops one element and push the secant.
Definition at line 760 of file Calculator.cpp.
References Isis::SecantOperator().
|
inherited |
Pops one element and push the sine.
Definition at line 720 of file Calculator.cpp.
|
inherited |
Pops one element and push the hyperbolic sine.
Definition at line 853 of file Calculator.cpp.
|
inherited |
Pop an element, compute its square root, then push the root on the stack.
Isis::iException::Math |
Definition at line 410 of file Calculator.cpp.
|
protectedinherited |
Returns the current stack size.
Get the current stack size.
Definition at line 883 of file Calculator.cpp.
|
inherited |
Pops two elements, subtracts them, then pushes the difference on the stack.
Definition at line 355 of file Calculator.cpp.
References Isis::SubtractOperator().
|
inherited |
Pops one element and push the tangent.
Definition at line 740 of file Calculator.cpp.
|
inherited |
Pops one element and push the hyperbolic tangent.
Definition at line 873 of file Calculator.cpp.
|
private |
This is what RunCalculations(...) will loop over.
The action to perform (push data or execute calculation) is defined in this vector.
Definition at line 108 of file CubeCalculator.h.
This two are used for keeping cameras and camera buffers internalized for quick computations.
Definition at line 137 of file CubeCalculator.h.
This stores the addressed to the methods RunCalculations(...) will push (constants), along with placeholders for simplicity to keep synchronized with the data definitions.
This defines what kind of data RunCalculations(...) will push onto the calculator. Constants will be taken from p_data, which is synchronized (index-wise) with this vector.
Definition at line 129 of file CubeCalculator.h.
|
private |
This stores the addresses to the methods RunCalculations(...) will call.
Definition at line 114 of file CubeCalculator.h.