MNE-CPP  beta 1.0
treebaseddictwindow.cpp
1 //=============================================================================================================
37 //*************************************************************************************************************
38 //=============================================================================================================
39 // INCLUDES
40 //=============================================================================================================
41 
42 #include <utils/mp/atom.h>
43 #include <utils/mp/fixdictmp.h>
44 #include "treebaseddictwindow.h"
45 #include "ui_treebaseddictwindow.h"
46 
47 #include "mainwindow.h"
48 #include "editorwindow.h"
49 #include "stdio.h"
50 
51 //*************************************************************************************************************
52 //=============================================================================================================
53 // QT INCLUDES
54 //=============================================================================================================
55 
56 #include <QtGui>
57 #include <QApplication>
58 #include <QModelIndex>
59 #include <QMessageBox>
60 #include <QtXml/QtXml>
61 
62 //*************************************************************************************************************
63 //=============================================================================================================
64 // USED NAMESPACES
65 //=============================================================================================================
66 
67 using namespace UTILSLIB;
68 
69 TreebasedDictWindow::TreebasedDictWindow(QWidget *parent)
70 : QWidget(parent)
71 , ui(new Ui::TreebasedDictWindow)
72 , _treebased_dict_name("")
73 {
74  ui->setupUi(this);
75 }
76 
77 TreebasedDictWindow::~TreebasedDictWindow()
78 {
79  delete ui;
80 }
81 
82 void TreebasedDictWindow::on_btt_calc_treebased_clicked()
83 {
84  /*
85  qint32 sample_count = ui->spb_AtomLength->value();
86 
87  qint32 count = 0;
88  qreal phase = 0;
89  qreal modulation = 0;
90 
91  _treebased_dict_name = ui->tb_treebased_dict_name->text();
92  QString save_path = QString("Matching-Pursuit-Toolbox/%1.tbd").arg(_treebased_dict_name);
93 
94  QFile file(save_path);
95  file.open(QIODevice::WriteOnly);
96 
97  QXmlStreamWriter xmlWriter(&file);
98  xmlWriter.setAutoFormatting(true);
99 
100  xmlWriter.writeStartDocument();
101  xmlWriter.writeStartElement("builtAtomsTreebasedMP");
102  xmlWriter.writeAttribute("sample_count", QString::number(sample_count));
103 
104  //ToDo: find good stepwidths
105  for(qint32 scale = 1; scale <= sample_count; scale +=3)
106  {
107  for(qint32 translation = 0; translation <sample_count; translation +=2)
108  {
109  modulation = 0;
110  while(modulation < floor(sample_count/2))
111  {
112  phase = 0;
113  //while(phase < 2 * PI)
114  {
115  xmlWriter.writeStartElement("Atom");
116  xmlWriter.writeAttribute("ID", QString::number(count));
117  xmlWriter.writeAttribute("scale", QString::number(scale));
118  xmlWriter.writeAttribute("translation", QString::number(translation));
119  xmlWriter.writeAttribute("modulation", QString::number(modulation));
120  //xmlWriter.writeAttribute("phase", QString::number(phase));
121  xmlWriter.writeEndElement();
122 
123  count++;
124  // phase += 2*PI / sample_count;//(4*PI)/360;
125  }
126  modulation +=2;//(sample_count/2) / 32;//floor(5/100*sample_count);
127  }
128  }
129  }
130 
131  xmlWriter.writeEndElement();
132  xmlWriter.writeEndDocument();
133 
134  file.close();
135  std::cout << "number of atoms built: " << count << "\n";
136  //FixDictMp::create_tree_dict(save_path);
137  */
138 
139 }
140 
141 void TreebasedDictWindow::on_tb_treebased_dict_name_editingFinished()
142 {
143  //_treebased_dict_name = ui->tb_treebased_dict_name->text();
144 }
145 
146 void TreebasedDictWindow::on_btt_call_tree_creator_clicked()
147 {
148  //QString save_path = QString("Matching-Pursuit-Toolbox/%1.tbd").arg(_treebased_dict_name);
149 
150  //FixDictMp::create_tree_dict(save_path);
151 }
Definition: aboutwindow.h:52
Editorwindow class declaration which enables the generation of individual dictionaries. Gaussian atoms (with parameters scale, modulation and phase) or chirp atoms could be created and saved as part dictionaries. For using the atoms for decompostion it's necessary to build an entire dictionary from serveral (minimum one) part dictionaries.
ATOM class declaration, providing core features and parameters of Atoms used in Matching Pursiut Algo...