Isis 3 Programmer Reference
Isis::CubeCalculator Class Reference

Calculator for arrays. More...

#include <CubeCalculator.h>

Inheritance diagram for Isis::CubeCalculator:
Inheritance graph
Collaboration diagram for Isis::CubeCalculator:
Collaboration graph

Public Member Functions

 CubeCalculator ()
 Constructs a CubeCalculator.
 
 ~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)
 Creates statistics internally for the last cube data pushed to the data definitions.
 
int lastPushToCubeCameras (QVector< Cube * > &inCubes)
 Creates internal camera for the last pushed cube data.
 
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 ()
 Not implemented in Calculator.cpp.
 
void Maximum2 ()
 Not implemented in Calculator.cpp.
 
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 defines what kind of data RunCalculations(...) will push onto the calculator.
 
QVector< Statistics * > * m_cubeStats
 Stores the cube statistics for the input cubes.
 
QVector< Camera * > * m_cubeCameras
 Stores the cameras for the input cubes.
 
QVector< CameraBuffers * > * m_cameraBuffers
 Stores the camera buffers that are enabled for camera related calculations.
 
int m_outputSamples
 Number of samples in the output cube.
 
QStack< QVector< double > > * p_valStack
 The current stack of arguments.
 

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
History

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.

2016-10-13 Ian Humphrey - Updated to correctly calculate center camera angles for band-depedent images. Integrated Moses Milazzo's (moses.nosp@m.@usg.nosp@m.s.gov) changes for correctly calculating camera angles for band-dependent images. Quick documentation and coding standards review (moved inline implementations to cpp). Fixes #1301.

Definition at line 57 of file CubeCalculator.h.

Member Enumeration Documentation

◆ Calculations

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 81 of file CubeCalculator.h.

Constructor & Destructor Documentation

◆ CubeCalculator()

Isis::CubeCalculator::CubeCalculator ( )

◆ ~CubeCalculator()

Isis::CubeCalculator::~CubeCalculator ( )

Destroys the CubeCalculator object.

Definition at line 42 of file CubeCalculator.cpp.

References Clear(), m_calculations, m_cameraBuffers, m_cubeCameras, m_cubeStats, m_dataDefinitions, and m_methods.

Member Function Documentation

◆ AbsoluteValue()

void Isis::Calculator::AbsoluteValue ( )
inherited

Pop an element, compute its absolute value, then push the result on the stack.

Definition at line 407 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Add()

void Isis::Calculator::Add ( )
inherited

Pops two elements, adds them, then pushes the sum on the stack.

Definition at line 330 of file Calculator.cpp.

References Isis::AddOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ addMethodCall()

void Isis::CubeCalculator::addMethodCall ( void(Calculator::*)(void) method)
private

This is a conveinience method for PrepareCalculations(...).

This will cause RunCalculations(...) to execute this method in order.

Parameters
methodThe method to call, i.e. &Calculator::Multiply

Definition at line 828 of file CubeCalculator.cpp.

References CallNextMethod, m_calculations, and m_methods.

Referenced by prepareCalculations().

◆ And()

void Isis::Calculator::And ( )
inherited

Pop two elements, AND them, then push the result on the stack.

Definition at line 679 of file Calculator.cpp.

References Isis::BitwiseAndOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize().

◆ Arccosine()

void Isis::Calculator::Arccosine ( )
inherited

Pops one element and push the arccosine.

Definition at line 777 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ ArccosineH()

void Isis::Calculator::ArccosineH ( )
inherited

Pops one element and push the inverse hyperbolic cosine.

Definition at line 807 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

◆ Arcsine()

void Isis::Calculator::Arcsine ( )
inherited

Pops one element and push the arcsine.

Definition at line 767 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ ArcsineH()

void Isis::Calculator::ArcsineH ( )
inherited

Pops one element and push the inverse hyperbolic sine.

Definition at line 797 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

◆ Arctangent()

void Isis::Calculator::Arctangent ( )
inherited

Pops one element and push the arctangent.

Definition at line 787 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Arctangent2()

void Isis::Calculator::Arctangent2 ( )
inherited

Pops two elements and push the arctangent.

Definition at line 827 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ ArctangentH()

void Isis::Calculator::ArctangentH ( )
inherited

Pops one element and push the inverse hyperbolic tangent.

Definition at line 817 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

◆ Clear()

void Isis::CubeCalculator::Clear ( )
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.

Definition at line 64 of file CubeCalculator.cpp.

References Isis::Calculator::Clear(), m_calculations, m_cameraBuffers, m_cubeCameras, m_cubeStats, m_dataDefinitions, and m_methods.

Referenced by prepareCalculations(), and ~CubeCalculator().

◆ Cosecant()

void Isis::Calculator::Cosecant ( )
inherited

◆ Cosine()

void Isis::Calculator::Cosine ( )
inherited

Pops one element and push the cosine.

Definition at line 717 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ CosineH()

void Isis::Calculator::CosineH ( )
inherited

Pops one element and push the hyperbolic cosine.

Definition at line 850 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by prepareCalculations().

◆ Cotangent()

void Isis::Calculator::Cotangent ( )
inherited

◆ Divide()

void Isis::Calculator::Divide ( )
inherited

Pops two, divides them, then pushes the quotient on the stack.

Definition at line 354 of file Calculator.cpp.

References Isis::DivideOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Empty()

bool Isis::Calculator::Empty ( )
inherited

Check if the stack is empty.

Returns
bool True if the stack is empty

Definition at line 1013 of file Calculator.cpp.

References Isis::Calculator::p_valStack.

◆ Equal()

void Isis::Calculator::Equal ( )
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 617 of file Calculator.cpp.

References Isis::EqualOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Exponent()

void Isis::Calculator::Exponent ( )
inherited

Pops two elements, computes the power then pushes the result on the stack The exponent has to be a scalar.

Exceptions
Isis::iException::Math

Definition at line 382 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ GreaterThan()

void Isis::Calculator::GreaterThan ( )
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 587 of file Calculator.cpp.

References Isis::GreaterThanOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ GreaterThanOrEqual()

void Isis::Calculator::GreaterThanOrEqual ( )
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 632 of file Calculator.cpp.

References Isis::GreaterThanOrEqualOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ lastPushToCubeCameras()

int Isis::CubeCalculator::lastPushToCubeCameras ( QVector< Cube * > & inCubes)
private

Creates internal camera for the last pushed cube data.

This method is used to set up cameras for the input cubes.

Exceptions
IException::Unknown"Not sure which files to get cameras from"
IException::Unknown"This function must not contain calcuations, only input cubes may be specified."
IException::Unknown"This function must not contain constants, only input cubes may be specified."
IException::Unknown"This function requires a camera and the input cube does not have one. You may need to run spiceinit"
IException::Unknown"This function requires a camera and the input cube does not have one. You may need to run spiceinit"
Returns
int Returns the index of the last pushed cube data.

Definition at line 759 of file CubeCalculator.cpp.

References Isis::DataValue::CubeData, m_calculations, m_cameraBuffers, m_cubeCameras, m_dataDefinitions, PushNextData, and Isis::IException::Unknown.

Referenced by prepareCalculations().

◆ lastPushToCubeStats()

int Isis::CubeCalculator::lastPushToCubeStats ( QVector< Cube * > & inCubes)
private

Creates statistics internally for the last cube data pushed to the data definitions.

This method is used for setting up internal statistics for the input cubes. This allows access to the statistics for each of the input cube when adding statistics related values to the calculator.

Exceptions
IException::Unknown"This function must not contain constants, only input cubes may be specified"
Returns
int Returns the index of the last pushed cube data.

Definition at line 699 of file CubeCalculator.cpp.

References Isis::DataValue::CubeData, m_calculations, m_cubeStats, m_dataDefinitions, PushNextData, and Isis::IException::Unknown.

Referenced by prepareCalculations().

◆ LeftShift()

void Isis::Calculator::LeftShift ( )
inherited

Pop the top element, then perform a left shift with zero fill.

Exceptions
Isis::iException::Math

Definition at line 441 of file Calculator.cpp.

References Isis::Calculator::Pop(), Isis::Calculator::Push(), and Isis::IException::Unknown.

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ LessThan()

void Isis::Calculator::LessThan ( )
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 602 of file Calculator.cpp.

References Isis::LessThanOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ LessThanOrEqual()

void Isis::Calculator::LessThanOrEqual ( )
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 647 of file Calculator.cpp.

References Isis::LessThanOrEqualOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Log()

void Isis::Calculator::Log ( )
inherited

Pop an element, compute its log, then push the result on the stack.

Exceptions
Isis::iException::Math

Definition at line 419 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Log10()

void Isis::Calculator::Log10 ( )
inherited

Pop an element, compute its base 10 log, then push the result on the stack.

Definition at line 429 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Maximum2()

void Isis::Calculator::Maximum2 ( )
inherited

Not implemented in Calculator.cpp.

◆ MaximumLine()

void Isis::Calculator::MaximumLine ( )
inherited

Pop one element, then push the maximum on the stack.

Definition at line 537 of file Calculator.cpp.

References Isis::IsSpecial(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by prepareCalculations().

◆ MaximumPixel()

void Isis::Calculator::MaximumPixel ( )
inherited

Pop two elements, then push the maximum on a pixel by pixel basis back on the stack.

Definition at line 572 of file Calculator.cpp.

References Isis::MaximumOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Minimum2()

void Isis::Calculator::Minimum2 ( )
inherited

Not implemented in Calculator.cpp.

◆ MinimumLine()

void Isis::Calculator::MinimumLine ( )
inherited

Pop one element, then push the minimum on the stack.

Definition at line 518 of file Calculator.cpp.

References Isis::IsSpecial(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by prepareCalculations().

◆ MinimumPixel()

void Isis::Calculator::MinimumPixel ( )
inherited

Pop two elements, then push the minimum on a pixel by pixel basis back on the stack.

Definition at line 557 of file Calculator.cpp.

References Isis::MinimumOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Modulus()

void Isis::Calculator::Modulus ( )
inherited

Pops two elements, mods them, then pushes the result on the stack.

Definition at line 366 of file Calculator.cpp.

References Isis::ModulusOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Multiply()

void Isis::Calculator::Multiply ( )
inherited

Pops two elements, multiplies them, then pushes the product on the stack.

Definition at line 317 of file Calculator.cpp.

References Isis::MultiplyOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Negative()

void Isis::Calculator::Negative ( )
inherited

Pops an element, negates it, then pushes the result.

Definition at line 307 of file Calculator.cpp.

References Isis::NegateOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ NotEqual()

void Isis::Calculator::NotEqual ( )
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 662 of file Calculator.cpp.

References Isis::NotEqualOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Or()

void Isis::Calculator::Or ( )
inherited

Pop two elements, OR them, then push the result on the stack.

Definition at line 693 of file Calculator.cpp.

References Isis::BitwiseOrOperator(), Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize().

◆ PerformOperation() [1/2]

void Isis::Calculator::PerformOperation ( QVector< double > & results,
QVector< double >::iterator arg1Start,
QVector< double >::iterator arg1End,
double operationdouble )
protectedinherited

Performs the mathematical operations on each argument.

Parameters
results[out] The results of the performed operation
arg1StartThe first argument to have the operation done on
arg1EndOne argument beyond the final argument to have the operation done upon
operationThe operation to be done on all arguments

Definition at line 1037 of file Calculator.cpp.

Referenced by Isis::Calculator::AbsoluteValue(), Isis::Calculator::Add(), Isis::Calculator::And(), Isis::Calculator::Arccosine(), Isis::Calculator::ArccosineH(), Isis::Calculator::Arcsine(), Isis::Calculator::ArcsineH(), Isis::Calculator::Arctangent(), Isis::Calculator::Arctangent2(), Isis::Calculator::ArctangentH(), Isis::Calculator::Cosecant(), Isis::Calculator::Cosine(), Isis::Calculator::CosineH(), Isis::Calculator::Cotangent(), Isis::Calculator::Divide(), Isis::Calculator::Equal(), Isis::Calculator::Exponent(), Isis::InlineCalculator::floatModulus(), Isis::Calculator::GreaterThan(), Isis::Calculator::GreaterThanOrEqual(), Isis::Calculator::LessThan(), Isis::Calculator::LessThanOrEqual(), Isis::Calculator::Log(), Isis::Calculator::Log10(), Isis::Calculator::MaximumPixel(), Isis::Calculator::MinimumPixel(), Isis::Calculator::Modulus(), Isis::Calculator::Multiply(), Isis::Calculator::Negative(), Isis::Calculator::NotEqual(), Isis::Calculator::Or(), Isis::Calculator::Secant(), Isis::Calculator::Sine(), Isis::Calculator::SineH(), Isis::Calculator::SquareRoot(), Isis::Calculator::Subtract(), Isis::Calculator::Tangent(), and Isis::Calculator::TangentH().

◆ PerformOperation() [2/2]

void Isis::Calculator::PerformOperation ( QVector< double > & results,
QVector< double >::iterator arg1Start,
QVector< double >::iterator arg1End,
QVector< double >::iterator arg2Start,
QVector< double >::iterator arg2End,
double operationdouble, double )
protectedinherited

Performs the mathematical operation on each pair of arguments, or a set of agruments against a single argument.

Parameters
results[out] The results of the performed operation
arg1StartThe first of the primary argument to have the operation done on
arg1EndOne arguement beyond the final primary argument to have the operation done upon
arg2StartThe first of the secondaty argument to have the operation done on
arg2EndOne arguement beyond the final secondary argument to have the operation done upon
operationThe operation to be done on all pairs of arguments

Definition at line 1066 of file Calculator.cpp.

References Isis::IException::Programmer.

◆ Pop()

QVector< double > Isis::Calculator::Pop ( bool keepSpecials = false)
inherited

Pop an element off the stack.

Parameters
keepSpecialsIf true, special pixels will be preserved; otherwise, they will be mapped to double values
Returns
The top of the stack, which gets popped

Definition at line 949 of file Calculator.cpp.

References Isis::Hrs, Isis::Lrs, Isis::Null, Isis::Calculator::p_valStack, and Isis::IException::Unknown.

Referenced by Isis::Calculator::AbsoluteValue(), Isis::Calculator::Add(), Isis::Calculator::And(), Isis::Calculator::Arccosine(), Isis::Calculator::ArccosineH(), Isis::Calculator::Arcsine(), Isis::Calculator::ArcsineH(), Isis::Calculator::Arctangent(), Isis::Calculator::Arctangent2(), Isis::Calculator::ArctangentH(), Isis::Calculator::Cosecant(), Isis::Calculator::Cosine(), Isis::Calculator::CosineH(), Isis::Calculator::Cotangent(), Isis::InlineCalculator::degrees(), Isis::Calculator::Divide(), Isis::Calculator::Equal(), Isis::InlineCalculator::evaluate(), Isis::Calculator::Exponent(), Isis::InlineCalculator::floatModulus(), Isis::Calculator::GreaterThan(), Isis::Calculator::GreaterThanOrEqual(), Isis::Calculator::LeftShift(), Isis::Calculator::LessThan(), Isis::Calculator::LessThanOrEqual(), Isis::Calculator::Log(), Isis::Calculator::Log10(), Isis::InlineCalculator::logicalAnd(), Isis::InlineCalculator::logicalOr(), Isis::Calculator::MaximumLine(), Isis::Calculator::MaximumPixel(), Isis::Calculator::MinimumLine(), Isis::Calculator::MinimumPixel(), Isis::Calculator::Modulus(), Isis::Calculator::Multiply(), Isis::Calculator::Negative(), Isis::Calculator::NotEqual(), Isis::Calculator::Or(), Isis::InlineCalculator::radians(), Isis::Calculator::RightShift(), runCalculations(), Isis::Calculator::Secant(), Isis::Calculator::Sine(), Isis::Calculator::SineH(), Isis::Calculator::SquareRoot(), Isis::Calculator::Subtract(), Isis::Calculator::Tangent(), and Isis::Calculator::TangentH().

◆ prepareCalculations()

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.

Parameters
equationThe equation in postfix notation
inCubesThe input cubes
outCubeThe output cube
Exceptions
IException::Unknown"Invalid file number"
IException::Unknown"Unidentified operator"

Definition at line 249 of file CubeCalculator.cpp.

References Isis::Calculator::AbsoluteValue(), Isis::Calculator::Add(), addMethodCall(), 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::DataValue::EmacData, Isis::DataValue::EmaData, Isis::DataValue::EmalData, Isis::Calculator::Equal(), Isis::Calculator::Exponent(), Isis::Calculator::GreaterThan(), Isis::Calculator::GreaterThanOrEqual(), Isis::DataValue::InacData, Isis::DataValue::InaData, Isis::DataValue::InalData, lastPushToCubeCameras(), lastPushToCubeStats(), Isis::DataValue::LatData, Isis::Calculator::LeftShift(), Isis::Calculator::LessThan(), Isis::Calculator::LessThanOrEqual(), Isis::DataValue::Line, Isis::Calculator::Log(), Isis::Calculator::Log10(), Isis::DataValue::LonData, m_calculations, m_cubeStats, m_dataDefinitions, m_outputSamples, Isis::Calculator::MaximumLine(), Isis::Calculator::MaximumPixel(), Isis::Calculator::MinimumLine(), Isis::Calculator::MinimumPixel(), Isis::Calculator::Modulus(), Isis::Calculator::Multiply(), Isis::Calculator::Negative(), Isis::Calculator::NotEqual(), Isis::DataValue::PhacData, Isis::DataValue::PhaData, Isis::DataValue::PhalData, Isis::PI, PushNextData, Isis::DataValue::RadiusData, Isis::DataValue::ResData, 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::Token(), and Isis::IException::Unknown.

◆ PrintTop()

void Isis::Calculator::PrintTop ( )
inherited

Print the vector at the top of the stack.

Definition at line 989 of file Calculator.cpp.

References Isis::Calculator::p_valStack.

◆ Push() [1/3]

void Isis::Calculator::Push ( Buffer & buff)
inherited

Push a buffer onto the stack.

Parameters
buffThe buffer that will be pushed on the stack

Definition at line 905 of file Calculator.cpp.

References Isis::IsHisPixel(), Isis::IsHrsPixel(), Isis::IsLisPixel(), Isis::IsLrsPixel(), Isis::IsNullPixel(), Isis::IsSpecial(), and Isis::Calculator::Push().

◆ Push() [2/3]

void Isis::Calculator::Push ( double scalar)
inherited

Push a scalar onto the stack.

Parameters
scalarThe scalar that will be pushed on the stack

Definition at line 893 of file Calculator.cpp.

References Isis::Calculator::Push().

Referenced by Isis::Calculator::AbsoluteValue(), Isis::Calculator::Add(), Isis::Calculator::And(), Isis::Calculator::Arccosine(), Isis::Calculator::ArccosineH(), Isis::Calculator::Arcsine(), Isis::Calculator::ArcsineH(), Isis::Calculator::Arctangent(), Isis::Calculator::Arctangent2(), Isis::Calculator::ArctangentH(), Isis::Calculator::Cosecant(), Isis::Calculator::Cosine(), Isis::Calculator::CosineH(), Isis::Calculator::Cotangent(), Isis::InlineCalculator::degrees(), Isis::Calculator::Divide(), Isis::InlineCalculator::eConstant(), Isis::Calculator::Equal(), Isis::Calculator::Exponent(), Isis::InlineCalculator::floatModulus(), Isis::Calculator::GreaterThan(), Isis::Calculator::GreaterThanOrEqual(), Isis::Calculator::LeftShift(), Isis::Calculator::LessThan(), Isis::Calculator::LessThanOrEqual(), Isis::Calculator::Log(), Isis::Calculator::Log10(), Isis::InlineCalculator::logicalAnd(), Isis::InlineCalculator::logicalOr(), Isis::Calculator::MaximumLine(), Isis::Calculator::MaximumPixel(), Isis::Calculator::MinimumLine(), Isis::Calculator::MinimumPixel(), Isis::Calculator::Modulus(), Isis::Calculator::Multiply(), Isis::Calculator::Negative(), Isis::Calculator::NotEqual(), Isis::Calculator::Or(), Isis::InlineCalculator::pi(), Isis::Calculator::Push(), Isis::Calculator::Push(), Isis::InlineCalculator::radians(), Isis::Calculator::RightShift(), runCalculations(), Isis::InlineCalculator::scalar(), Isis::Calculator::Secant(), Isis::Calculator::Sine(), Isis::Calculator::SineH(), Isis::Calculator::SquareRoot(), Isis::Calculator::Subtract(), Isis::Calculator::Tangent(), Isis::Calculator::TangentH(), and Isis::InlineCalculator::variable().

◆ Push() [3/3]

void Isis::Calculator::Push ( QVector< double > & vect)
inherited

Push a vector onto the stack.

Parameters
vectThe vector that will be pushed on the stack

Definition at line 883 of file Calculator.cpp.

References Isis::Calculator::p_valStack.

◆ RightShift()

void Isis::Calculator::RightShift ( )
inherited

Pop the top element, then perform a right shift with zero fill.

Exceptions
Isis::iException::Math

Definition at line 480 of file Calculator.cpp.

References Isis::Calculator::Pop(), Isis::Calculator::Push(), and Isis::IException::Unknown.

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ runCalculations()

QVector< double > Isis::CubeCalculator::runCalculations ( QVector< Buffer * > & cubeData,
int curLine,
int curBand )

◆ Secant()

void Isis::Calculator::Secant ( )
inherited

◆ Sine()

void Isis::Calculator::Sine ( )
inherited

Pops one element and push the sine.

Definition at line 707 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ SineH()

void Isis::Calculator::SineH ( )
inherited

Pops one element and push the hyperbolic sine.

Definition at line 840 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by prepareCalculations().

◆ SquareRoot()

void Isis::Calculator::SquareRoot ( )
inherited

Pop an element, compute its square root, then push the root on the stack.

Exceptions
Isis::iException::Math

Definition at line 397 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ StackSize()

int Isis::Calculator::StackSize ( )
protectedinherited

Returns the current stack size.

Get the current stack size.

Returns
int Number of arguments in the stack

Definition at line 874 of file Calculator.cpp.

References Isis::Calculator::p_valStack.

Referenced by Isis::InlineCalculator::evaluate(), and runCalculations().

◆ Subtract()

void Isis::Calculator::Subtract ( )
inherited

Pops two elements, subtracts them, then pushes the difference on the stack.

Definition at line 342 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), Isis::Calculator::Push(), and Isis::SubtractOperator().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ Tangent()

void Isis::Calculator::Tangent ( )
inherited

Pops one element and push the tangent.

Definition at line 727 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by Isis::InlineCalculator::initialize(), and prepareCalculations().

◆ TangentH()

void Isis::Calculator::TangentH ( )
inherited

Pops one element and push the hyperbolic tangent.

Definition at line 860 of file Calculator.cpp.

References Isis::Calculator::PerformOperation(), Isis::Calculator::Pop(), and Isis::Calculator::Push().

Referenced by prepareCalculations().

Member Data Documentation

◆ m_calculations

QVector<Calculations>* Isis::CubeCalculator::m_calculations
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 99 of file CubeCalculator.h.

Referenced by addMethodCall(), Clear(), CubeCalculator(), lastPushToCubeCameras(), lastPushToCubeStats(), prepareCalculations(), runCalculations(), and ~CubeCalculator().

◆ m_cameraBuffers

QVector<CameraBuffers *>* Isis::CubeCalculator::m_cameraBuffers
private

Stores the camera buffers that are enabled for camera related calculations.

This is used for quickly computing camera related information.

Definition at line 120 of file CubeCalculator.h.

Referenced by Clear(), CubeCalculator(), lastPushToCubeCameras(), runCalculations(), and ~CubeCalculator().

◆ m_cubeCameras

QVector<Camera *>* Isis::CubeCalculator::m_cubeCameras
private

Stores the cameras for the input cubes.

This is synchronized with m_cameraBuffers so that the camera buffers are loaded with data from the appropriate camera.

Definition at line 114 of file CubeCalculator.h.

Referenced by Clear(), CubeCalculator(), lastPushToCubeCameras(), and ~CubeCalculator().

◆ m_cubeStats

QVector<Statistics *>* Isis::CubeCalculator::m_cubeStats
private

Stores the cube statistics for the input cubes.

Definition at line 108 of file CubeCalculator.h.

Referenced by Clear(), CubeCalculator(), lastPushToCubeStats(), prepareCalculations(), and ~CubeCalculator().

◆ m_dataDefinitions

QVector<DataValue>* Isis::CubeCalculator::m_dataDefinitions
private

This defines what kind of data RunCalculations(...) will push onto the calculator.

Definition at line 105 of file CubeCalculator.h.

Referenced by Clear(), CubeCalculator(), lastPushToCubeCameras(), lastPushToCubeStats(), prepareCalculations(), and ~CubeCalculator().

◆ m_methods

QVector<void (Calculator:: *)(void)>* Isis::CubeCalculator::m_methods
private

This stores the addresses to the methods RunCalculations(...) will call.

Definition at line 102 of file CubeCalculator.h.

Referenced by addMethodCall(), Clear(), CubeCalculator(), and ~CubeCalculator().

◆ m_outputSamples

int Isis::CubeCalculator::m_outputSamples
private

Number of samples in the output cube.

Definition at line 122 of file CubeCalculator.h.

Referenced by CubeCalculator(), prepareCalculations(), and runCalculations().

◆ p_valStack


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