forked from adrienkaiser/DTIAtlasBuilder
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathScriptWriter.h
executable file
·134 lines (115 loc) · 4.43 KB
/
ScriptWriter.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
#ifndef DEF_SCRIPTWRITER
#define DEF_SCRIPTWRITER
/*std classes*/
#include <iostream>
#include <string>
#include <vector>
#include <math.h>// for the absolute value
#include <string>
#include <iostream>
#include <iomanip>
// QT
#include <QString>
#include <QStringList>
/*json classes*/
#include <iostream>
#include "nlohmann/json.hpp"
/*itk classes*/
#include "itkImage.h"
#include "itkImageFileReader.h"
/* Namespace */
using json = nlohmann::json;
class ScriptWriter
{
public:
ScriptWriter();
/* SUB WRITING FUNCTIONS */
std::string pyExecuteCommandPreprocessCase ( std::string NameOfFileVarToTest, std::string NameOfCmdVarToExec, std::string ErrorTxtToDisplay, std::string SpacesBeforeFirstIf );
/*WRITING FUNCTIONS*/
void WriteScript();
void Preprocess();
void AtlasBuilding();
void MainScript();
// New code with template python code
void WriteScriptFromTemplate(QStringList);
void PreprocessFromTemplate(std::string);
void AtlasBuildingFromTemplate(std::string);
void MainScriptFromTemplate(std::string);
void UtilitiesScriptFromTemplate(std::string);
/*SCRIPT ACCESSORS*/
void setExecutableDir(std::string);
std::string getScript_Preprocess();
std::string getScript_AtlasBuilding();
std::string getScript_Main();
std::string getScript_Utilities();
/*CHECK DATASET*/
int setCroppingSize( bool SafetyMargin ); // returns 0 if no cropping , 1 if cropping needed
int CheckVoxelSize(QStringList); // returns 0 if voxel size OK , otherwise 1
/*SET THE VALUES*/
/* Script Configuration */
void SaveScriptConfiguration(void);
/* */
void setHierarchy(json);
/* */
void setCasesPath(std::vector < std::string > CasesPath);
void clearCasesPath();
void setOutputPath(std::string OutputPath);
void setRegType(int RegType);
void setnbLoops(int nbLoops);
void setnbLoopsDTIReg(int nbLoopsDTIReg);
void setTemplatePath(std::string FAAtlasrefPath);
void setOverwrite(int Overwrite);
void setInterpolType(std::string Type);
void setInterpolOption(std::string Option);
void setTensInterpol(std::string TensInterpol);
void setInterpolLogOption(std::string InterpolLogOption);
void setTensorTfm(std::string TensTfm);
void setSoftPath(std::vector < std::string > SoftPath);
void setDTIRegOptions(std::vector < std::string > DTIRegOptions);
void setDTIRegExtraPath(std::string DTIRegExtraPath);
void setBFAffineTfmMode(std::string BFAffineTfmMode);
void setGridProcess(bool useGridProcess);
void setGridGeneralCommand(std::string GridCommand);
void setGridAtlasCommand(std::string GridCommand);
std::string setGridCommand(std::string GridCommand);
void setPythonPath(std::string PythonPath);
void setNbThreads(int NbThreads);
int setScalarMeasurement( std::string scalarMeasurement ) ;
private:
/* Environment */
std::string m_ExecutableDir;
/* Hierarchical Build */
json m_HierarchyBuild;
/* VALUES */
std::vector < std::string > m_CasesPath;
std::vector < std::string > m_CasesIDs;
std::string m_OutputPath;
int m_RegType; //=0 for using template and =1 for using existing first case
int m_nbLoops;
int m_nbLoopsDTIReg; // default 1. Number of iteration over final resampling.
std::string m_TemplatePath;
std::string m_CropSize [3]; //x,y,z
int m_NeedToBeCropped; //=0 if not and =1 if need to be cropped
int m_Overwrite; //=0 if not and =1 if overwrite on existing files
std::string m_InterpolType;
std::string m_InterpolOption;
std::string m_TensInterpol;
std::string m_InterpolLogOption;
std::string m_TensTfm;
std::vector < std::string > m_SoftPath; // contains the path to the softwares: 1=ImageMath, 2=ResampleDTIlogEuclidean, 3=CropDTI, 4=dtiprocess, 5=BRAINSFit, 6=AtlasWerks, 7=dtiaverage, 8=DTI-Reg, 9=unu
std::vector < std::string > m_DTIRegOptions;
std::string m_DTIRegExtraPath;
std::string m_BFAffineTfmMode;
bool m_useGridProcess;
std::string m_GridGeneralCommand;
std::string m_GridAtlasCommand;
std::string m_PythonPath;
std::string m_NbThreadsString;
std::string m_ScalarMeasurement;
/* SCRIPTS */
std::string m_Script_Preprocess; //contains the whole Script for Pre processing
std::string m_Script_AtlasBuilding; //contains the whole Script for Atlas Building
std::string m_Script_Main;//contains the whole Main Script
std::string m_Script_Utilities;//contains utilities script
};
#endif