Changeset 235


Ignore:
Timestamp:
01/21/05 12:21:36 (19 years ago)
Author:
kil064
Message:

Add binary table operator

opacity
gain elevation now handles polynomials
pass on row arg to SDMath::statistics

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMathWrapper.cc

    r227 r235  
    4646
    4747
     48SDMemTableWrapper SDMathWrapper::simpleBinaryOperate(const SDMemTableWrapper& left,
     49                                                     const SDMemTableWrapper& right,
     50                                                     const std::string& op)
     51{
     52    SDMath sdm;
     53    return SDMemTableWrapper(sdm.simpleBinaryOperate(left.getCP(), right.getCP(),
     54                                                     String(op)));
     55}
     56
     57
    4858void SDMathWrapper::scaleInSitu(SDMemTableWrapper& in, float factor, bool doAll)
    4959{
     
    142152  SDMemTable* pIn = in.getPtr();
    143153  SDMath sdm;
    144   SDMemTable* pOut = sdm.averagePol (*pIn, mask);
     154  Vector<Bool> tMask(mask);
     155  SDMemTable* pOut = sdm.averagePol (*pIn, tMask);
    145156  *pIn = *pOut;
    146157   delete pOut;
     
    153164  const CountedPtr<SDMemTable>& pIn = in.getCP();
    154165  SDMath sdm;
    155   return CountedPtr<SDMemTable>(sdm.averagePol(*pIn, mask));
     166  Vector<Bool> tMask(mask);
     167  return CountedPtr<SDMemTable>(sdm.averagePol(*pIn, tMask));
    156168}
    157169
     
    159171std::vector<float> SDMathWrapper::statistic(const SDMemTableWrapper& in,
    160172                                            const std::vector<bool>& mask,
    161                                             const std::string& which)
    162 {
    163   SDMath sdm;
    164   return sdm.statistic(in.getCP(), mask, String(which));
     173                                            const std::string& which, int row)
     174{
     175  SDMath sdm;
     176  Vector<Bool> tMask(mask);
     177  return sdm.statistic(in.getCP(), tMask, String(which), Int(row));
    165178}
    166179
     
    186199
    187200
    188 void SDMathWrapper::gainElevationInSitu(SDMemTableWrapper& in, const string& fileName,
     201void SDMathWrapper::gainElevationInSitu(SDMemTableWrapper& in,
     202                                        const std::vector<float>& coeffs,
     203                                        const string& fileName,
    189204                                        const string& method, bool doAll)
    190205{
    191206  SDMemTable* pIn = in.getPtr();
    192   SDMath sdm;
    193   SDMemTable* pOut = sdm.gainElevation(*pIn, String(fileName), String(method), Bool(doAll));
     207  Vector<Float> tCoeffs(coeffs);
     208  SDMath sdm;
     209  SDMemTable* pOut = sdm.gainElevation(*pIn, tCoeffs, String(fileName),
     210                                       String(method), Bool(doAll));
    194211  *pIn = *pOut;
    195212  delete pOut;
     
    198215
    199216SDMemTableWrapper SDMathWrapper::gainElevation(const SDMemTableWrapper& in,
     217                                               const std::vector<float>& coeffs,
    200218                                               const string& fileName,
    201219                                               const string& method, bool doAll)
    202220{
    203221  const CountedPtr<SDMemTable>& pIn = in.getCP();
    204   SDMath sdm;
    205   return CountedPtr<SDMemTable>(sdm.gainElevation(*pIn, String(fileName),
     222  Vector<Float> tCoeffs(coeffs);
     223  SDMath sdm;
     224  return CountedPtr<SDMemTable>(sdm.gainElevation(*pIn, tCoeffs, String(fileName),
    206225                                                  String(method), Bool(doAll)));
    207226}
    208227
     228void SDMathWrapper::opacityInSitu(SDMemTableWrapper& in, float tau, bool doAll)
     229{
     230  SDMemTable* pIn = in.getPtr();
     231  SDMath sdm;
     232  SDMemTable* pOut = sdm.opacity(*pIn, Float(tau), Bool(doAll));
     233  *pIn = *pOut;
     234  delete pOut;
     235}
     236
     237
     238SDMemTableWrapper SDMathWrapper::opacity(const SDMemTableWrapper& in,
     239                                         float tau, bool doAll)
     240{
     241  const CountedPtr<SDMemTable>& pIn = in.getCP();
     242  SDMath sdm;
     243  return CountedPtr<SDMemTable>(sdm.opacity(*pIn, Float(tau), Bool(doAll)));
     244}
     245
  • trunk/src/SDMathWrapper.h

    r228 r235  
    4747                             const SDMemTableWrapper& off);
    4848
     49// Simple binary operations
     50  SDMemTableWrapper simpleBinaryOperate (const SDMemTableWrapper& left,
     51                                         const SDMemTableWrapper& right,
     52                                         const std::string& op);
     53
    4954// Multiply
    5055  void scaleInSitu(SDMemTableWrapper& in, float factor, bool doAll);
     
    7176
    7277// Apply gain elevation correction
    73   void gainElevationInSitu (SDMemTableWrapper& in, const std::string& fileName,
     78  void gainElevationInSitu (SDMemTableWrapper& in, const std::vector<float>& coeffs,
     79                            const std::string& fileName,
    7480                            const std::string& method, bool doAll);
    75   SDMemTableWrapper gainElevation(const SDMemTableWrapper& in, const std::string& fileName,
     81  SDMemTableWrapper gainElevation(const SDMemTableWrapper& in, const std::vector<float>& coeffs,
     82                                  const std::string& fileName,
    7683                                  const std::string& method, bool doAll);
     84
     85// Apply opacity correction
     86  void opacityInSitu (SDMemTableWrapper& in, float tau, bool doAll);
     87  SDMemTableWrapper opacity (const SDMemTableWrapper& in, float tau, bool doAll);
    7788
    7889// Average in time
     
    89100  std::vector<float> statistic(const SDMemTableWrapper& in,
    90101                               const std::vector<bool>& mask,
    91                                const std::string& which);
     102                               const std::string& which, int row);
    92103};
    93104
Note: See TracChangeset for help on using the changeset viewer.