-
Notifications
You must be signed in to change notification settings - Fork 6
/
GUI.h
executable file
·232 lines (183 loc) · 6.54 KB
/
GUI.h
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#ifndef DEF_GUI
#define DEF_GUI
/*Qt classes*/
#include <QFileDialog>
#include <QMessageBox>
#include <QProcess>
#include <QFile>
#include <QTextStream>
#include <QCloseEvent>
#include <QSignalMapper>
#include <QDialog>
#include <QLabel>
#include <QComboBox>
#include <QStackedWidget>
/*std classes*/
#include <stdio.h>
#include <stdlib.h>
#include <vector>
/*itk classes*/
#include "itkImage.h"
#include "itkImageFileReader.h"
#include <itksys/SystemTools.hxx> // for FindProgram()
#include "ui_GUIwindow.h"
#include "ScriptWriter.h"
class GUI : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
/*CONSTRUCTOR*/
GUI(std::string ParamFile, std::string ConfigFile, std::string CSVFile, bool overwrite, bool noGUI, bool Testing, std::string commandRan); //constructor
/*INIT*/
void InitOptions();
/*CASES*/
bool FileIsParameterFile( std::string );
bool FileIsSoftConfigFile( std::string );
void AddCasesToListWidget(QStringList, QString);
void CheckCasesIndex();
/* QC */
void DisableQC();
void EnableQC();
/*DATASET*/
int ReadCSV(QString CSVfile); // returns -1 if fails, otherwise 0
void SaveCSVResults(int Crop, int nbLoops);
/*PARAMETERS*/
int LoadParameters(QString paramFile, bool DiscardParametersCSV); // returns -1 if fails, otherwise 0
bool LoadParametersReturnTrueIfCorrupted(QString ReadParameter, const char* Parameter );
bool LoadParametersLoadScaleLevelReturnTrueIfCorrupted( QStringList nbrs,
QCheckBox* SLcheckBox, // & so we can change the value
QSpinBox* SLspinBox,
QSpinBox* nbIterSpinBox,
QDoubleSpinBox*& alphaDoubleSpinBox,
QDoubleSpinBox*& betaDoubleSpinBox,
QDoubleSpinBox*& gammaDoubleSpinBox,
QDoubleSpinBox*& maxPerturbationDoubleSpinBox );
void SaveParameters(QString ParamBrowseName,QString CSVFileName);
/*XML FILE*/
void GenerateXMLForGA();
/*SOFT CONFIG*/
int LoadConfig(QString ConfigFile); // returns -1 if fails, otherwise 0
bool LoadConfigReturnTrueIfCorrupted(QString ReadProgram, const char* Program);
/*CHECK IMAGE*/
int checkImage(std::string Image); // returns 1 if not an image, 2 if not a dti, otherwise 0
/*MAIN FUNCT*/
bool CheckCase( std::string, bool );
bool CheckAllCases();
bool CheckOutput( bool& ); // FirstComputeInOutputFolder
bool CheckTemplate();
void SetResampOptions();
void CheckProgram( std::string, QLineEdit*, std::string& );
bool CheckPrograms();
bool CheckProgramExecutable( QLineEdit* );
bool CheckProgramsExecutable();
bool FindPython();
bool CheckVoxelSizeAndCropping();
void SetOtherOptions();
void GenerateScriptFile( std::string, std::string );
void GenerateServerScript();
void WriteChangeHistoryLogFile(std::string OldVersion);
bool CheckVersionLogFile( bool );
int LaunchScriptWriter(); // returns -1 if failed, otherwise 0
int LaunchScriptRunner();
void RunningCompleted();
void RunningFailed();
public slots:
/*CASES*/
void OpenAddCaseBrowseWindow();
void RemoveSelectedCases();
/*OUTPUT*/
void OpenOutputBrowseWindow();
void CleanOutputFolder();
/*DTIREG*/
void OpenDTIRegExtraPathBrowseWindow();
/*TEMPLATE*/
void OpenTemplateBrowseWindow();
/*QC*/
void DisplayAffineQC();
void DisplayDeformQC();
void DisplayResampQC();
/*EXIT*/
void ExitProgram();
/*DATASET*/
void ReadCSVSlot();
void SaveCSVDatasetBrowse();
/*PARAMETERS*/
void LoadParametersSlot();
void SaveParametersSlot();
/*SOFT CONFIG*/
void LoadConfigSlot();
void SaveConfig();
void ConfigDefault();
void BrowseSoft(int); //in the soft dialog window
void ResetSoft(int);
int testGA(); // returns 0 if version ok, -1 if bad version
int testDTIReg(); // returns 0 if version ok, -1 if bad version
/*READ ME*/
void ReadMe();
void KeyShortcuts();
/*RESAMP PARAM*/
void InterpolTypeComboBoxChanged(int);
void TensorInterpolComboBoxChanged(int);
/*DTI-REG*/
void RegMethodComboBoxChanged(int);
void SimMetChanged(int);
void ANTSRegTypeChanged(int);
/*WIDGETCHANGE*/
void WidgetHasChangedParamNoSaved();
void GridProcesscheckBoxHasChanged(int);
void OutputFolderLineEditHasChanged(QString);
/*MAIN FUNCT*/
int Compute();
void ScriptQProcessDone(int);
void KillScriptQProcess();
void UpdateScriptRunningGUIDisplay();
signals: // none
protected :
/*CASES*/
void dragEnterEvent(QDragEnterEvent*event);
void dropEvent(QDropEvent* event);
/*EXIT*/
void closeEvent(QCloseEvent* event);
private:
bool m_noGUI;
bool m_Testing;
bool m_ErrorDetectedInConstructor; // useful in --nogui mode to exit the program without trying the compute function
bool m_ScriptRunning;
std::vector< std::string > m_FindProgramDTIABExecDirVec;
std::string m_DTIABSlicerExtensionExternalBinDir;
std::string m_PythonPath;
/*CASES*/ std::vector < QLineEdit* > m_CasesQ; // index begin at 0
std::vector < std::string > m_CasesPath; // index begin at 0
/*DATASET*/ QString m_CSVseparator;
QString m_CSVPath;
QString m_OutputPath;
QString m_TemplatePath;
QString m_lastCasePath;
/*PARAMETERS*/ int m_ParamSaved; // 0 if the last parameters have not been saved, 1 if the last have been saved
/*SOFT CONFIG*/ int m_FromConstructor; // do not test GA path if 'Default' called from constructor
/*RESAMP PARAM*/QComboBox *m_windowComboBox;
QComboBox *m_BSplineComboBox;
QStackedWidget *m_optionStackLayout;
QComboBox *m_nologComboBox;
QStackedWidget *m_logOptionStackLayout;
/*DTI-REG*/ QStackedWidget *m_DTIRegOptionStackLayout;
/*BRAINS*/
QComboBox *m_BRegTypeComboBox;
QComboBox *m_TfmModeComboBox;
QSpinBox *m_NbPyrLevSpin;
QLineEdit *m_PyrLevItLine;
/*ANTS*/
QComboBox *m_ARegTypeComboBox;
QLineEdit *m_TfmStepLine;
QLineEdit *m_IterLine;
QComboBox *m_SimMetComboBox;
QDoubleSpinBox *m_SimParamDble;
QLabel *m_SimParamLabel;
QDoubleSpinBox *m_GSigmaDble;
QCheckBox *m_SmoothOffCheck;
/*MAIN FUNCT*/ ScriptWriter* m_scriptwriter; ////contains the writing pipeline
int m_NeedToBeCropped;
QProcess * m_ScriptQProcess;
QTimer * m_ScriptRunningQTimer;
};
#endif