Computer Assisted Medical Intervention Tool Kit  version 5.2
ActionStateMachine Class Reference

This Class describes ActionStateMachine MainWindow extension. More...

#include <ActionStateMachine.h>

+ Inheritance diagram for ActionStateMachine:
+ Collaboration diagram for ActionStateMachine:

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 stateMachineTimer
 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...
 

Additional Inherited Members

- Public Types inherited from camitk::Application
enum  TargetPositionningPolicy { SAME_TRANSFORMATION , NO_TRANSFORMATION , SUBFRAME }
 : Policy to determine how a newly instantiated component's frame should be initialized regarding of its parent's component. More...
 
- Static Public Member Functions inherited from camitk::Application
static Componentopen (const QString &)
 load the filename and returns the corresponding top level Component (returns nullptr if an error occurs) More...
 
static ComponentopenDirectory (const QString &dirName, const QString &pluginName)
 load a directory and returns the corresponding Component (returns nullptr if an error occurs) More...
 
static bool loadWorkspace (const QString &filepath)
 load a camitk file and its content into the application 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 bool saveWorkspace (const QString &filepath)
 save the current workspace to a .camitk file. 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 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 guaranteed 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 guaranteed 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 guaranteed 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 void setTriggeredAction (Action *action)
 set the currently triggered action This is used by Action::trigger(..) to refresh all the viewer (the viewers interested by the fact an action was triggered can then update what they need to) More...
 
static ActiongetTriggeredAction ()
 get the currently triggered action More...
 
static QString getSelectedLanguage ()
 Returns for the current CamiTK application, the selected language (stored in its .ini configuration file) 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 ViewergetViewer (QString name)
 get the pointer to a registered viewer given its name More...
 
static ViewergetNewViewer (QString name, QString className)
 instantiate a new viewer of the given name and given class name (Viewer inheriting class). More...
 
static const ViewerList getViewers ()
 get all the viewers registered in the application (note: the returned ViewerList is guaranteed to be sorted by viewer name and to not contain any duplicate) More...
 
static ViewerList getViewers (Component *)
 get the viewers that can manage/display the given component (note: the returned ViewerList is guaranteed to be sorted by viewer name and to contain no duplicates) More...
 
static bool registerViewer (Viewer *)
 register a viewer in the viewer list (therefore allowing it to be refreshed by the main window automatically More...
 
static int registerAllViewers (ViewerExtension *)
 register all viewers from the given ViewerExtension More...
 
static int unregisterAllViewers (ViewerExtension *)
 unregister all viewers from the given ViewerExtension 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 CAMITK_TRACE, checkSCXMLFile(), ActionStateWizard::getLogDirectory(), camitk::Application::getName(), ActionStateWizard::getSCXMLFilename(), ActionStateViewerExtension::init(), initMainWindow(), camitk::ViewerExtension::initResources(), machine, mainWindow, name, parseSCXMLTree(), camitk::Application::registerAllViewers(), saveDirectory, camitk::MainWindow::setWindowSubtitle(), and stateMachineTimer.

+ Here is the call graph for this function:

◆ ~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.

+ Here is the call graph for this function:

◆ 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, and scxmlDoc.

Referenced by ActionStateMachine().

+ Here is the caller graph for this function:

◆ getSaveDirectory()

QString ActionStateMachine::getSaveDirectory ( )

where to save the files

References saveDirectory.

◆ initMainWindow()

void ActionStateMachine::initMainWindow ( )
protected

initialized main window

References camitk::MainWindow::addDockViewer(), CAMITK_ERROR, mainWindow, name, camitk::MainWindow::redirectToConsole(), camitk::MainWindow::setCentralViewer(), camitk::Application::setMainWindow(), camitk::Viewer::setToolBarVisibility(), and camitk::MainWindow::showStatusBar().

Referenced by ActionStateMachine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseSCXMLTree()

QString ActionStateMachine::parseSCXMLTree ( )
protected

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

References logFile, logStream, machine, saveDirectory, scxmlDoc, and statesMap.

Referenced by ActionStateMachine().

+ Here is the caller graph for this function:

Member Data Documentation

◆ finalState

QFinalState* ActionStateMachine::finalState
protected

Final State.

◆ logFile

QFile* ActionStateMachine::logFile
protected

Log file.

Referenced by parseSCXMLTree().

◆ logStream

QTextStream* ActionStateMachine::logStream
protected

Log stream to write report on logFile.

Referenced by parseSCXMLTree().

◆ machine

QStateMachine ActionStateMachine::machine
protected

Actual state machine.

Referenced by ActionStateMachine(), autoNext(), 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(), getSaveDirectory(), and parseSCXMLTree().

◆ scxmlDoc

QDomDocument ActionStateMachine::scxmlDoc
protected

XML tree containing infos.

Referenced by checkSCXMLFile(), and parseSCXMLTree().

◆ stateMachineTimer

QTime ActionStateMachine::stateMachineTimer
protected

To get track of the Action State Machine the duration.

Referenced by ActionStateMachine().

◆ statesMap

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

Map of action state to build transitions.

Referenced by parseSCXMLTree().


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