Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
ActionStateMachine.h
Go to the documentation of this file.
1/*****************************************************************************
2 * $CAMITK_LICENCE_BEGIN$
3 *
4 * CamiTK - Computer Assisted Medical Intervention ToolKit
5 * (c) 2001-2025 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6 *
7 * Visit http://camitk.imag.fr for more information
8 *
9 * This file is part of CamiTK.
10 *
11 * CamiTK is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * CamiTK is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22 *
23 * $CAMITK_LICENCE_END$
24 ****************************************************************************/
25
26
27#ifndef ACTIONSTATEMACHINE_H
28#define ACTIONSTATEMACHINE_H
29
30
31// -- Qt stuff
32#include <QTextStream>
33#include <QStateMachine>
34#include <QState>
35#include <QFinalState>
36#include <QDir>
37
38// -- Qt XML stuff
39#include <QtXml/QDomDocument>
40#include <QtXml/QDomNodeList>
41
42// -- CamiTK Core stuff
43#include <Application.h>
44
45// -- CamiTK Local stuff
46#include "ActionState.h"
47#include "SaveActionState.h"
48
58 Q_OBJECT
59
60public:
64 ActionStateMachine(int& argc, char** argv, QString inputFileName = "", QString outputDirectory = "");
65
67 virtual ~ActionStateMachine() = default;
68
70 QString getSaveDirectory();
71
72public slots:
74 void autoNext();
75
76private slots:
78 void finished();
79
80protected:
82 void initMainWindow();
83
87 void checkSCXMLFile(QString filename);
88
92 QString parseSCXMLTree();
93
96
98 QString name;
99
101 QStateMachine machine;
102
105
107 QDomDocument scxmlDoc;
108
110 QMap<QString, ActionState*> statesMap;
111
113 QFinalState* finalState;
114
117
120
122 QTextStream* logStream;
123
125 QFile* logFile;
126
128
129private:
132
134 void createAllActionStates(QDomNodeList nodeList);
135
137 void createTransitions(QDomNodeList nodeList);
138
140 void setCamiTKAction(ActionState* actionState, QDomElement actionElement);
141
143 void setCamiTKSaveAction(SaveActionState* actionState, QDomElement actionElement);
144
145 QVector<camitk::Action::ApplyStatus> stringToStatus(QString listOfStatus);
147
149 QString getDomNodeLocation(QDomNode);
150};
151
152#endif // ACTIONSTATEMACHINE_H
This Class describes ActionStateMachine MainWindow extension.
Definition ActionStateMachine.h:57
virtual ~ActionStateMachine()=default
destructor
QString parseSCXMLTree()
parse the XML file (using Qt DOM API) This method may throw an AbortException if a problem occurs.
Definition ActionStateMachine.cpp:625
QDir saveDirectory
Where to save all files.
Definition ActionStateMachine.h:116
QMap< QString, ActionState * > statesMap
Map of action state to build transitions.
Definition ActionStateMachine.h:110
QStateMachine machine
Actual state machine.
Definition ActionStateMachine.h:101
QTextStream * logStream
Log stream to write report on logFile.
Definition ActionStateMachine.h:122
void checkSCXMLFile(QString filename)
check that the file is a SCXML file (simple checking, no XML Schema validation yet) This method may t...
Definition ActionStateMachine.cpp:591
QTime stateMachineTimer
To get track of the Action State Machine the duration.
Definition ActionStateMachine.h:119
void autoNext()
Automatically loop to apply to next state for all states.
Definition ActionStateMachine.cpp:504
QFile * logFile
Log file.
Definition ActionStateMachine.h:125
QFinalState * finalState
Final State.
Definition ActionStateMachine.h:113
QDomDocument scxmlDoc
XML tree containing infos.
Definition ActionStateMachine.h:107
void initMainWindow()
initialized main window
Definition ActionStateMachine.cpp:556
camitk::MainWindow * mainWindow
main window
Definition ActionStateMachine.h:104
QString name
Application's name.
Definition ActionStateMachine.h:98
QString getSaveDirectory()
where to save the files
Definition ActionStateMachine.cpp:983
The state (in a state machine point of view) corresponding to the current processed action.
Definition ActionState.h:48
The asm application uses a state machine.
Definition SaveActionState.h:37
The generic/default application.
Definition Application.h:83
This class is the base class for your application.
Definition MainWindow.h:68