Computer Assited Medical Intervention Tool Kit  version 4.1
Public Slots | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | List of all members
ActionStateMachine Class Reference

This Class describes ActionStateMachine MainWindow extension. More...

#include <ActionStateMachine.h>

Inherits camitk::Application.

Public Slots

void autoNext ()
 Automatically loop to apply to next state for all states. More...
 

Public Member Functions

 ActionStateMachine (int &argc, char **argv, QString inputFileName="", QString outputDirectory="")
 construtor. More...
 
QString getSaveDirectory ()
 where to save the files More...
 
virtual ~ActionStateMachine ()=default
 destructor More...
 
- Public Member Functions inherited from camitk::Application
 Application (QString name, int &argc, char **argv, bool autoloadExtension=true, bool registerFileExtension=false)
 Initializes the window system and constructs a CamiTK application object with argc command line arguments in argv. More...
 
 ~Application () override
 destructor More...
 
bool notify (QObject *, QEvent *) override
 reimplemented from QApplication to catch all exception from external libs used in CEP (e.g. from ITK) and avoid crashes... More...
 
void setMainWindow (MainWindow *mw)
 set the main window. More...
 

Protected Member Functions

void checkSCXMLFile (QString filename)
 check that the file is a SCXML file (simple checking, no XML Schema validation yet) This method may throw an AbortException if a problem occurs. More...
 
void initMainWindow ()
 initialized main window More...
 
QString parseSCXMLTree ()
 parse the XML file (using Qt DOM API) This method may throw an AbortException if a problem occurs. More...
 
- Protected Member Functions inherited from camitk::Application
bool eventFilter (QObject *object, QEvent *event) override
 Event filter of this class instance to watch its properties instances. More...
 

Protected Attributes

Attributes
QString name
 Application's name. More...
 
QStateMachine machine
 Actual state machine. More...
 
camitk::MainWindowmainWindow
 main window More...
 
QDomDocument scxmlDoc
 XML tree containing infos. More...
 
QMap< QString, ActionState * > * statesMap
 Map of action state to build transitions. More...
 
QFinalState * finalState
 Final State. More...
 
QDir saveDirectory
 Where to save all files. More...
 
QTime * startTime
 To get track of the Action State Machine the duration. More...
 
QTextStream * logStream
 Log stream to write report on logFile. More...
 
QFile * logFile
 Log file. More...
 

Private Slots

void finished ()
 finish everything properly when the state machine entered the final state and quit More...
 

Private Member Functions

QString getDomNodeLocation (QDomNode)
 build a specific error message containing the line and column if available More...
 
Tool methods used, see parseSCXMLTree()
void createAllActionStates (QDomNodeList nodeList)
 This method may throw an AbortException if a problem occurs. More...
 
void createTransitions (QDomNodeList nodeList)
 This method may throw an AbortException if a problem occurs. More...
 
void setCamiTKAction (ActionState *actionState, QDomElement actionElement)
 This method may throw an AbortException if a problem occurs. More...
 
void setCamiTKSaveAction (SaveActionState *actionState, QDomElement actionElement)
 This method may throw an AbortException if a problem occurs. More...
 
QVector< camitk::Action::ApplyStatusstringToStatus (QString listOfStatus)
 

Additional Inherited Members

- Public Types inherited from camitk::Application
enum  TargetPositionningPolicy { SAME_TRANSFORMATION, NO_TRANSFORMATION, SUBFRAME }
 : Policy to determine how a newly instanciated component's frame should be initialized regarding of its parent's component. More...
 
- Static Public Member Functions inherited from camitk::Application
static const ComponentListgetSelectedComponents ()
 get the currently selected Components. More...
 
static void clearSelectedComponents ()
 clear all the selection, i.e call setSelected(false) for all the previously selected components and clear the list. More...
 
static ActiongetAction (QString)
 get a registered action given its name More...
 
static const ActionList getActions ()
 get all the actions registered in the application (note: the returned ActionList is garanteed to be sorted by action name and to contain no duplicates) More...
 
static ActionList getActions (Component *)
 get all the actions that can be applied on a given component (note: the returned ActionList is garanteed to be sorted by action name and to contain no duplicates) More...
 
static ActionList getActions (ComponentList)
 Get all the actions that can be applied on any components of the given list of components (note: the returned ActionList is garanteed to be sorted by action name and to contain no duplicates) More...
 
static ActionList getActions (ComponentList, QString)
 get all the actions that of a given tag (note: the returned ActionList is guaranteed to be sorted by action name and to contain no duplicates) More...
 
static int registerAllActions (ActionExtension *)
 register all actions from the given ActionExtension More...
 
static int unregisterAllActions (ActionExtension *)
 unregister all actions from the given ActionExtension More...
 
static QString getSelectedLanguage ()
 Returns for the current CamiTK application, the selected language (stored in its .ini configuration file) More...
 
static Componentopen (const QString &)
 load the filename and returns the corresponding top level Component (return NULL if an error occurs) More...
 
static ComponentopenDirectory (const QString &dirName, const QString &pluginName)
 load a directory and returns the corresponding Component (return NULL if an error occurs) More...
 
static bool close (Component *component)
 Close a Component: if it has been changed, ask the user for more information, then if everything is ok, delete it. More...
 
static bool save (Component *component)
 save a component to its file (as given by component->getFileName()). More...
 
static const ComponentListgetTopLevelComponents ()
 get the current application wide list of instantiated top-level Components. More...
 
static const ComponentListgetAllComponents ()
 get the current application wide list of all Components. More...
 
static bool isAlive (Component *)
 does this Component still exists? More...
 
static bool hasModified ()
 Return true if at least one of the opened components has been modified, false otherwise. More...
 
static PropertyObjectgetPropertyObject ()
 Get the property object of the application. More...
 
static QString getName ()
 get the application name More...
 
static QSettings & getSettings ()
 Get the Core wide settings. More...
 
static int exec ()
 Overriden from QApplication: Enters the main event loop and waits until exit() is called, then returns the value that was set to exit() (which is 0 if exit() is called via quit()). More...
 
static const QDir getLastUsedDirectory ()
 Get the last used directory (e.g. More...
 
static void setLastUsedDirectory (QDir)
 set (force) the last used directory More...
 
static void addRecentDocument (QFileInfo)
 Add a document to the list of recent documents (e.g. More...
 
static const QList< QFileInfo > getRecentDocuments ()
 Get the list of recent documents. More...
 
static const int getMaxRecentDocuments ()
 get the maximal number of recent documents stored More...
 
static MainWindowgetMainWindow ()
 get the main window More...
 
static void refresh ()
 refresh the main window (this will call the refresh method of all viewers) More...
 
static void showStatusBarMessage (QString msg, int timeout=0)
 Set a message to the status bar. More...
 
static void resetProgressBar ()
 Resets the progress bar if it exists. More...
 
static void setProgressBarValue (int)
 set the progress bar value, value should be in [0..100]. More...
 
static void vtkProgressFunction (vtkObject *caller, long unsigned int, void *, void *)
 Observer function to be called by vtkFilters and to update progress bar Example of use: More...
 
static void addHistoryItem (HistoryItem item)
 Add the history item to the application history. More...
 
static HistoryItem removeLastHistoryItem ()
 Remove the last pushed actions in the history of the current pipeline. More...
 
static void saveHistoryAsSXML ()
 Save the history as an SCXML file, stored using. More...
 

Detailed Description

This Class describes ActionStateMachine MainWindow extension.

This application use a modified version of SCXML that describes a pipeline of CamiTK actions.

Constructor & Destructor Documentation

◆ ActionStateMachine()

ActionStateMachine::ActionStateMachine ( int &  argc,
char **  argv,
QString  inputFileName = "",
QString  outputDirectory = "" 
)

construtor.

This method may throw an AbortException if a problem occurs.

References checkSCXMLFile(), initMainWindow(), machine, mainWindow, name, parseSCXMLTree(), saveDirectory, startTime, and statesMap.

◆ ~ActionStateMachine()

virtual ActionStateMachine::~ActionStateMachine ( )
virtualdefault

destructor

Member Function Documentation

◆ autoNext

void ActionStateMachine::autoNext ( )
slot

Automatically loop to apply to next state for all states.

References ActionTransition::autoNext(), ActionTransition::isNamed(), and machine.

◆ checkSCXMLFile()

void ActionStateMachine::checkSCXMLFile ( QString  filename)
protected

check that the file is a SCXML file (simple checking, no XML Schema validation yet) This method may throw an AbortException if a problem occurs.

References CAMITK_ERROR, getDomNodeLocation(), and scxmlDoc.

Referenced by ActionStateMachine().

◆ createAllActionStates()

void ActionStateMachine::createAllActionStates ( QDomNodeList  nodeList)
private

◆ createTransitions()

void ActionStateMachine::createTransitions ( QDomNodeList  nodeList)
private

◆ finished

void ActionStateMachine::finished ( )
privateslot

finish everything properly when the state machine entered the final state and quit

References logFile, and startTime.

Referenced by parseSCXMLTree().

◆ getDomNodeLocation()

QString ActionStateMachine::getDomNodeLocation ( QDomNode  inputNode)
private

build a specific error message containing the line and column if available

Referenced by checkSCXMLFile(), createTransitions(), and setCamiTKAction().

◆ getSaveDirectory()

QString ActionStateMachine::getSaveDirectory ( )

where to save the files

References saveDirectory.

◆ initMainWindow()

void ActionStateMachine::initMainWindow ( )
protected

◆ parseSCXMLTree()

QString ActionStateMachine::parseSCXMLTree ( )
protected

parse the XML file (using Qt DOM API) This method may throw an AbortException if a problem occurs.

References createAllActionStates(), createTransitions(), finished(), ActionStateViewer::getActionStateViewer(), logFile, logStream, machine, saveDirectory, scxmlDoc, ActionStateViewer::setState(), and statesMap.

Referenced by ActionStateMachine().

◆ setCamiTKAction()

void ActionStateMachine::setCamiTKAction ( ActionState actionState,
QDomElement  actionElement 
)
private

This method may throw an AbortException if a problem occurs.

References CAMITK_ERROR, getDomNodeLocation(), and ActionState::setAction().

Referenced by createAllActionStates().

◆ setCamiTKSaveAction()

void ActionStateMachine::setCamiTKSaveAction ( SaveActionState actionState,
QDomElement  actionElement 
)
private

◆ stringToStatus()

QVector< Action::ApplyStatus > ActionStateMachine::stringToStatus ( QString  listOfStatus)
private

Member Data Documentation

◆ finalState

QFinalState* ActionStateMachine::finalState
protected

Final State.

Referenced by createAllActionStates(), and createTransitions().

◆ logFile

QFile* ActionStateMachine::logFile
protected

Log file.

Referenced by finished(), and parseSCXMLTree().

◆ logStream

QTextStream* ActionStateMachine::logStream
protected

Log stream to write report on logFile.

Referenced by createAllActionStates(), and parseSCXMLTree().

◆ machine

QStateMachine ActionStateMachine::machine
protected

Actual state machine.

Referenced by ActionStateMachine(), autoNext(), createAllActionStates(), and parseSCXMLTree().

◆ mainWindow

camitk::MainWindow* ActionStateMachine::mainWindow
protected

main window

Referenced by ActionStateMachine(), and initMainWindow().

◆ name

QString ActionStateMachine::name
protected

Application's name.

Referenced by ActionStateMachine(), and initMainWindow().

◆ saveDirectory

QDir ActionStateMachine::saveDirectory
protected

Where to save all files.

Referenced by ActionStateMachine(), createAllActionStates(), getSaveDirectory(), and parseSCXMLTree().

◆ scxmlDoc

QDomDocument ActionStateMachine::scxmlDoc
protected

XML tree containing infos.

Referenced by checkSCXMLFile(), and parseSCXMLTree().

◆ startTime

QTime* ActionStateMachine::startTime
protected

To get track of the Action State Machine the duration.

Referenced by ActionStateMachine(), and finished().

◆ statesMap

QMap<QString, ActionState*>* ActionStateMachine::statesMap
protected

Map of action state to build transitions.

Referenced by ActionStateMachine(), createAllActionStates(), createTransitions(), and parseSCXMLTree().


The documentation for this class was generated from the following files: