|
MorphoGraphX
2.0-1-227
|
#include <SystemProcessSave.hpp>
Inheritance diagram for mgx::StackSave:Public Member Functions | |
| StackSave (const Process &proc) | |
| bool | initialize (QWidget *parent) |
| Initialize the process. More... | |
| bool | run () |
| Runs the process. More... | |
| bool | run (Stack *stack, Store *store, const QString &filename, int compressionLevel=0) |
| Save the stack. More... | |
| QIcon | icon () const |
Public Member Functions inherited from mgx::Process | |
| Process (const Process &p) | |
| Copy constructor. More... | |
| virtual | ~Process () |
| Virtual destructor. More... | |
| void | actingFile (const QString &filename, bool project_file=false) |
| Method to be called anytime a file is acted on (i.e. More... | |
| QString | actingFile () const |
| Get the file currently defining the path of the system. More... | |
| QString | pythonCall (const QStringList &parms) const |
| Return the python call describing the current process. More... | |
| int | stackCount () const |
| Number of stacks available to the process. More... | |
| Stack * | stack (int i) |
| Returns the ith stack, or 0 if there is no such stack. More... | |
| Stack * | currentStack () |
| Returns the current stack (i.e. More... | |
| Stack * | otherStack () |
| Returns the other stack (i.e. More... | |
| int | currentStackId () const |
| Return the id (i.e. More... | |
| int | otherStackId () const |
| Return the id (i.e. More... | |
| void | setCurrentStackId (int i) |
| Change which stack is current. More... | |
| bool | setCurrentStack (int id, const QString &store) |
| bool | takeSnapshot (QString filename, float overSampling=1.0f, int width=0, int height=0, int quality=95, bool expand_frustum=false) |
| Save screen shot to a file. More... | |
| bool | setStatus (const QString &msg, bool alsoPrint=true) |
| Display a message in the status bar More... | |
| bool | systemCommand (int command, const QStringList &parms) |
| Run a system command. More... | |
| MGXCamera * | camera () |
| Get the camera. More... | |
| std::pair< stack_iterator, stack_iterator > | stacks () |
| Iterate over all the stacks. More... | |
| std::pair< const_stack_iterator, const_stack_iterator > | stacks () const |
| Iterate over all the stacks. More... | |
| Stack * | addStack () |
| Add a new stack to the process. More... | |
| bool | deleteStack (int i) |
| Delete the stack of given id. More... | |
| int | meshCount () const |
| Returns the number of mesh available to the process. More... | |
| Mesh * | mesh (int i) |
| Returns the ith mesh. More... | |
| Mesh * | currentMesh () |
| Returns the current mesh (i.e. More... | |
| Mesh * | otherMesh () |
| Returns the other mesh (i.e. More... | |
| int | currentMeshId () const |
| Returns the id (i.e. More... | |
| int | otherMeshId () const |
| Returns the id (i.e. More... | |
| void | setCurrentMeshId (int i) |
| Change which mesh is current. More... | |
| std::pair< mesh_iterator, mesh_iterator > | meshes () |
| Iterate over all the meshs. More... | |
| std::pair< const_mesh_iterator, const_mesh_iterator > | meshes () const |
| Iterate over all the meshs. More... | |
| Mesh * | addMesh (const Stack *stack) |
| Add a mesh to the process for the given stack. More... | |
| bool | deleteMesh (int i) |
| Remove a mesh from the process. More... | |
| int | selectedLabel () const |
| Get the current selected label. More... | |
| void | setSelectedLabel (int label) |
| Change the current selected label. More... | |
| float | globalBrightness () |
| Return the current setting for the global brightness level. More... | |
| float | globalContrast () |
| Return the current setting for the global contrast level. More... | |
| void | setGlobalBrightness (float value) |
| Change the current setting for the global brightness level. More... | |
| void | setGlobalContrast (float value) |
| Change the current setting for the global contrast level. More... | |
| bool | meshSelection () const |
| Returns if the user has mesh selection active. More... | |
| bool | lineBorderSelection () const |
| Returns is the user has line border selection active. More... | |
| bool | updateState () |
| Update the Gui of MorphoGraphX. More... | |
| bool | updateViewer () |
| Tell the viewer to redraw. More... | |
| bool | loadView (const QString &fileName) |
| Load viewfile. More... | |
| bool | saveView (const QString &fileName) |
| Save viewfile. More... | |
| bool | setErrorMessage (const QString &str) |
| Set an error message that will be displayed if the process returns false. More... | |
| QString | errorMessage () const |
| Get the current error message. More... | |
| void | setWarningMessage (const QString &str) |
| Set a warning message that will be displayed if the process returns true. More... | |
| QString | warningMessage () const |
| Get the current warning message. More... | |
| void | userCancel () const |
| Throw an exception informing the system that the user canceled the current process. More... | |
| const QString & | file () const |
| Get the name of the file that was used to load the current process (i.e. More... | |
| Clip * | clip1 () |
| Return the object defining the first clipping region. More... | |
| Clip * | clip2 () |
| Return the object defining the second clipping region. More... | |
| Clip * | clip3 () |
| Return the object defining the third clipping region. More... | |
| const Clip * | clip1 () const |
| Return the object defining the first clipping region. More... | |
| const Clip * | clip2 () const |
| Return the object defining the second clipping region. More... | |
| const Clip * | clip3 () const |
| Return the object defining the third clipping region. More... | |
| CuttingSurface * | cuttingSurface () |
| Return the cutting surface. More... | |
| const CuttingSurface * | cuttingSurface () const |
| Return the cutting surface. More... | |
| Process * | makeProcess (const QString &processName) |
| Creates a process object by name. More... | |
| template<typename ProcessT > | |
| bool | getProcess (const QString &processName, ProcessT *&p) |
| Gets process. More... | |
| bool | setCurrentParms () |
| Set the parms from the GUI. More... | |
| bool | runProcess (Process &proc, QStringList &parms) throw () |
| Launch a process with generic arguments. More... | |
| bool | runProcess (const QString &processName, QStringList &parms) throw () |
| Launch a process by name. More... | |
| virtual bool | finalize (QWidget *) |
| This is an optional method that is called from the main thread before the process is run. More... | |
| CheckState | checkState () |
| Call this function and convert the result to a boolean. More... | |
Public Member Functions inherited from mgx::ProcessParms | |
| ProcessParms () | |
| virtual | ~ProcessParms () |
| QString | name () const |
| Process name that is using the parameters. More... | |
| QString | description () const |
| Process description. More... | |
| QStringList | parmNames () const |
| List of named parameters. More... | |
| QStringList | parmDescs () const |
| List of parameters descriptions. More... | |
| QStringList | parmDefaults () const |
| List of default parms. More... | |
| ParmChoiceList | parmChoice () const |
| Allows the parameter to have a pick list in the GUI. More... | |
| QIcon | icon () const |
| Icon to use to represent the process in the GUI. More... | |
| QString | parm (const QString &name) const |
| Get a single parameter value by name. More... | |
| const QStringList & | getParms () |
| Get the list of parameter values. More... | |
| bool | setName (const QString &name) |
| Set the name. More... | |
| bool | setDesc (const QString &description) |
| Set the description. More... | |
| bool | addParm (const QString &parmName, const QString &desc, const QString &def, const QStringList &choices=QStringList()) |
| Add a parameter to the list. More... | |
| bool | insertParm (const QString &parmName, const QString &desc, const QString &def, int pos, const QStringList &choices=QStringList()) |
| Insert a parameter to the list. More... | |
| bool | setParm (const QString &parmName, const QString &parm) |
| Set the parameter's value. More... | |
| bool | setParms (const QStringList &parms) |
| Set all the parameter values. More... | |
| bool | setParmDesc (const QString &parmName, const QString &desc) |
| Set the parameter's description. More... | |
| bool | setParmDefault (const QString &parmName, const QString &def) |
| Set the parameter's default value. More... | |
| bool | setParmChoices (const QString &parmName, const QStringList &choices) |
| Set the parameter's choices. More... | |
| bool | setIcon (const QIcon &icon) |
| Set the icon. More... | |
| QStringList | parmList (const QString &key=QString()) const |
| Return a list of parameter names. More... | |
Additional Inherited Members | |
Public Types inherited from mgx::Process | |
| enum | ProcessAction { PROCESS_RUN, PROCESS_STEP, PROCESS_REWIND } |
| Enumeration for process flow control. More... | |
| enum | StackCheckType { STACK_ANY, STACK_NON_EMPTY, STACK_VISIBLE, STACK_EMPTY, STACK_SCALED, STACK_TRANSFORMED, STACK_NON_SCALED, STACK_NON_TRANSFORMED } |
| Enumeration for the bitfield that identifies stack properties. More... | |
| enum | StoreCheckType { STORE_ANY, STORE_NON_EMPTY, STORE_VISIBLE, STORE_EMPTY, STORE_LABEL, STORE_NON_LABEL, STORE_SCALED, STORE_TRANSFORMED, STORE_NON_SCALED, STORE_NON_TRANSFORMED, STORE_WORK, STORE_MAIN } |
| Enumeration for the bitfield that identifies store properties. More... | |
| enum | MeshCheckType { MESH_ANY, MESH_NON_EMPTY, MESH_VISIBLE, MESH_HEAT, MESH_LABEL, MESH_NORMAL, MESH_SIGNAL, MESH_TEXTURE, MESH_IMAGE, MESH_SHOW_MESH, MESH_SHOW_SURF, MESH_ALL, MESH_BORDER, MESH_CELLMAP, MESH_CELLS, MESH_IMG_TEX, MESH_SCALED, MESH_TRANSFORMED, MESH_EMPTY, MESH_NON_CELLS, MESH_NON_IMG_TEX, MESH_NON_SCALED, MESH_NON_TRANSFORMED, MESH_USE_PARENTS } |
| Enumeration for the bitfield that identifies mesh properties. More... | |
| enum | CheckType { CHECK_STACK, CHECK_STORE, CHECK_MESH } |
| Enumeration of the type of checks that can be performed. More... | |
| enum | CheckWhich { CHECK_CURRENT } |
| typedef std::vector< Stack * >::iterator | stack_iterator |
| typedef std::vector< Stack * >::const_iterator | const_stack_iterator |
| typedef std::vector< Mesh * >::iterator | mesh_iterator |
| typedef std::vector< Mesh * >::const_iterator | const_mesh_iterator |
Signals inherited from mgx::Process | |
| void | systemCommandGui (mgx::Process *, int, QStringList) |
| void | systemCommandProcess (mgx::Process *, int, QStringList) |
Static Public Member Functions inherited from mgx::ProcessParms | |
| static QStringList | booleanChoice () |
| Helper function that provides a list of choices for a boolean argument. More... | |
| static QStringList | storeChoice () |
| Helper function that provides a list of choices for choosing from the main or work stack. More... | |
| static QStringList | stackChoice () |
| Helper function that provides a list of choices for choosing between stack 1 and 2. More... | |
| static QStringList | meshChoice () |
| Helper function that provides a list of choices for choosing between stack 1 and 2. More... | |
| static QStringList | dimensionChoice () |
| Helper function that provides a list of choices for choosing the dimension. More... | |
| static QStringList | dimChoice () |
| Helper function that provides a list of choices for choosing the dimension. More... | |
Public Attributes inherited from mgx::Process | |
| PrivateProcess * | p |
Static Public Attributes inherited from mgx::Process | |
| static unsigned int | processVersion |
| static std::vector< Colorf > & | LabelColors |
Protected Member Functions inherited from mgx::Process | |
| bool | stackCheck (int checks, int which) |
| Check stack properties. More... | |
| bool | storeCheck (int checks, int which) |
| Check store properties. More... | |
| bool | meshCheck (int checks, int which) |
| Check mesh properties. More... | |
| QString | stackError (int checks, int which) |
| Generate a standardised string describing how the stack should be to not generate an error. More... | |
| QString | storeError (int checks, int which) |
| Generate a standardised string describing how the store should be to not generate an error. More... | |
| QString | meshError (int checks, int which) |
| Generate a standardised string describing how the mesh should be to not generate an error. More... | |
Save the data into a MGXS or INRIA format.
MGXS is a binary file format to store 3D images with all the metadata needed for proper rendering in MorphoGraphX.
There are many versions, from 1.0 to 1.3. This version of MorphoGraphX will always generate MGXS files version 1.3.
Each MGXS file starts with the ASCII string MGXS followed by a space, the version number in ASCII and another space. For instance, for the current version, the file starts with the ASCII string "MGXS 1.3 ".
A binary header follows the version number. New versions simply added fields to the header. The header is made of:
| Field | Size (bytes) | type | Version | Description |
|---|---|---|---|---|
| isLabel | 1 | bool | 1.1 | True if the stack's values are labels and not intensities |
| sxum | 4 | float | 1.3 | Position of the stack's origin on the X axis, in micrometers |
| syum | 4 | float | 1.3 | Position of the stack's origin on the Y axis, in micrometers |
| szum | 4 | float | 1.3 | Position of the stack's origin on the Z axis, in micrometers |
| xsz | 4 | uint | 1.0 | Number of voxels along the X axis |
| ysz | 4 | uint | 1.0 | Number of voxels along the Y axis |
| zsz | 4 | uint | 1.0 | Number of voxels along the Z axis |
| xum | 4 | float | 1.0 | Resolution along the X axis, in micrometers |
| yum | 4 | float | 1.0 | Resolution along the Y axis, in micrometers |
| zum | 4 | float | 1.0 | Resolution along the Z axis, in micrometers |
| datasz | 8 | uint | 1.0 | Size in bytes of the data. It should be 2*xsz*ysz*zsz |
| cl | 1 | uint | 1.0 | Compression level |
If the compression level is 0, the header is then followed by the raw, uncompressed, data. Voxels are ordered C-style (e.g. vertices consecutives along the X axis are consecutive in the file, vertices consecutives along the Y axis are separated by xsz voxels in the file, and vertices consecutive in the Z axis are separated by xsz*ysz voxels in the files).
If the compression level is greater than 0, the stack is cut into slice. Each slice is compressed using the gzip algorithm (using the qCompress Qt function). In the file, the size of the compressed slice is written as a 4 bytes unsigned integer, followed by the compressed data. A pseudo code to read the compressed data is:
current_size = 0
while current_size < datasz
slice_size = read 4 bytes
compressed_data = read slice_size bytes
data = uncompress compressed_data
store data
current_size += size of data
Note before version 1.3, if the stack was labeled, the label numbers were store as big endian. Starting 1.3, they are stores as little endian. Stack intensities are always stored as little endian.
Definition at line 89 of file SystemProcessSave.hpp.
|
inline |
Definition at line 91 of file SystemProcessSave.hpp.
|
inline |
Definition at line 114 of file SystemProcessSave.hpp.
|
virtual |
Initialize the process.
Called from the main (GUI) thread before the process is run. If there is an active GUI, then parent will be set.
The process can use the method to update the argument list with a dialog. If the arguments are updates, the process should return true
| parent | Pointer to the parent widget if there is an active GUI. |
Reimplemented from mgx::Process.
|
virtual |
Runs the process.
Reimplemented from mgx::Process.
1.8.17