Skip to content

Commit a85ba2c

Browse files
author
Hauke Jürgen Mönck
committed
Polishing: CSV fillers, more convinient plugin creation, removing comments
1 parent 541f390 commit a85ba2c

8 files changed

Lines changed: 31 additions & 47 deletions

File tree

BioTracker/CoreApp/BioTracker/Model/DataExporters/DataExporterCSV.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,12 @@ void DataExporterCSV::writeAll() {
238238
//write header
239239
int vcount = _root->validCount();
240240
IModelTrackedComponentFactory* factory = ctr ? ctr->getComponentFactory() : nullptr;
241+
int headerCount = 0;
241242
if (factory != nullptr) {
242243
IModelTrackedComponent *ptraj = static_cast<IModelTrackedComponent*>(factory->getNewTrackedElement("0"));
243-
o << getHeader(ptraj, vcount) << "\n";
244+
std::string header = getHeader(ptraj, vcount);
245+
headerCount = getHeaderElements(ptraj).size();
246+
o << header << "\n";
244247
delete ptraj;
245248
}
246249

@@ -254,18 +257,27 @@ void DataExporterCSV::writeAll() {
254257
o << std::to_string(idx)
255258
<< _separator + std::to_string((((float)idx) / _fps) * 1000);
256259

260+
int linecnt = 0;
257261
//i is the track number
258262
for (int i = 0; i < _root->size(); i++) {
259263

260264
IModelTrackedTrajectory *t = dynamic_cast<IModelTrackedTrajectory *>(_root->getChild(i));
261265
if (t) {
262266
IModelTrackedPoint *e = dynamic_cast<IModelTrackedPoint*>(t->getChild(idx));
263267
if (e) {
264-
o << writeComponentCSV(e, trajNumber);
268+
std::string line = writeComponentCSV(e, trajNumber);
269+
o << line;
270+
linecnt++;
265271
}
266272
trajNumber++;
267273
}
268274
}
275+
int count = _root->validCount();
276+
while (linecnt < count) {
277+
for (int i = 0; i<headerCount; i++)
278+
o << _separator;
279+
linecnt++;
280+
}
269281
o << std::endl;
270282
}
271283
o.close();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "IBioTrackerPlugin.h"
2+
3+
IView *IBioTrackerPlugin::getTrackerParameterWidget() { return nullptr; };
4+
IView *IBioTrackerPlugin::getTrackerElementsWidget() { return nullptr; };
5+
IModel *IBioTrackerPlugin::getTrackerComponentModel() { return nullptr; };
6+
void IBioTrackerPlugin::sendCorePermissions() { return; };
7+
IModelTrackedComponentFactory *IBioTrackerPlugin::getComponentFactory() { return nullptr; };
8+
void IBioTrackerPlugin::connectInterfaces() { return; };
9+
void IBioTrackerPlugin::receiveAreaDescriptor(IModelAreaDescriptor *areaDescr) { return; };

BioTracker/Interfaces/BioTrackerInterfaces/Interfaces/IBioTrackerPlugin.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ class IBioTrackerPlugin : public QObject
1818

1919
virtual void createPlugin() = 0;
2020

21-
virtual IView *getTrackerParameterWidget() = 0;// { return nullptr; };
22-
virtual IView *getTrackerElementsWidget() = 0;// { return nullptr; };
23-
virtual IModel *getTrackerComponentModel() = 0;// { return nullptr; };
24-
virtual void sendCorePermissions() = 0;// { return; };
21+
virtual IView *getTrackerParameterWidget();
22+
virtual IView *getTrackerElementsWidget();
23+
virtual IModel *getTrackerComponentModel();
24+
virtual void sendCorePermissions();
2525

26-
virtual IModelTrackedComponentFactory *getComponentFactory() = 0;// { return nullptr; };
26+
virtual IModelTrackedComponentFactory *getComponentFactory();
2727

2828
private:
29-
virtual void connectInterfaces() = 0;
29+
virtual void connectInterfaces();
3030

3131
Q_SIGNALS:
3232
virtual void emitCvMat(std::shared_ptr<cv::Mat> mat, QString name) = 0;
@@ -36,7 +36,7 @@ class IBioTrackerPlugin : public QObject
3636

3737
public Q_SLOTS:
3838
virtual void receiveCurrentFrameFromMainApp(std::shared_ptr<cv::Mat> mat, uint frameNumber) = 0;
39-
virtual void receiveAreaDescriptor(IModelAreaDescriptor *areaDescr) = 0;
39+
virtual void receiveAreaDescriptor(IModelAreaDescriptor *areaDescr);
4040

4141
private Q_SLOTS:
4242
virtual void receiveCvMatFromController(std::shared_ptr<cv::Mat> mat, QString name) = 0;

BioTracker/Plugin/BackgroundSubtraction/Model/BioTrackerTrackingAlgorithm.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ BioTrackerTrackingAlgorithm::BioTrackerTrackingAlgorithm(IModel *parameter, IMod
2323

2424
_lastImage = nullptr;
2525
_lastFramenumber = -1;
26-
27-
//This is null so far...
28-
//_bd.setAreaInfo(_AreaInfo);
2926
}
3027

3128

BioTracker/Plugin/BackgroundSubtraction/Model/TrackedComponents/TrackedElement.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ void TrackedElement::setY(float val) {
9393
_pose = pnew;
9494
};
9595

96-
//TODO for all setters from here -> why no _pose = pnew;?
9796
void TrackedElement::setRad(float r) {
9897
_rad = r;
9998
FishPose pnew(_pose.position_cm(), _pose.position_px(), _rad, _deg, _pose.width(), _pose.height(), _pose.getScore());
@@ -163,14 +162,12 @@ void TrackedElement::operate()
163162

164163
void TrackedElement::pressed()
165164
{
166-
//_pressed = true;
167165
Q_EMIT notifyView();
168166

169167
}
170168

171169
void TrackedElement::notPressed()
172170
{
173-
//_pressed = false;
174171
Q_EMIT notifyView();
175172
}
176173

BioTracker/Plugin/BackgroundSubtraction/Model/TrackedComponents/TrackedTrajectory.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ TrackedTrajectory::TrackedTrajectory(QObject *parent, QString name) :
2323
g_calcValid = 1;
2424
g_validCount = 0;
2525
_size = 0;
26-
_valid = true;// setValid(true);
26+
_valid = true;
2727
}
2828

2929
void TrackedTrajectory::operate()
@@ -118,9 +118,6 @@ int TrackedTrajectory::size()
118118
return (_size == 0 ? _size : _size = _TrackedComponents.size());
119119
}
120120

121-
122-
//int calcValid = 1;
123-
//int validCount = 0;
124121
int TrackedTrajectory::validCount()
125122
{
126123
if (g_calcValid == 1) {

BioTracker/Plugin/BackgroundSubtraction/Model/TrackedComponents/pose/FishPose.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ std::string FishPose::toString(bool rectified)
1919
{
2020
std::ostringstream out;
2121
if(rectified == false)
22-
//out << _position_px.x << "," << _position_px.y << "," << _degAngle << "," << _radAngle;
2322
out << _position_px.x << ";" << _position_px.y << ";" << _degAngle << ";" << _radAngle;
2423
else
25-
//out << _position_cm.x << "," << _position_cm.y << "," << _degAngle << "," << _radAngle;
2624
out << _position_cm.x << ";" << _position_cm.y << ";" << _degAngle << ";" << _radAngle;
2725
return out.str();
2826
}

BioTracker/Plugin/BackgroundSubtraction/View/TrackerParameterView.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ TrackerParameterView::TrackerParameterView(QWidget *parent, IController *control
88
_ui(new Ui::TrackerParameterView)
99
{
1010
_ui->setupUi(this);
11-
12-
//For the spinboxes we don't need this
13-
/*ui->lineEdit_2_binThresh->setValidator(new QIntValidator(this));
14-
ui->lineEdit_3_SizeErode->setValidator(new QIntValidator(this));
15-
ui->lineEdit_4_SizeDilate->setValidator(new QIntValidator(this));
16-
ui->lineEdit_8_MinBlob->setValidator(new QIntValidator(this));
17-
ui->lineEdit_9MaxBlob->setValidator(new QIntValidator(this));
18-
ui->lineEdit_7_MogBack->setValidator(new QDoubleValidator(this));
19-
*/
2011
getNotified();
2112

2213

@@ -46,23 +37,6 @@ void TrackerParameterView::on_comboBoxSendImage_currentIndexChanged(int v) {
4637
parameter->setNewSelection(_ui->comboBoxSendImage->currentText().toStdString());
4738
}
4839

49-
//void TrackerParameterView::on_checkBoxNetwork_stateChanged(int v) {
50-
// TrackerParameter *parameter = qobject_cast<TrackerParameter *>(getModel());
51-
// parameter->setDoNetwork(v);
52-
//}
53-
//
54-
//void TrackerParameterView::on_checkBoxBackground_stateChanged(int v) {
55-
// TrackerParameter *parameter = qobject_cast<TrackerParameter *>(getModel());
56-
// parameter->setDoBackground(v);
57-
//}
58-
//
59-
//void TrackerParameterView::on_pushButtonNoFish_clicked() {
60-
//}
61-
//
62-
//
63-
//void TrackerParameterView::on_checkBoxTrackingArea_stateChanged(int v) {
64-
// Q_EMIT trackingAreaType(v);
65-
//}
6640

6741
void TrackerParameterView::on_pushButton_clicked()
6842
{

0 commit comments

Comments
 (0)