forked from Zwucki/OneArmPhaseTwoStudy_GUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewstudyoverview.cpp
208 lines (182 loc) · 7.18 KB
/
newstudyoverview.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// This file is part of OneArmPhaseTwoStudy.
//
// OneArmPhaseTwoStudy is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// OneArmPhaseTwoStudy is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details (http://www.gnu.org/licenses/).
#include "newstudyoverview.h"
#include "ui_newstudyoverview.h"
NewStudyOverviewPage::NewStudyOverviewPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::NewStudyOverviewPage)
{
ui->setupUi(this);
}
NewStudyOverviewPage::~NewStudyOverviewPage()
{
delete ui;
}
void NewStudyOverviewPage::showStudyOverview(Study *study)
{
ui->rw_overview->setDisplayPatients(false);
ui->rw_overview->setStudy(study);
ui->rw_overview->show();
// Display gernal study-informations.
ui->l_StudyName->setText("<b>Study name</b>: " + study->getStudyName());
ui->l_Investigator->setText("<b>Investigator</b>: " + study->getInvestigator());
ui->l_Biometrician->setText("<b>Biometrician</b>: " + study->getBiometrician());
ui->l_StudyType->setText("<b>Study type</b>: Simondesign"); //noch hardcodiert
//Display informations about the selected design.
if(study->getIsSimondesign())
{
Result* solStrat = study->getSolutionStrategy();
ui->l_SolutionStategy->setText(*(solStrat->name));
QString s;
QTextStream ts(&s, QIODevice::ReadWrite);
ts.setRealNumberPrecision(2);
ts << "<b>First stage</b> : " << solStrat->r1 << "/" << solStrat->n1;
ui->l_r1_n1->setText(s);
s.clear();
ts << "<b>Second stage</b> : " << solStrat->r << "/" << solStrat->n;
ui->l_r_n->setText(s);
s.clear();
ts << "<b>EN(p0)</b> = " << solStrat->enP0 ;
ui->l_enp0->setText(s);
s.clear();
ts << "<b>PET(p0)</b> = " << solStrat->petP0 ;
ui->l_petP0->setText(s);
s.clear();
ts << "<b>Alpha</b> = " << solStrat->alpha ;
ui->l_alpha->setText(s);
s.clear();
ts << "<b>Beta</b> = " << solStrat->beta ;
ui->l_beta->setText(s);
// Display informations about stochastic curtailment if used.
if(solStrat->useCurtailment)
{
ui->gB_Curtailment->show();
s.clear();
ts << "<b>Cut</b> = " << solStrat->cut << "%";
ui->l_cut->setText(s);
Result::Curtailment curt = (*solStrat->curtailmentResults->find(solStrat->cut)).second;
s.clear();
ts << "<b>Alpha_SC</b >= " << curt.type1_errorRate;
ui->l_alphaSC->setText(s);
s.clear();
ts << "<b>Beta_SC</b> = " << curt.type2_errorRate;
ui->l_betaSC->setText(s);
s.clear();
ts << "<b>EN(p0)_SC</b> = " << curt.en_sc;
ui->l_enp0SC->setText(s);
s.clear();
ts << "<b>PET(p0)_SC</b> =" << curt.pet_sc;
ui->l_petP0SC->setText(s);
}
else
ui->gB_Curtailment->hide();
// Display informations about the "flexible extension" if used.
if(solStrat->useFlexible)
{
QString value;
QTableWidgetItem *item;
std::map<int, double>::iterator it;
std::map<int, double> *flexValues;
switch(solStrat->flexSol)
{
case Result::Proportional:
flexValues = solStrat->flexibleAdaptionProp;
ui->l_distributeMethod->setText("<b>Distribution method:<b> Proportional.");
break;
case Result::Equal:
flexValues = solStrat->flexibleAdaptionEqua;
ui->l_distributeMethod->setText("<b>Distribution method:<b> Equal.");
break;
case Result::ToOne:
flexValues = solStrat->flexibleAdaptionToOne;
ui->l_distributeMethod->setText("<b>Distribution method:<b> Smallest.");
break;
case Result::None:
flexValues = solStrat->flexibleAdaptionNone;
ui->l_distributeMethod->setText("<b>Distribution method:<b> None.");
break;
default:
break;
}
it = flexValues->begin();
int k = 0;
double ce;
while( it != flexValues->end())
{
//increase row count to display data
ui->t_flexible_Overview->setRowCount(k +1);
//add data to the three tableWidgets
value = QString::number(k);
item = new QTableWidgetItem(value);
ui->t_flexible_Overview->setItem(k, 0, item);
ce = it->second;
value.sprintf("%.4f",ce);
item = new QTableWidgetItem(value);
ui->t_flexible_Overview->setItem(k, 1, item);
k++;
it++;
}
ui->gB_flexibleOverview->show();
}
else
ui->gB_flexibleOverview->hide();
}
else
{
ui->gB_flexibleOverview->hide();
Sub1_result* solStrat = study->getSolutionStrategy_Sub1();
ui->l_SolutionStategy->setText(*(solStrat->getName()));
QString s;
QTextStream ts(&s, QIODevice::ReadWrite);
ts.setRealNumberPrecision(2);
ts << "<b>First stage</b> : " << solStrat->getR1() << "/" << solStrat->getN1();
ui->l_r1_n1->setText(s);
s.clear();
ts << "<b>Second stage</b> : " << solStrat->getR() << "," << solStrat->getS() << "/" << solStrat->getN();
ui->l_r_n->setText(s);
s.clear();
ts << "<b>EN(p0)</b> = " << solStrat->getEnP0() ;
ui->l_enp0->setText(s);
s.clear();
ts << "<b>PET(p0)</b> = " << solStrat->getPetP0() ;
ui->l_petP0->setText(s);
s.clear();
ts << "<b>Alpha</b> = " << solStrat->getAlpha() ;
ui->l_alpha->setText(s);
s.clear();
ts << "<b>Beta</b> = " << solStrat->getBeta() ;
ui->l_beta->setText(s);
// Display informations about stochastic curtailment if used.
if(solStrat->getUseCurtailment())
{
ui->gB_Curtailment->show();
s.clear();
ts << "<b>Cut</b> = " << solStrat->getCut() << "%";
ui->l_cut->setText(s);
Sub1_result::Curtailment_SubD1 curt = (*solStrat->getCurtailmentResults()->find(solStrat->getCut())).second;
s.clear();
ts << "<b>Alpha_SC</b >= " << curt.type1_errorRate;
ui->l_alphaSC->setText(s);
s.clear();
ts << "<b>Beta_SC</b> = " << curt.type2_errorRate;
ui->l_betaSC->setText(s);
s.clear();
ts << "<b>EN(p0)_SC</b> = " << curt.en_sc;
ui->l_enp0SC->setText(s);
s.clear();
ts << "<b>PET(p0)_SC</b> =" << curt.pet_sc;
ui->l_petP0SC->setText(s);
}
else
ui->gB_Curtailment->hide();
}
}