45 #include <QMapIterator>
51 using namespace Eigen;
52 using namespace RTPROCESSINGLIB;
60 QList<MatrixXi> lMatDetectedTrigger;
62 QMapIterator<int,QList<QPair<int,double> > > idx(mapTriggers);
64 while (idx.hasNext()) {
66 MatrixXi matDetectedTrigger(idx.value().size(),3);
68 for(
int i = 0; i < idx.value().size(); ++i) {
69 matDetectedTrigger(i,0) = idx.value().at(i).first;
70 matDetectedTrigger(i,1) = 0;
71 matDetectedTrigger(i,2) = idx.value().at(i).second;
74 lMatDetectedTrigger << matDetectedTrigger;
77 return lMatDetectedTrigger;
83 const QList<int>& lTriggerChannels,
89 QMap<int,QList<QPair<int,double> > > qMapDetectedTrigger;
92 for(
int i = 0; i < lTriggerChannels.size(); ++i) {
93 int iChIdx = lTriggerChannels.at(i);
96 QList<QPair<int,double> > temp;
97 qMapDetectedTrigger.insert(iChIdx, temp);
100 if(iChIdx > data.rows() || iChIdx < 0) {
101 return qMapDetectedTrigger;
105 for(
int j = 0; j < data.cols(); ++j) {
106 double dMatVal = bRemoveOffset ? data(iChIdx,j) - data(iChIdx,0) : data(iChIdx,j);
108 if(dMatVal >= dThreshold) {
109 QPair<int,double> pair;
110 pair.first = iOffsetIndex+j;
111 pair.second = data(iChIdx,j);
113 qMapDetectedTrigger[iChIdx].append(pair);
115 j += iBurstLengthSamp;
120 return qMapDetectedTrigger;
126 int iTriggerChannelIdx,
130 int iBurstLengthSamp)
132 QList<QPair<int,double> > lDetectedTriggers;
136 if(iTriggerChannelIdx > data.rows() || iTriggerChannelIdx < 0) {
137 return lDetectedTriggers;
141 for(
int j = 0; j < data.cols(); ++j) {
142 double dMatVal = bRemoveOffset ? data(iTriggerChannelIdx,j) - data(iTriggerChannelIdx,0) : data(iTriggerChannelIdx,j);
144 if(dMatVal >= dThreshold) {
145 QPair<int,double> pair;
146 pair.first = iOffsetIndex+j;
147 pair.second = data(iTriggerChannelIdx,j);
149 lDetectedTriggers.append(pair);
151 j += iBurstLengthSamp;
155 return lDetectedTriggers;
161 const QList<int>& lTriggerChannels,
166 int iBurstLengthSamp)
168 QMap<int,QList<QPair<int,double> > > qMapDetectedTrigger;
169 RowVectorXd tGradient = RowVectorXd::Zero(data.cols());
172 for(
int i = 0; i < lTriggerChannels.size(); ++i) {
173 int iChIdx = lTriggerChannels.at(i);
176 QList<QPair<int,double> > temp;
177 qMapDetectedTrigger.insert(iChIdx, temp);
180 if(iChIdx > data.rows() || iChIdx < 0) {
181 return qMapDetectedTrigger;
185 for(
int t = 1; t<tGradient.cols(); t++) {
186 tGradient(t) = data(iChIdx,t)-data(iChIdx,t-1);
190 if(type ==
"Falling") {
191 tGradient = tGradient * -1;
195 for(
int j = 0; j < tGradient.cols(); ++j) {
196 double dMatVal = bRemoveOffset ? tGradient(j) - data(iChIdx,0) : tGradient(j);
198 if(dMatVal >= dThreshold) {
199 QPair<int,double> pair;
200 pair.first = iOffsetIndex+j;
201 pair.second = tGradient(j);
203 qMapDetectedTrigger[iChIdx].append(pair);
205 j += iBurstLengthSamp;
210 return qMapDetectedTrigger;
216 int iTriggerChannelIdx,
221 int iBurstLengthSamp)
223 QList<QPair<int,double> > lDetectedTriggers;
225 RowVectorXd tGradient = RowVectorXd::Zero(data.cols());
228 if(iTriggerChannelIdx > data.rows() || iTriggerChannelIdx < 0) {
229 return lDetectedTriggers;
233 for(
int t = 1; t < tGradient.cols(); ++t) {
234 tGradient(t) = data(iTriggerChannelIdx,t) - data(iTriggerChannelIdx,t-1);
238 if(type ==
"Falling") {
239 tGradient = tGradient * -1;
243 for(
int j = 0; j < tGradient.cols(); ++j) {
244 double dMatVal = bRemoveOffset ? tGradient(j) - data(iTriggerChannelIdx,0) : tGradient(j);
246 if(dMatVal >= dThreshold) {
247 QPair<int,double> pair;
248 pair.first = iOffsetIndex+j;
249 pair.second = tGradient(j);
251 lDetectedTriggers.append(pair);
253 j += iBurstLengthSamp;
257 return lDetectedTriggers;