00001 #ifndef Mapcode_H
00002 #define Mapcode_H
00003
00004 #include "defs.h"
00005 #include "util.h"
00006 #include "TopolParams.h"
00007
00016 class Mapcode {
00017 private:
00018 TMatrix _codebook;
00019 int _dimension;
00020 int _dimensions[MaxDimension];
00021 int _lattice;
00022 int _neighbor_type;
00023 TLabel _label;
00024 TMatrix _cluster_label;
00025 TopolParams _topol;
00026 int _numvar;
00027 public:
00028
00029 void CreateCodebook( int size, int dimension );
00030
00031 void setNumVar( int );
00032
00033 int getNumVar() const;
00034
00035 void setTopolParamsText( string str );
00036
00037 TopolParams getTopolParams() const;
00038
00040 void setClusterLabel( TMatrix cl );
00041
00043 TMatrix getClusterLabel();
00044
00046 TMatrix getCodebook() const;
00047
00049 void setCodebook( TMatrix codebook );
00050
00052 int getDimension() const;
00053
00055 void setDimension( int d );
00056
00058 int getDimensions( int index ) const;
00059
00061 void setDimensions( int index, int value );
00062
00064 int getLattice() const;
00065
00067 void setLattice( int l );
00068
00070 int getNeighborType() const;
00071
00073 void setNeighborType( int n );
00074
00076 int getMapSize() const;
00077
00079 int* getDimensions();
00080
00082 TLabel getLabel();
00083
00085 void setLabel( TLabel t );
00086
00087 void setLattice( string str );
00088
00089 void setNeighborType( string str );
00090
00091 };
00092
00093 void
00094 Mapcode::CreateCodebook( int size, int dimension )
00095 {
00096 _codebook = create_matrix( 1, size, 1, dimension );
00097 };
00098
00099 void
00100 Mapcode::setNumVar( int numvar ) {
00101 _numvar = numvar;
00102 };
00103
00104 int
00105 Mapcode::getNumVar() const
00106 {
00107 return _numvar;
00108 };
00109
00110 void
00111 Mapcode::setLattice( string str ) {
00112 if ( str == HEXA_STR )
00113 _lattice = HEXA;
00114 else
00115 if ( str == RECT_STR )
00116 _lattice = RECT;
00117
00118 if ( str == TORO_STR )
00119 _lattice = TORO;
00120
00121 };
00122
00123 void
00124 Mapcode::setNeighborType( string str ) {
00125 if ( str == GAUSSIAN_STR )
00126 _neighbor_type = GAUSSIAN;
00127 else
00128 if ( str == BUBBLE_STR )
00129 _neighbor_type = BUBBLE;
00130 else
00131 if ( str == CUTGAUSS_STR )
00132 _neighbor_type = CUTGAUSS;
00133 else
00134 if ( str == EP_STR )
00135 _neighbor_type = EP;
00136 };
00137
00138 void
00139 Mapcode::setTopolParamsText( string str ) {
00140 _topol.dimension = str;
00141 };
00142
00143 TopolParams
00144 Mapcode::getTopolParams() const {
00145 return _topol;
00146 };
00147
00148 void
00149 Mapcode::setClusterLabel( TMatrix cl ) {
00150 _cluster_label = cl;
00151 };
00152
00153 TMatrix
00154 Mapcode::getClusterLabel() {
00155 return _cluster_label;
00156 };
00157
00158 TMatrix
00159 Mapcode::getCodebook() const {
00160 return _codebook;
00161 };
00162
00163 void
00164 Mapcode::setCodebook( TMatrix codebook ) {
00165 _codebook = codebook;
00166 };
00167
00168 int
00169 Mapcode::getDimension() const
00170 {
00171 return _dimension;
00172 };
00173
00174 void
00175 Mapcode::setDimension( int d ) {
00176 _dimension = d;
00177 };
00178
00179 int
00180 Mapcode::getDimensions( int index ) const
00181 {
00182 return _dimensions[ index ];
00183 };
00184
00185 void
00186 Mapcode::setDimensions( int index, int value ) {
00187 _dimensions[ index ] = value;
00188 };
00189
00190 int
00191 Mapcode::getLattice() const
00192 {
00193 return _lattice;
00194 };
00195
00196 void
00197 Mapcode::setLattice( int l ) {
00198 _lattice = l;
00199 };
00200
00201 int
00202 Mapcode::getNeighborType() const
00203 {
00204 return _neighbor_type;
00205 };
00206
00207 void
00208 Mapcode::setNeighborType( int n ) {
00209 _neighbor_type = n;
00210 };
00211
00212 int *
00213 Mapcode::getDimensions()
00214 {
00215 return _dimensions;
00216 };
00217
00218 int
00219 Mapcode::getMapSize() const {
00220 int i; float size = 1.0;
00221 for (i=0; i< _dimension; i++) size *= _dimensions[ i ];
00222 return (int)size;
00223 };
00224
00225
00226 TLabel
00227 Mapcode::getLabel() {
00228 return _label;
00229 };
00230
00231
00232 void
00233 Mapcode::setLabel(TLabel t) {
00234 _label = t;
00235 };
00236
00237
00238 #endif