Go to the documentation of this file.
11 #ifndef SYSTEMPROCESSSAVE_HPP
12 #define SYSTEMPROCESSSAVE_HPP
16 #include <QFileDialog>
19 #include <QTreeWidget>
27 class Ui_SaveMeshDialog;
28 class Ui_ExportMeshDialog;
29 class Ui_ExportStackDialog;
30 class Ui_PlyCellGraphDlg;
93 setName(
"Stack/System/Save");
94 setDesc(
"Save a stack into a known 3D image format");
96 addParm(
"Filename",
"Filename",
"");
97 addParm(
"Store",
"Store",
"Main", storeChoice());
98 addParm(
"Stack Number",
"Stack number",
"0");
99 addParm(
"Compression Level",
"Compression level, from 0 to 9",
"5");
100 addParm(
"HDF5 DataSetName",
"HDF5 DataSetName",
"/label");
103 bool initialize(QWidget* parent);
113 bool run(
Stack* stack,
Store* store,
const QString& filename,
int compressionLevel = 0);
114 QIcon
icon()
const {
return QIcon(
":/images/save.png"); }
129 setName(
"Stack/System/Export");
130 setDesc(
"Export a stack into an image sequence.");
132 addParm(
"Filename",
"Filename",
"");
133 addParm(
"Store",
"Store",
"Main", storeChoice());
134 addParm(
"Format",
"Format",
"CImg Auto");
135 addParm(
"Generate Voxel Spacing",
"Generate Voxel Spacing",
"No", booleanChoice());
136 addParm(
"Stack Number",
"Stack number",
"0");
137 addParm(
"Num Digits",
"Number of digits for file numbering",
"0");
140 bool initialize(QWidget* parent);
156 bool run(
Stack* stack,
Store* store,
const QString& filename,
const QString& type,
157 unsigned int nb_digit,
bool generate_voxel_spacing);
158 QIcon
icon()
const {
return QIcon(
":/images/save.png"); }
161 void selectImageFile();
162 void setImageType(
const QString& type);
165 Ui_ExportStackDialog*
ui;
243 setName(
"Mesh/System/Save");
244 setDesc(
"Save a mesh into a known mesh format");
246 addParm(
"Filename",
"Filename",
"");
247 addParm(
"Transform",
"Transform",
"No", booleanChoice());
248 addParm(
"Mesh Number",
"Mesh number",
"0", QStringList() <<
"0" <<
"1");
258 bool run(
Mesh* mesh,
const QString& filename,
bool transform);
259 QIcon
icon()
const {
return QIcon(
":/images/save.png"); }
260 bool initialize(QWidget* parent);
263 void selectMeshFile();
266 QString properFile(QString filename)
const;
267 void setMeshFile(
const QString& filename);
270 bool saveMesh(
Mesh* mesh,
const QString& filename,
bool transform);
273 Ui_SaveMeshDialog*
ui;
438 setName(
"Mesh/System/Export");
439 setDesc(
"Export a mesh into a known mesh format");
441 addParm(
"Filename",
"Filename",
"");
442 addParm(
"Kind",
"Kind",
"Text", QStringList() <<
"PLY Binary" <<
"PLY Ascii" <<
"VTK Mesh Binary"
443 <<
"VTK Mesh Ascii" <<
"Text" <<
"Cells" <<
"MeshEdit" <<
"STL" <<
"OBJ");
444 addParm(
"Transform",
"Transform",
"no", booleanChoice());
445 addParm(
"Mesh Number",
"Mesh number",
"0", booleanChoice());
446 addParm(
"Extended PLY",
"If the PLY format is chosen, save a mesh file with extended information",
"No", booleanChoice());
457 bool run(
Mesh* mesh,
const QString& filename,
const QString& type,
bool transform);
458 QIcon
icon()
const {
return QIcon(
":/images/save.png"); }
459 bool initialize(QWidget* parent);
461 bool savePLY(
Mesh* mesh,
const QString& filename,
bool transform,
bool binary =
false);
464 void selectMeshFile();
465 void selectMeshType(
const QString& type);
468 QString properFile(QString filename,
const QString& type)
const;
469 void setMeshFile(
const QString& filename);
472 bool saveText(
Mesh* mesh,
const QString& filename,
bool transform);
473 bool saveCells(
Mesh* mesh,
const QString& filename,
bool transform);
474 bool saveMeshEdit(
Mesh* mesh,
const QString& filename,
bool transform);
475 bool saveMeshSTL(
Mesh* mesh,
const QString& filename,
bool transform);
476 bool saveVTU(
Mesh* mesh,
const QString& filename,
bool transform,
bool binary =
false);
477 bool saveOBJ(
Mesh* mesh,
const QString& filename,
bool transform);
480 Ui_ExportMeshDialog*
ui;
482 bool extendedPLY =
false;
496 setName(
"Misc/System/Save View");
497 setDesc(
"Save the view file for the current configuration.");
499 addParm(
"Filename",
"Filename",
"");
507 bool run(
const QString& filename);
509 bool initialize(QWidget* parent);
511 QIcon
icon()
const {
return QIcon(
":/images/save.png"); }
525 setName(
"Misc/System/Quick Save");
526 setDesc(
"Save all active mesh, stack and view files.");
528 addParm(
"Save with File Extensions",
"Save with File Extensions",
"No", booleanChoice());
529 addParm(
"Extension Counter",
"Extension Counter",
"1");
532 void saveStore(
int stackNr,
Store* store,
int compressionLevel);
533 void saveMesh(
int meshNr);
535 QString addIncSuffix(QString filename, QString fileExtension);
540 bool initialize(QWidget* parent);
548 QIcon
icon()
const {
return QIcon(
":/images/save.png"); }
577 setName(
"Misc/System/Snapshot");
578 setDesc(
"Take a snapshot of the current view");
580 addParm(
"Filename",
"Filename",
"");
581 addParm(
"Expand Frustum",
"Expand Frustum",
"false");
582 addParm(
"Width",
"Width",
"0");
583 addParm(
"Height",
"Height",
"0");
584 addParm(
"Oversampling",
"Oversampling",
"1.0");
585 addParm(
"Quality",
"Quality",
"95");
590 QString filename = parm(
"Filename");
591 if(filename.isEmpty())
592 return setErrorMessage(
"Error, no file name specified.");
593 int width = parm(
"Width").toInt();
594 int height = parm(
"Height").toInt();
595 float overSampling = parm(
"Oversampling").toFloat();
596 int quality = parm(
"Quality").toInt();
597 bool expand_frustum =
stringToBool(parm(
"Expand Frustum"));
598 return run(filename, overSampling, width, height, quality, expand_frustum);
601 bool run(QString filename,
float overSampling,
int width,
int height,
int quality,
bool expand_frustum);
603 QIcon
icon()
const {
return QIcon(
":/images/SaveScreenshot.png"); }
616 setName(
"Stack/System/Batch Open and Save");
617 setDesc(
"Opens and saves a compressed TIFF for all tif stacks of a folder");
619 addParm(
"Folder",
"Folder",
"");
620 addParm(
"File Prefix",
"File Prefix for new files",
"MGX_");
621 addParm(
"Compression Level",
"Compression Level (-1 to 9)",
"9");
628 bool initialize(QWidget* parent);
629 QIcon
icon()
const {
return QIcon(
":/images/open.png"); }
637 setName(
"Mesh/Export/Cell Graph 3D");
638 setDesc(
"Export the 3D cell graph");
639 setIcon(QIcon(
":/images/CellGraph3D.png"));
641 addParm(
"File Name",
"File name to save cell graph",
"CellGraph3D.csv");
642 addParm(
"Min Area",
"Minimum area of cell-cell interfaces to include in CSV file, 0 for all",
"0.0");
643 addParm(
"Tolerance",
"Tolerance for collapsing shared vertices",
"0.0001");
652 bool res =
run(m,
parm(
"File Name"),
parm(
"Min Area").toDouble(),
parm(
"Tolerance").toDouble());
658 bool run(
Mesh*
mesh,
const QString &fileName,
double minArea,
double tolerance);
bool savePLYCellGraph(Mesh *mesh, const QString &filename, bool binary)
bool addParm(const QString &parmName, const QString &desc, const QString &def, const QStringList &choices=QStringList())
Add a parameter to the list.
StackExport(const Process &proc)
TakeSnapshot(const Process &proc)
bool run()
Runs the process.
SaveViewFile(const Process &proc)
Distributed matrix library.
@ MESH_NON_EMPTY
Non-empty mesh.
CheckState checkState()
Call this function and convert the result to a boolean.
Ui_ExportStackDialog * ui
bool setIcon(const QIcon &icon)
Set the icon.
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
StackOpenSaveFolder(const Process &proc)
MeshExport(const Process &proc)
bool setDesc(const QString &description)
Set the description.
bool run()
Runs the process.
CellGraph3D(const Process &process)
MeshSave(const Process &proc)
Mesh * mesh(int i)
Returns the ith mesh.
bool setName(const QString &name)
Set the name.
QString parm(const QString &name) const
Get a single parameter value by name.
Mesh * currentMesh()
Returns the current mesh (i.e.
QuickSaveFile(const Process &proc)
StackSave(const Process &proc)