MNE-CPP  beta 1.0
colortable.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef COLORTABLE_H
37 #define COLORTABLE_H
38 
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // QT INCLUDES
43 //=============================================================================================================
44 
45 #include <QString>
46 #include <QStringList>
47 #include <QSharedPointer>
48 
49 
50 //*************************************************************************************************************
51 //=============================================================================================================
52 // Eigen INCLUDES
53 //=============================================================================================================
54 
55 #include <Eigen/Core>
56 
57 
58 //*************************************************************************************************************
59 //=============================================================================================================
60 // DEFINE NAMESPACE FSLIB
61 //=============================================================================================================
62 
63 namespace FSLIB
64 {
65 
66 //*************************************************************************************************************
67 //=============================================================================================================
68 // USED NAMESPACES
69 //=============================================================================================================
70 
71 using namespace Eigen;
72 
73 //=============================================================================================================
80 {
81 public:
82  typedef QSharedPointer<Colortable> SPtr;
83  typedef QSharedPointer<const Colortable> ConstSPtr;
85  //=========================================================================================================
89  explicit Colortable();
90 
91  //=========================================================================================================
95  void clear();
96 
97  //=========================================================================================================
103  inline VectorXi getLabelIds() const;
104 
105  //=========================================================================================================
111  inline QStringList getNames() const;
112 
113  //=========================================================================================================
119  inline MatrixX4i getRGBAs() const;
120 
121 public:
122  QString orig_tab;
123  qint32 numEntries;
124  QStringList struct_names;
125  MatrixXi table;
126 };
127 
128 //*************************************************************************************************************
129 //=============================================================================================================
130 // INLINE DEFINITIONS
131 //=============================================================================================================
132 
133 inline VectorXi Colortable::getLabelIds() const
134 {
135  VectorXi p_vecIds;
136  if (table.cols() == 5)
137  p_vecIds = table.block(0,4,table.rows(),1);
138 
139  return p_vecIds;
140 }
141 
142 
143 //*************************************************************************************************************
144 
145 inline QStringList Colortable::getNames() const
146 {
147  return struct_names;
148 }
149 
150 
151 //*************************************************************************************************************
152 
153 inline MatrixX4i Colortable::getRGBAs() const
154 {
155  MatrixX4i p_matRGBAs;
156  if (table.cols() == 5)
157  p_matRGBAs = table.block(0,0,table.rows(),4);
158 
159  return p_matRGBAs;
160 }
161 
162 
163 } // NAMESPACE
164 
165 #endif // COLORTABLE_H
QSharedPointer< Colortable > SPtr
Definition: colortable.h:82
VectorXi getLabelIds() const
Definition: colortable.h:133
QStringList struct_names
Definition: colortable.h:124
MatrixX4i getRGBAs() const
Definition: colortable.h:153
Vertices label based lookup table.
Definition: colortable.h:79
QSharedPointer< const Colortable > ConstSPtr
Definition: colortable.h:83
QStringList getNames() const
Definition: colortable.h:145