Commit 8dd358e9 authored by jean-loup's avatar jean-loup
Browse files

Adding generic actions for the "Image Acquisition Component"

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@2163 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 46c62b8e
......@@ -221,14 +221,6 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ReportBugDialog</name>
<message>
<location filename="../../../../src/sdk/actions/application/ReportBugDialog.cpp" line="40"/>
<source>&lt;a href=&apos;https://bugzilla-timc.imag.fr/&apos;&gt;Bugzilla Bug Report Tool&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SaveAction</name>
<message>
......@@ -486,4 +478,12 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ReportBugDialog</name>
<message>
<location filename="../../../../src/sdk/actions/application/ReportBugDialog.cpp" line="40"/>
<source>&lt;a href=&apos;https://bugzilla-timc.imag.fr/&apos;&gt;Bugzilla Bug Report Tool&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
......@@ -229,14 +229,6 @@
<translation>Détruire Component</translation>
</message>
</context>
<context>
<name>ReportBugDialog</name>
<message>
<location filename="../../../../src/sdk/actions/application/ReportBugDialog.cpp" line="40"/>
<source>&lt;a href=&apos;https://bugzilla-timc.imag.fr/&apos;&gt;Bugzilla Bug Report Tool&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SaveAction</name>
<message>
......@@ -494,4 +486,12 @@
<translation>Ctrl+3</translation>
</message>
</context>
<context>
<name>ReportBugDialog</name>
<message>
<location filename="../../../../src/sdk/actions/application/ReportBugDialog.cpp" line="40"/>
<source>&lt;a href=&apos;https://bugzilla-timc.imag.fr/&apos;&gt;Bugzilla Bug Report Tool&lt;/a&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
# Call CamiTK CMake Macro to define the action
camitk_extension( ACTION_EXTENSION
DEFAULT
INSTALL_ALL_HEADERS
DESCRIPTION "Generic Actions container"
)
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include "ImageAcquisitionComponentActionExtension.h"
// include generated actions headers
#include "InitImagerAction.h"
#include "StartImaging2DAction.h"
#include "StopImaging2DAction.h"
#include "StartImaging3DAction.h"
#include "StopImaging3DAction.h"
#include "SingleAcquisition2DAction.h"
#include "SingleAcquisition3DAction.h"
// --------------- declare the extension -------------------
Q_EXPORT_PLUGIN2(imageacquisitioncomponentactionextension, ImageAcquisitionComponentActionExtension);
// --------------- getActions -------------------
void ImageAcquisitionComponentActionExtension::init() {
// Creating and registering the instance of InitImager
// Creating and registering the instance of StartImaging2D
// Creating and registering the instance of StopImaging2D
// Creating and registering the instance of StartImaging3D
// Creating and registering the instance of StopImaging3D
// Creating and registering the instance of SingleAcquisition2D
// Creating and registering the instance of SingleAcquisition3D
registerNewAction(InitImagerAction);
registerNewAction(StartImaging2DAction);
registerNewAction(StopImaging2DAction);
registerNewAction(StartImaging3DAction);
registerNewAction(StopImaging3DAction);
registerNewAction(SingleAcquisition2DAction);
registerNewAction(SingleAcquisition3DAction);
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef IMAGEACQUISITIONCOMPONENTACTIONEXTENSION_H
#define IMAGEACQUISITIONCOMPONENTACTIONEXTENSION_H
#include <ActionExtension.h>
class ImageAcquisitionComponentActionExtension : public camitk::ActionExtension {
Q_OBJECT
Q_INTERFACES(camitk::ActionExtension);
public:
/// Constructor
ImageAcquisitionComponentActionExtension() : ActionExtension() {};
/// Destructor
virtual ~ImageAcquisitionComponentActionExtension() {};
/// Method returning the action extension name
virtual QString getName() {
return "ImageAcquisitionComponentActionExtension";
};
/// Method returning the action extension descrption
virtual QString getDescription() {
return "Generic Actions container";
};
/// initialize all the actions
virtual void init();
};
#endif // IMAGEACQUISITIONCOMPONENTACTIONEXTENSION_H
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// CamiTK includes
#include "InitImagerAction.h"
#include <Property.h>
#include <Application.h>
// Qt includes
#include <QString>
#include <QMessageBox>
#include <QTextStream>
using namespace camitk;
// --------------- Constructor -------------------
InitImagerAction::InitImagerAction(ActionExtension * extension) : Action(extension) {
// Setting name, description and input component
setName("InitImagerAction");
setDescription("initialize the acquisition device");
setComponent("ImageAcquisitionComponent");
// Setting classification family and tags
setFamily("Image Acquisition");
// Tags allow the user to search the actions trhough themes
// You can add tags here with the method addTag("tagName");
// Setting the action's parameters
// If you want to add parameters to your action, you can add them
// using properties
// addParameter(new Property(tr("Property name"), "Property value", tr("Property description"), "Property unit"));
}
// --------------- destructor -------------------
InitImagerAction::~InitImagerAction() {
// Do not do anything yet.
// Delete stuff if you create stuff
// (except if you use smart pointers of course !!)
}
// --------------- apply -------------------
Action::ApplyStatus InitImagerAction::apply() {
foreach (Component *comp, getTargets()) {
ImageAcquisitionComponent * input = dynamic_cast<ImageAcquisitionComponent *> (comp);
process(input);
}
return SUCCESS;
}
void InitImagerAction::process(ImageAcquisitionComponent * comp) {
comp->initImager();
Application::refresh();
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef INITIMAGER_H
#define INITIMAGER_H
#include <Action.h>
#include <ImageAcquisitionComponent.h>
class InitImagerAction : public camitk::Action {
public:
/// Default Constructor
InitImagerAction(camitk::ActionExtension *);
/// Default Destructor
virtual ~InitImagerAction();
public slots:
/** this method is automatically called when the action is triggered.
* Call getTargets() method to get the list of components to use.
* \note getTargets() is automatically filtered so that it only contains compatible components,
* i.e., instances of InitImager (or a subclass).
*/
virtual ApplyStatus apply();
private:
/// helper method to simplify the target component processing
virtual void process(camitk::ImageAcquisitionComponent *);
};
#endif // INITIMAGER_H
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// CamiTK includes
#include "SingleAcquisition2DAction.h"
#include <Property.h>
#include <Application.h>
// Qt includes
#include <QString>
#include <QMessageBox>
#include <QTextStream>
using namespace camitk;
// --------------- Constructor -------------------
SingleAcquisition2DAction::SingleAcquisition2DAction(ActionExtension * extension) : Action(extension) {
// Setting name, description and input component
setName("singleAcquisition2D");
setDescription("acquire one 2D ImageComponent by the device");
setComponent("ImageAcquisitionComponent");
// Setting classification family and tags
setFamily("Image Acquisition");
// Tags allow the user to search the actions trhough themes
// You can add tags here with the method addTag("tagName");
// Setting the action's parameters
// If you want to add parameters to your action, you can add them
// using properties
// addParameter(new Property(tr("Property name"), "Property value", tr("Property description"), "Property unit"));
}
// --------------- destructor -------------------
SingleAcquisition2DAction::~SingleAcquisition2DAction() {
// Do not do anything yet.
// Delete stuff if you create stuff
// (except if you use smart pointers of course !!)
}
// --------------- apply -------------------
Action::ApplyStatus SingleAcquisition2DAction::apply() {
foreach (Component *comp, getTargets()) {
ImageAcquisitionComponent * input = dynamic_cast<ImageAcquisitionComponent *> (comp);
process(input);
}
return SUCCESS;
}
void SingleAcquisition2DAction::process(ImageAcquisitionComponent * comp) {
comp->singleAcquisition2D();
Application::refresh();
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef SINGLEACQUISITION2D_H
#define SINGLEACQUISITION2D_H
#include <Action.h>
#include <ImageAcquisitionComponent.h>
class SingleAcquisition2DAction : public camitk::Action {
public:
/// Default Constructor
SingleAcquisition2DAction(camitk::ActionExtension *);
/// Default Destructor
virtual ~SingleAcquisition2DAction();
public slots:
/** this method is automatically called when the action is triggered.
* Call getTargets() method to get the list of components to use.
* \note getTargets() is automatically filtered so that it only contains compatible components,
* i.e., instances of SingleAcquisition2D (or a subclass).
*/
virtual ApplyStatus apply();
private:
/// helper method to simplify the target component processing
virtual void process(camitk::ImageAcquisitionComponent *);
};
#endif // SINGLEACQUISITION2D_H
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// CamiTK includes
#include "SingleAcquisition3DAction.h"
#include <Property.h>
#include <Application.h>
// Qt includes
#include <QString>
#include <QMessageBox>
#include <QTextStream>
using namespace camitk;
// --------------- Constructor -------------------
SingleAcquisition3DAction::SingleAcquisition3DAction(ActionExtension * extension) : Action(extension) {
// Setting name, description and input component
setName("singleAcquisition3D");
setDescription("acquire one 3D ImageComponent by the device");
setComponent("ImageAcquisitionComponent");
// Setting classification family and tags
setFamily("Image Acquisition");
// Tags allow the user to search the actions trhough themes
// You can add tags here with the method addTag("tagName");
// Setting the action's parameters
// If you want to add parameters to your action, you can add them
// using properties
// addParameter(new Property(tr("Property name"), "Property value", tr("Property description"), "Property unit"));
}
// --------------- destructor -------------------
SingleAcquisition3DAction::~SingleAcquisition3DAction() {
// Do not do anything yet.
// Delete stuff if you create stuff
// (except if you use smart pointers of course !!)
}
// --------------- apply -------------------
Action::ApplyStatus SingleAcquisition3DAction::apply() {
foreach (Component *comp, getTargets()) {
ImageAcquisitionComponent * input = dynamic_cast<ImageAcquisitionComponent *> (comp);
process(input);
}
return SUCCESS;
}
void SingleAcquisition3DAction::process(ImageAcquisitionComponent * comp) {
comp->singleAcquisition3D();
Application::refresh();
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of