11 #ifndef SYSTEMPROCESSLOAD_HPP
12 #define SYSTEMPROCESSLOAD_HPP
15 #include <QFileDialog>
23 class Ui_LoadStackDialog;
24 class Ui_LoadMeshDialog;
25 class Ui_ImportMeshDialog;
44 setName(
"Stack/Filters/Swap Bytes");
45 setDesc(
"Swap the bytes of the values in the stack.");
46 setIcon(QIcon(
":/images/SwapBytes.png"));
51 if(!checkState().store(STORE_NON_EMPTY))
53 Store* input = currentStack()->currentStore();
54 Store* output = currentStack()->work();
55 bool res = run(input, output);
78 setName(
"Stack/System/Import");
79 setDesc(
"Import stack from a series of images");
80 setIcon(QIcon(
":/images/open.png"));
82 addParm(
"Stack",
"Stack",
"-1");
83 addParm(
"Store",
"Store",
"Current", storeChoice() <<
"Current");
84 addParm(
"X Step",
"X Step",
"1.0");
85 addParm(
"Y Step",
"Y Step",
"1.0");
86 addParm(
"Z Step",
"Z Step",
"1.0");
87 addParm(
"Brightness",
"Brightness",
"1.0");
88 addParm(
"Profile File",
"Profile File",
"");
91 bool initialize(QWidget* parent);
95 int stackId = parm(
"Stack").toInt();
96 QString storeName = parm(
"Store");
97 Point3f step(parm(
"X Step").toFloat(), parm(
"Y Step").toFloat(), parm(
"Z Step").toFloat());
98 float brightness(parm(
"Brightness").toFloat());
99 QString filename(parm(
"Profile File"));
102 Stack* stk = currentStack();
104 stk = stack(parm(
"Stack").toInt());
105 if(!checkState().stack(STACK_ANY, stackId))
109 if(storeName ==
"Main")
111 else if(storeName ==
"Work")
114 return run(stk, store, step, brightness, filename);
127 bool run(
Stack* stack,
Store* store,
Point3f step,
float brightness, QString filename);
131 void LoadProfile(QString filename = QString());
133 void AddFilesSlot(
const QStringList& files);
134 void RemoveFilesSlot();
135 void FilterFilesSlot();
136 void SortAscendingSlot(
bool val =
true);
137 void SortDescendingSlot();
140 bool LoadProfile(QString filename,
Point3u& size,
Point3f& step,
float& brightness, QStringList& files);
141 void setImageSize(
Point3u size);
143 setImageSize(
Point3u(x, y, z));
145 void setImageResolution(
Point3f step);
147 setImageResolution(
Point3f(x, y, z));
153 Ui_LoadStackDialog*
ui;
170 setName(
"Stack/System/Open");
171 setDesc(
"Open a stack from a known 3D image format");
172 setIcon(QIcon(
":/images/open.png"));
174 addParm(
"Filename",
"Filename",
"");
175 addParm(
"Store",
"Store",
"Main", storeChoice());
176 addParm(
"Stack Number",
"Stack number",
"0");
177 addParm(
"HDF5 DataSetName",
"HDF5 DataSetName",
"/label");
188 bool run(
Stack* stack,
Store* store, QString filename);
190 bool initialize(QWidget* parent);
192 bool loadMGXS_1_3(QIODevice& file,
Stack* stack,
Store* store);
193 bool loadMGXS_1_2(QIODevice& file,
Stack* stack,
Store* store);
194 bool loadMGXS_1_1(QIODevice& file,
Stack* stack,
Store* store);
195 bool loadMGXS_1_0(QIODevice& file,
Stack* stack,
Store* store);
196 bool loadMGXS_0(QIODevice& file,
Stack* stack,
Store* store);
213 setName(
"Mesh/System/Load");
214 setDesc(
"Load a mesh from one of the known formats.");
215 setIcon(QIcon(
":/images/open.png"));
217 addParm(
"Filename",
"Filename",
"");
218 addParm(
"Transform",
"Transform",
"no",booleanChoice());
219 addParm(
"Add",
"Add",
"no",booleanChoice());
220 addParm(
"Stack Number",
"Stack number",
"0");
235 bool run(
Mesh* mesh, QString filename,
bool transform,
bool add);
236 bool initialize(QWidget* parent);
238 bool loadMGXM_0(QIODevice& file,
Mesh* mesh,
bool scale,
bool transform,
bool has_color =
true);
239 bool loadMGXM_1_0(QIODevice& file,
Mesh* mesh,
bool& scale,
bool& transform,
bool has_color =
true);
240 bool loadMGXM_1_1(QIODevice& file,
Mesh* mesh,
bool& scale,
bool& transform,
bool has_color =
true);
241 bool loadMGXM_1_2(QIODevice& file,
Mesh* mesh,
bool& scale,
bool& transform,
bool has_color =
true);
242 bool loadMGXM_1_3(QIODevice& file,
Mesh* mesh,
bool& scale,
bool& transform);
243 bool loadMGXM_2_0(QIODevice& file,
const QList<int> &version,
Mesh* mesh,
bool& scale,
bool& transform);
244 bool loadMGXM_2_1(QIODevice& file,
const QList<int> &version,
Mesh* mesh,
bool& scale,
bool& transform);
246 void findSignalBounds(
Mesh* mesh);
249 void selectMeshFile();
252 void setMeshFile(
const QString& filename);
255 Ui_LoadMeshDialog*
ui;
271 setName(
"Mesh/System/Import");
272 setDesc(
"Import a mesh from one of the known formats.");
273 setIcon(QIcon(
":/images/open.png"));
275 addParm(
"Filename",
"Filename",
"");
276 addParm(
"Kind",
"Kind",
"PLY",
277 QStringList() <<
"VTK Mesh" <<
"Text" <<
"Cells" <<
"Keyence" <<
"MeshEdit");
278 addParm(
"Scale",
"Scale",
"yes", booleanChoice());
279 addParm(
"Transform",
"Transform",
"no", booleanChoice());
280 addParm(
"Add",
"Add",
"no", booleanChoice());
281 addParm(
"Stack Number",
"Stack number",
"0");
297 bool initialize(QWidget* parent);
299 bool run(
Mesh* mesh, QString filename, QString type,
bool scale,
bool transform,
bool add);
302 void selectMeshFile();
303 void selectMeshType(
const QString& type);
306 void setMeshFile(
const QString& filename,
const QString& type = QString());
307 QString properFile(QString filename,
const QString& type)
const;
309 bool loadText(
Mesh* mesh,
const QString& filename,
bool scale,
bool transform,
bool add);
310 bool loadCells(
Mesh* mesh,
const QString& filename,
bool scale,
bool transform,
bool add);
311 bool loadKeyence(
Mesh* mesh,
const QString& filename,
bool scale,
bool transform,
bool add);
312 bool loadMeshEdit(
Mesh* mesh,
const QString& filename,
bool scale,
bool transform,
bool add);
313 bool loadMeshVTK(
Mesh* mesh,
const QString& filename,
bool& scale,
bool transform,
bool add);
314 bool loadMeshOBJ(
Mesh* mesh,
const QString& filename,
bool scale,
bool transform,
bool add);
315 bool loadMeshPLY(
Mesh* mesh,
const QString& filename,
bool scale,
bool transform,
bool add);
318 Ui_ImportMeshDialog*
ui;
336 setName(
"Misc/System/Load All");
337 setDesc(
"Load the data for all existing objects, using the filename and properties set in them.");
338 setIcon(QIcon(
":/images/open.png"));
344 bool loadStore(
Stack* stack,
Store* store, QStringList& errors);
357 setName(
"Misc/System/Load View");
358 setDesc(
"Load a view file and set all the fields and interface. Does not load the data though.");
359 setIcon(QIcon(
":/images/open.png"));
361 addParm(
"Filename",
"Filename",
"");
368 bool run(QString filename);
370 bool initialize(QWidget* parent);
385 setName(
"Mesh/System/Reset");
386 setDesc(
"Reset a mesh, -1 for current.");
387 setIcon(QIcon(
":/images/ClearStack.png"));
389 addParm(
"Mesh",
"Mesh",
"-1");
408 setName(
"Mesh/Lineage Tracking/Save Parents");
409 setDesc(
"Save map of labels to parents labels to a file");
410 setIcon(QIcon(
":/images/ParentsSave.png"));
412 addParm(
"Filename",
"Path to spreadsheet file.",
"");
413 addParm(
"Existing Labels Only",
"Save only labels that currently exist.",
"Yes", booleanChoice());
416 bool initialize(QWidget* parent);
420 if(!checkState().mesh(MESH_ANY))
422 Mesh* m = currentMesh();
423 return run(m, parm(
"Filename"),
stringToBool(parm(
"Existing Labels Only")));
426 bool run(
Mesh* mesh,
const QString& filename,
bool saveOnlyExisting);
440 setName(
"Mesh/Lineage Tracking/Load Parents");
441 setDesc(
"Load map of labels to parents from a file");
442 setIcon(QIcon(
":/images/Parents.png"));
444 addParm(
"Filename",
"Path to label parents file.",
"");
445 addParm(
"FileType",
"File type, CSV(label, parent) or TXT(parent: label, label ...)",
"CSV",
446 QStringList() <<
"CSV" <<
"TXT");
447 addParm(
"Keep",
"Keep existing parents",
"No", booleanChoice());
451 bool initialize(QWidget* parent);
455 if(!checkState().mesh(MESH_ANY))
457 Mesh* m = currentMesh();
458 return run(m, parm(
"Filename"), parm(
"FileType"),
stringToBool(parm(
"Keep")));
461 bool run(
Mesh* mesh,
const QString& filename,
const QString &fileType,
bool keep);
476 setName(
"Mesh/Lineage Tracking/Reset Parents");
477 setDesc(
"Clear mapping from parents to labels");
478 setIcon(QIcon(
":/images/ParentsClear.png"));
483 if(!checkState().mesh(MESH_ANY))
485 Mesh* m = currentMesh();
489 bool run(
Mesh* mesh);