29 static const char* EQUATION_KW =
"equation";
35 virtual double apply(
double v1,
double v2)
const 44 virtual double apply(
double v1,
double v2)
const 53 virtual double apply(
double v1,
double v2)
const 62 virtual double apply(
double v1,
double v2)
const 71 virtual double apply(
double v1,
double v2)
const 80 virtual double apply(
double v1,
double v2)
const 89 virtual double apply(
double v1,
double v2)
const 98 virtual double apply(
double v1,
double v2)
const 107 virtual double apply(
double v1,
double v2)
const 119 virtual double apply(
double v1,
double v2)
const 131 virtual double apply(
double v1,
double v2)
const 140 virtual double apply(
double v1,
double v2)
const 142 return (v1==v2)?1.0:0.0;
148 virtual double apply(
double v1,
double v2)
const 150 return (v1>v2)?1.0:0.0;
156 virtual double apply(
double v1,
double v2)
const 158 return (v1>=v2)?1.0:0.0;
164 virtual double apply(
double v1,
double v2)
const 166 return (v1<v2)?1.0:0.0;
172 virtual double apply(
double v1,
double v2)
const 174 return (v1<=v2)?1.0:0.0;
180 virtual double apply(
double v1,
double v2)
const 182 return (v1!=v2)?1.0:0.0;
276 return sin(v*
M_PI/180.0);
298 return (180/
M_PI)*asin(v);
320 return (180/
M_PI)*acos(v);
338 return cos(v*
M_PI/180.0);
356 return tan(v*
M_PI/180.0);
374 return (180/
M_PI)*atan(v);
386 theCastOutputFilter(NULL),
388 theCurrentResLevel(0)
402 theCastOutputFilter(NULL),
404 theCurrentResLevel(0)
510 long w = tileRect.
width();
511 long h = tileRect.
height();
546 return inter->
getTile(tileRect, resLevel);
581 if(!property)
return;
583 if(property->
getName() ==
"Equation")
587 else if(property->
getName() ==
"Output scalar type")
600 if(name ==
"Equation")
611 else if(name ==
"Output scalar type")
615 std::vector<ossimString> scalarNames;
620 for(idx = 0; idx < tableSize; ++idx)
642 propertyNames.push_back(
"Equation");
643 propertyNames.push_back(
"Output scalar type");
675 for(band = 0; band < minBands; ++band)
677 double* inBuf = (
double*)topData->
getBuf(band);
682 for(offset = 0; offset <
size; ++offset)
693 for(;band < maxBands; ++band)
695 double* inBuf = (
double*)topData->
getBuf(minBands-1);
701 for(offset = 0; offset <
size; ++offset)
716 for(band = 0; band < minBands; ++band)
718 double* inBuf = (
double*)
theValueStack.top().d.imageDataValue->getBuf(band);
722 for(offset = 0; offset <
size; ++offset)
730 for(;band < maxBands; ++band)
732 double* inBuf = (
double*)
theValueStack.top().d.imageDataValue->getBuf(minBands-1);
737 for(offset = 0; offset <
size; ++offset)
790 if(argList[i].d.imageDataValue)
806 for(i = 0; i < (int)args.size(); ++i)
810 if(args[i].d.imageDataValue)
815 args[i].d.imageDataValue = NULL;
846 <<
"The expression at arg " << (args.size()+1)
847 <<
" is empty" << endl;
855 <<
"Unable to parse expression" << endl;
866 <<
"Missing comma in argument list" << endl;
875 <<
"Starting left parenthesis missing from arg list" << endl;
886 <<
"No matching right parenthesis for arg list" << endl;
890 if(!result && popValueStack)
901 vector<ossimEquValue> argList;
905 if((argList.size() == 3) ||
906 (argList.size() == 4))
912 if(argList.size() == 3)
1009 <<
"Invalid number of arguments to assign_band" << endl;
1016 <<
"unable to parse arguments for assign band" << endl;
1044 vector<ossimEquValue> args;
1062 <<
"function conv error: resulting image is NULL" << endl;
1069 <<
"Unable to apply convolution" << endl;
1083 vector<ossimEquValue> args;
1101 <<
"function clamp error: resulting image is NULL" << endl;
1109 <<
"Unable to apply clamp" << endl;
1128 vector<ossimEquValue> argList;
1132 if(argList.size() == 2)
1174 if((tempData->
getBuf())&&
1175 (bandNumber < tempData->getNumberOfBands()))
1198 <<
"Invalid number of args in function band" << endl;
1213 vector<ossimEquValue> args;
1248 vector<ossimEquValue> args;
1321 if((argCount > 1)&&result)
1352 if((argCount>0)&&result)
1360 }
while((argCount > 0)&&(result));
1967 bool result =
false;
2035 bool result =
false;
2095 <<
"Data is NULL for array operation" << endl;
2102 <<
"Mismatched Right array bracket" << endl;
2108 <<
"Expression between array brackets is not a number" 2115 <<
"no expression within array brackets" << endl;
2121 <<
"Unabel to parse expression"<<endl;
2127 <<
"Need left array brackets to access an input source"<<endl;
2145 <<
"Right parenthesis missing" << endl;
2152 <<
"Unable to parse expression within parenthesis" << endl;
2201 <<
"Multiplication requires two arguments" << endl;
2670 bool result =
false;
2808 bool result =
false;
2848 const vector<ossimEquValue>& argList)
2857 if(argList.size() <3)
2869 result = argList[0].d.imageDataValue;
2871 if(argList[0].d.imageDataValue)
2877 double minValue = argList[1].d.doubleValue;
2878 double maxValue = argList[2].d.doubleValue;
2880 if(minValue > maxValue)
2882 std::swap(minValue, maxValue);
2893 for(band = 0; band < upperBoundBand; ++band)
2895 double np =
static_cast<double>(result->
getNullPix(band));
2896 double *buf =
static_cast<double*
>(result->
getBuf(band));
2897 for(offset = 0; offset < offsetUpperBound; ++ offset)
2901 if( (*buf) < minValue) *buf = minValue;
2902 else if( (*buf) >maxValue) *buf = maxValue;
2910 for(band = 0; band < upperBoundBand; ++band)
2912 double *buf =
static_cast<double*
>(result->
getBuf(band));
2913 for(offset = 0; offset < offsetUpperBound; ++ offset)
2915 if( (*buf) < minValue) *buf = minValue;
2916 else if( (*buf) >maxValue) *buf = maxValue;
2930 const vector<ossimEquValue>& argList)
2939 if(argList.size() <4)
return false;
2950 int rows = (
int)argList[1].d.doubleValue;
2951 int cols = (int)argList[2].d.doubleValue;
2953 if((rows*cols) != (int)(argList.size()-3))
2958 NEWMAT::Matrix m(rows,cols);
2961 for(
int r = 0; r< rows;++r)
2963 for(
int c=0;c<cols;++c)
2965 m[r][c] = argList[count].d.doubleValue;
2980 if(tempData.
valid())
3000 const vector<ossimEquValue>& argList)
3009 if(argList.size() !=3)
return false;
3020 int rows = (
int)argList[1].d.doubleValue;
3021 int cols = (int)argList[2].d.doubleValue;
3023 NEWMAT::Matrix m(rows, cols);
3025 m = 1.0/(rows*cols);
3040 if(tempData.
valid())
3057 const vector<ossimEquValue>& argList)
3066 if(argList.size() !=3)
return false;
3077 int x = (
int)argList[1].d.doubleValue;
3078 int y = (int)argList[2].d.doubleValue;
3092 if(tempData.
valid())
3113 bool returnValue =
true;
3133 returnValue =
false;
3165 returnValue =
false;
3170 returnValue =
false;
3180 double* buf =
static_cast<double*
>(v1->
getBuf());
3181 if(!buf)
return true;
3192 double value = (
static_cast<double>(v2));
3196 *buf = (double)op.
apply(*buf, value);
3207 for(
ossim_uint32 band = 0; band < numberOfBands; ++band)
3209 double* buf =
static_cast<double*
>(v1->
getBuf(band));
3213 double np =
static_cast<double>(v1->
getNullPix()[band]);
3215 for(
ossim_uint32 offset = 0; offset < sizePerBand;++offset)
3219 *buf = (double)op.
apply(*buf, v2);
3234 double* buf =
static_cast<double*
>(v2->
getBuf());
3235 if(!buf)
return true;
3246 double value = (
static_cast<double>(v1));
3250 *buf = (double)op.
apply(value, *buf);
3261 for(
ossim_uint32 band = 0; band < numberOfBands; ++band)
3263 double* buf =
static_cast<double*
>(v2->
getBuf(band));
3267 double np =
static_cast<double>(v2->
getNullPix()[band]);
3269 for(
ossim_uint32 offset = 0; offset < sizePerBand; ++offset)
3273 *buf = (double)op.
apply((
double)v1, *buf);
3296 double** bandV1 =
new double*[maxNumberOfBands];
3297 double** bandV2 =
new double*[maxNumberOfBands];
3298 double* bandV1Np =
new double[maxNumberOfBands];
3299 double* bandV2Np =
new double[maxNumberOfBands];
3301 for(band = 0; band < minNumberOfBands; ++band)
3303 bandV1[band] = (
double*)v1->
getBuf(band);
3304 bandV2[band] = (
double*)v2->
getBuf(band);
3305 bandV1Np[band] = (double)v1->
getNullPix(band);
3306 bandV2Np[band] = (double)v2->
getNullPix(band);
3310 for(band = 0; band < maxNumberOfBands; ++band)
3312 bandV1[band] = (
double*)v1->
getBuf(minNumberOfBands-1);
3313 bandV2[band] = (
double*)v2->
getBuf(band);
3314 bandV1Np[band] = (double)v1->
getNullPix(minNumberOfBands-1);
3315 bandV2Np[band] = (double)v2->
getNullPix(band);
3320 for(band = 0; band < maxNumberOfBands; ++band)
3322 bandV1[band] = (
double*)v1->
getBuf(band);
3323 bandV2[band] = (
double*)v2->
getBuf(minNumberOfBands-1);
3324 bandV1Np[band] = (double)v1->
getNullPix(band);
3325 bandV2Np[band] = (double)v2->
getNullPix(minNumberOfBands-1);
3333 for(band = 0; band < maxNumberOfBands; ++band)
3335 double* buf1 = bandV1[band];
3336 double* buf2 = bandV2[band];
3348 for(band = 0; band < maxNumberOfBands; ++band)
3350 double* buf1 = bandV1[band];
3351 double* buf2 = bandV2[band];
3352 double nullPix2 = bandV2Np[band];
3355 if(*buf2 != nullPix2)
3369 for(band = 0; band < maxNumberOfBands; ++band)
3371 double* buf1 = bandV1[band];
3372 double* buf2 = bandV2[band];
3376 *buf1 = op.
apply(*buf1, *buf2);
3385 for(band = 0; band < maxNumberOfBands; ++band)
3387 double* buf1 = bandV1[band];
3388 double* buf2 = bandV2[band];
3389 double nullPix2 = bandV2Np[band];
3392 if(*buf2 != nullPix2)
3394 *buf1 = op.
apply(*buf1, *buf2);
3405 for(band = 0; band < maxNumberOfBands; ++band)
3407 double* buf1 = bandV1[band];
3408 double* buf2 = bandV2[band];
3409 double nullPix1 = bandV1Np[band];
3412 if(*buf1 != nullPix1)
3414 *buf1 = op.
apply(*buf1, *buf2);
3425 for(band = 0; band < maxNumberOfBands; ++band)
3427 double* buf1 = bandV1[band];
3428 double* buf2 = bandV2[band];
3429 double nullPix1 = bandV1Np[band];
3430 double nullPix2 = bandV2Np[band];
3433 if((*buf1 != nullPix1)&&
3434 (*buf2 != nullPix2))
3436 *buf1 = op.
apply(*buf1, *buf2);
3458 bool returnValue =
true;
3475 returnValue =
false;
3484 double* buf =
static_cast<double*
>(v->
getBuf());
3485 if(!buf)
return true;
3499 *buf = (double)op.
apply(*buf);
3510 for(
ossim_uint32 band = 0; band < numberOfBands; ++band)
3512 double* buf =
static_cast<double*
>(v->
getBuf(band));
3516 double np =
static_cast<double>(v->
getNullPix()[band]);
3518 for(
ossim_uint32 offset = 0; offset < sizePerBand;++offset)
3522 *buf = (double)op.
apply(*buf);
3535 const char* prefix)
const 3546 "output_scalar_type",
3547 outputScalarType.
c_str(),
3557 const char* equ = kwl.
find(prefix, EQUATION_KW);
3558 const char* scalar = kwl.
find(prefix,
"output_scalar_type");
3571 getScalarTypeFromString(scalar));
virtual double apply(double v) const
virtual void setOutputScalarType(ossimScalarType scalarType)
virtual void valueToString(ossimString &valueResult) const =0
virtual double apply(double v1, double v2) const
virtual ossim_uint32 getWidth() const
virtual double apply(double v) const
virtual double apply(double v1, double v2) const
virtual double apply(double v1, double v2) const
virtual ossimRefPtr< ossimImageData > getNewImageData(ossim_uint32 index)
#define OSSIM_EQU_TOKEN_ACOS
#define OSSIM_EQU_TOKEN_COS
virtual ossimRefPtr< ossimImageData > getImageData(ossim_uint32 index)
virtual double apply(double v1, double v2) const
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
virtual bool parseExpression()
#define OSSIM_EQU_TOKEN_SQRT
virtual const ossim_float64 * getMaxPix() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
#define OSSIM_EQU_TOKEN_BDIFFERENT
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
virtual ossim_uint32 getNumberOfBands() const
virtual double apply(double v1, double v2) const
virtual void setImageRectangle(const ossimIrect &rect)
#define OSSIM_EQU_TOKEN_BGREATER
virtual bool parseAssignBand()
#define OSSIM_EQU_TOKEN_BLURR
#define OSSIM_EQU_TOKEN_MINUS
#define OSSIM_EQU_TOKEN_PI
virtual void disconnect(ossimConnectableObject *object=0)
Will disconnect the object passed in.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
#define OSSIM_EQU_TOKEN_IMAGE_VARIABLE
This will be a base for all combiners.
virtual void setWidthHeight(ossim_uint32 w, ossim_uint32 h)
Represents serializable keyword/value map.
virtual ossimRefPtr< ossimImageData > parseEquation()
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
const char * find(const char *key) const
virtual double apply(double v) const
virtual ossimString getEntryString(ossim_int32 entry_number) const
virtual void clearStacks()
virtual double apply(double v1, double v2) const
ossim_uint32 height() const
Will combine the input data based on a supplied equation.
virtual double apply(double v1, double v2) const
virtual double apply(double v) const
virtual void initialize()
#define OSSIM_EQU_TOKEN_BLESSOREQUAL
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual double apply(double v) const
virtual ossim_uint32 getHeight() const
#define OSSIM_EQU_TOKEN_MAX
ossimRefPtr< ossimImageData > theTile
virtual double apply(double v) const
virtual void deleteArgList(vector< ossimEquValue > &args)
virtual void setReadOnlyFlag(bool flag)
#define OSSIM_EQU_TOKEN_MIN
#define OSSIM_EQU_TOKEN_CONV
#define OSSIM_EQU_TOKEN_ASSIGN_BAND
#define OSSIM_EQU_TOKEN_LOG10
ossim_uint32 theCurrentResLevel
virtual double apply(double v) const
#define OSSIM_EQU_TOKEN_ASIN
#define OSSIM_EQU_TOKEN_CLAMP
virtual bool applyConvolution(ossimImageData *&result, const vector< ossimEquValue > &argList)
virtual double apply(double v) const
#define OSSIM_EQU_TOKEN_LEFT_ARRAY_BRACKET
#define OSSIM_EQU_TOKEN_OR_BAR
virtual void initialize()
Initialize the data buffer.
#define OSSIM_EQU_TOKEN_COMMA
virtual ossimObject * dup() const
#define OSSIM_EQU_TOKEN_BLESS
#define OSSIM_EQU_TOKEN_XOR
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
#define OSSIM_EQU_TOKEN_RIGHT_ARRAY_BRACKET
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
#define OSSIM_EQU_TOKEN_COSD
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
virtual void assignBand(const ossimImageData *data, ossim_uint32 source_band, ossim_uint32 output_band)
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool applyOp(const ossimBinaryOp &op, ossimEquValue &result, ossimEquValue &v1, ossimEquValue &v2)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual double apply(double v1, double v2) const
virtual bool applyBlurr(ossimImageData *&result, const vector< ossimEquValue > &argList)
virtual ~ossimEquationCombiner()
virtual bool parseRestOfExp()
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
virtual void setNullPix(ossim_float64 null_pix)
OSSIM_DLL double defaultMin(ossimScalarType scalarType)
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
#define OSSIM_EQU_TOKEN_ASIND
virtual double apply(double v) const
static ossimImageDataFactory * instance()
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
#define OSSIM_EQU_TOKEN_AMPERSAND
virtual bool parseStdFuncs()
virtual ossimDataObjectStatus validate() const
#define OSSIM_EQU_TOKEN_ABS
virtual double apply(double v) const
virtual void initialize()
OSSIM_DLL double defaultNull(ossimScalarType scalarType)
virtual void clearArgList(vector< ossimEquValue > &argList)
virtual double apply(double v) const
#define OSSIM_EQU_TOKEN_SHIFT
virtual ossim_uint32 getSizePerBand() const
Returns the number of pixels in a single band in a tile.
#define OSSIM_EQU_TOKEN_SIND
virtual bool parseRestOfTerm()
virtual bool applyShift(ossimImageData *&result, const vector< ossimEquValue > &argList)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
ossimImageData * imageDataValue
virtual void setOutputScalarType(ossimScalarType scalarType)
Sets the output scalar type.
#define OSSIM_EQU_TOKEN_CONSTANT
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &origin, ossim_uint32 resLevel=0)
virtual double apply(double v) const
virtual ossim_uint32 getTableSize() const
virtual bool applyClamp(ossimImageData *&result, const vector< ossimEquValue > &argList)
virtual ossimIrect getImageRectangle() const
virtual double apply(double v1, double v2) const
#define OSSIM_EQU_TOKEN_BEQUAL
virtual bool parseFactor()
#define OSSIM_EQU_TOKEN_PLUS
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
#define OSSIM_EQU_TOKEN_ACOSD
ossim_uint32 width() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual double apply(double v) const =0
#define OSSIM_EQU_TOKEN_TAND
virtual void setOrigin(const ossimIpt &origin)
virtual const ossim_float64 * getMinPix() const
RTTI_DEF1(ossimEquationCombiner, "ossimEquationCombiner", ossimImageCombiner)
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual void makeBlank()
Initializes data to null pixel values.
ossimEquTokenizer * theLexer
virtual bool parseUnaryFactor()
ossimEquTokenizerFlexLexer ossimEquTokenizer
ossimRefPtr< ossimCastTileSourceFilter > theCastOutputFilter
virtual double apply(double v) const
OSSIM_DLL double defaultMax(ossimScalarType scalarType)
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual void setMaxPix(ossim_float64 max_pix)
Used to convert from scalar type enumeration to strings and vice versa.
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual bool parseArgList(vector< ossimEquValue > &args, bool popValueStack=true)
virtual ossim_uint32 getSize() const
Returns the total number of pixels in a tile for all bands.
virtual double apply(double v1, double v2) const
virtual double apply(double v1, double v2) const
virtual const void * getBuf() const
virtual double apply(double v) const
std::stack< ossimEquValue > theValueStack
#define OSSIM_EQU_TOKEN_MOD
virtual double apply(double v) const
virtual void initialize()
#define OSSIM_EQU_TOKEN_MULT
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
#define OSSIM_EQU_TOKEN_EXP
#define OSSIM_EQU_TOKEN_RIGHT_PAREN
virtual void setDataObjectStatus(ossimDataObjectStatus status) const
Full list found in ossimConstants.h.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual double apply(double v1, double v2) const
#define OSSIM_EQU_TOKEN_ATAND
virtual double apply(double v) const
virtual double apply(double v1, double v2) const
ossimRefPtr< ossimCastTileSourceFilter > theCastFilter
virtual void assignValue()
#define OSSIM_EQU_TOKEN_SIN
ossimScalarType theOutputScalarType
std::basic_istringstream< char > istringstream
Class for char input memory streams.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=NULL)
Method to the load (recreate) the state of an object from a keyword list.
ossimDataObjectStatus
Definitions for data object status.
virtual double apply(double v) const
#define OSSIM_EQU_TOKEN_LEFT_PAREN
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=NULL) const
Method to save the state of an object to a keyword list.
ossimRefPtr< ossimImageData > applyCast(ossimRefPtr< ossimImageData > input)
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual double apply(double v) const
virtual double apply(double v1, double v2) const
#define OSSIM_EQU_TOKEN_DIV
#define OSSIM_EQU_TOKEN_LOG
virtual double apply(double v1, double v2) const
virtual double apply(double v1, double v2) const
virtual void setMinPix(ossim_float64 min_pix)
#define OSSIM_EQU_TOKEN_BGREATEROREQUAL
virtual double apply(double v1, double v2) const =0
virtual const ossimIpt & getOrigin() const
#define OSSIM_EQU_TOKEN_TILDE
unsigned char ossim_uint8
#define OSSIM_EQU_TOKEN_POWER
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void setCacheRefreshBit()
virtual double apply(double v1, double v2) const
const ossimString & getName() const
virtual double apply(double v) const
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
#define OSSIM_EQU_TOKEN_TAN
#define OSSIM_EQU_TOKEN_ATAN
virtual double apply(double v) const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
#define OSSIM_EQU_TOKEN_BAND