00001
00051 #ifndef INC_MI32_SAMCLASS_H
00052 #define INC_MI32_SAMCLASS_H
00053
00054 #ifndef INC_RVC_HYPSPECT_H
00055 #include <rvc/hypspect.h>
00056 #endif
00057
00058 #ifndef INC_RVC_HYPERSENSOR_H
00059 #include <rvc/hypersensor.h>
00060 #endif
00061
00062 #ifndef INC_MI32_BITSET_H
00063 #include <mi32/bitset.h>
00064 #endif
00065
00066
00068 class SAMCLASSIFIER {
00069 public:
00070
00072 SAMCLASSIFIER (
00073 RVC::OBJITEM &objitem
00074 );
00075
00077 ~SAMCLASSIFIER (
00078 );
00079
00081 int AddSample (
00082 INT32 lin,
00083 INT32 col
00084 );
00085
00087 int ClassifyBegin (
00088 );
00089
00091 int ClassifyLine (
00092 UINT32 lin,
00093 UINT32 startcol,
00094 UINT32 numcols,
00095 UINT8 *outmask
00096 );
00097
00099 void Close (
00100 );
00101
00103 void DeleteAllSamples (
00104 );
00105
00107 void DeleteSample (
00108 INT32 lin,
00109 INT32 col
00110 );
00111
00113 ERRVALUE Open (
00114 );
00115
00117 void SetAverageSamples (
00118 bool AverageSamples = true
00119 ) { m_AverageSamples = AverageSamples; }
00120
00122 void SetIgnoreAbsorptionBands (
00123 bool IgnoreAbsorptionBands = true
00124 ) { m_IgnoreAbsorptionBands = IgnoreAbsorptionBands; }
00125
00126 private:
00127 #ifndef GENERATING_DOXYGEN_OUTPUT
00128
00129 class SAMPLE {
00130 public:
00132 explicit SAMPLE (
00133 SAMCLASSIFIER& sam,
00134 int lin = 0,
00135 int col = 0
00136 );
00137
00139 ~SAMPLE (
00140 );
00141
00143 void AccumAdd (
00144 INT32 band,
00145 INT32 col,
00146 INT16* linebuf
00147 ) {
00148 m_SumTR[col] += linebuf[col] * m_values[band];
00149 m_SumTT[col] += linebuf[col] * linebuf[col];
00150 }
00151
00153 int AccumInit (
00154 );
00155
00157 int AllocValues (
00158 );
00159
00161 double ComputeAngle (
00162 INT32 col
00163 ) const { return (acos(m_SumTR[col] / (sqrt(m_SumTT[col]) * m_magnitude))); }
00164
00166 void ComputeMagnitude (
00167 );
00168
00170 int ReadValue (
00171 int band
00172 );
00173
00174 private:
00175 SAMCLASSIFIER& m_sam;
00176 INT32 m_lin;
00177 INT32 m_col;
00178 double m_magnitude;
00179 double *m_values;
00180 double *m_SumTR;
00181 double *m_SumTT;
00182
00183 friend class SAMCLASSIFIER;
00184 };
00185
00186 RVC::OBJITEM m_HyperObjItem;
00187 RVC::HYPERSPECTRAL m_HyperSpecObj;
00188 bool m_IgnoreAbsorptionBands;
00189 bool m_AverageSamples;
00190 bool m_ProcessLossy;
00191 double m_Tolerance;
00192 double m_AvgTolerance;
00193 BITSET m_ProcBand;
00194 DOUBLE_ARRAY<RVC::HYPERSENSOR::BANDINFO> m_BandInfo;
00195 int m_NumSamples;
00196 SAMPLE **m_Samples;
00197 SAMPLE m_AvgSample;
00198 INT16 *m_linebuf;
00199
00200 friend class SAMCLASSIFIER::SAMPLE;
00201 #endif // GENERATING_DOXYGEN_OUTPUT
00202 };
00203
00204
00205 #endif