Computer Assisted Medical Intervention Tool Kit  version 5.2
camitk::ViewerExtension Class Referenceabstract

This class describes what is a generic Action extension. More...

#include <ViewerExtension.h>

+ Inheritance diagram for camitk::ViewerExtension:
+ Collaboration diagram for camitk::ViewerExtension:

Public Member Functions

virtual QString getDescription ()=0
 returns the viewer extension small description (to be overriden in the derived class) More...
 
QString getLocation () const
 get the file path (location of the .dll/.so/.dylib) of this plugin More...
 
virtual QString getName ()=0
 returns the viewer extension name (to be overriden in the derived class) More...
 
ViewergetNewInstance (QString name)
 factory: create a new viewer instance and register it More...
 
QString getViewerClassName ()
 get the class name of the viewer managed by this extension More...
 
const ViewerListgetViewers ()
 get the list of viewer instances registered by this extension More...
 
virtual void init ()=0
 this method should just call registerNewViewer(MyViewer) for any MyViewer class you need to register by this extension More...
 
void initResources ()
 Load, for the selected langage (asked to the Application), the associated .qm file. More...
 
void setLocation (const QString loc)
 set the file path (once loaded as a dynamic library) = where this extension was loaded More...
 
 ~ViewerExtension () override
 destructor More...
 

Protected Member Functions

bool registerViewer (Viewer *)
 register an viewer instance The first call will also register the managed viewer class name in viewerClassName and its static meta object in More...
 
void setManagedMetaObject (const QMetaObject *)
 The first time this method is called, it sets the static meta object. More...
 
 ViewerExtension ()
 constructor More...
 

Protected Attributes

ViewerList viewers
 the list of viewers More...
 

Detailed Description

This class describes what is a generic Action extension.

To add a ActionExtension to CamiTK core, write a new class that inherits from this class.

The following methods HAVE to be redefined in your subclass:

  • getName: return the name of your extension
  • getDescription: return a small description
  • init: a simple enough method, just call registerNewAction(MyAction) for any MyAction class inheriting from camitk::Action

ViewerExtension implements a specific Factory pattern (see getNewInstance())

Each time a viewer is registered, call setManagedMetaObject (the fist registered viewer will register the managed class meta object that can be reused later on to instantiate new viewer).

Use registerDefaultViewer() or registerNewViewer() in your inherited viewer extension to register and instantiate new viewers.

Using registerDefaultViewer() registers the class and instantiate a default viewer of the same name.

Note
the default viewer's name is the same as the class name with all words separated by spaces.

This is important as this name will be shown in the GUI. Therefore:

registerDefaultViewer(FooBarViewer);
#define registerDefaultViewer(className)
register a new viewer and create a default instance using the name of the class (note that the regula...
Definition: ViewerExtension.h:43

will instantiate the default FooBarViewer viewer called "Foo Bar Viewer".

To get the default FooBarViewer instance, use Application::getViewer("Foo Bar Viewer").

See also
InteractiveSliceViewerExtension For an example of a viewer extension registering more than one viewer instance.

Constructor & Destructor Documentation

◆ ViewerExtension()

camitk::ViewerExtension::ViewerExtension ( )
protected

constructor

◆ ~ViewerExtension()

camitk::ViewerExtension::~ViewerExtension ( )
override

destructor

References viewers.

Member Function Documentation

◆ getDescription()

virtual QString camitk::ViewerExtension::getDescription ( )
pure virtual

◆ getLocation()

QString camitk::ViewerExtension::getLocation ( ) const

get the file path (location of the .dll/.so/.dylib) of this plugin

Referenced by camitk::Core::getConfig(), and initResources().

+ Here is the caller graph for this function:

◆ getName()

virtual QString camitk::ViewerExtension::getName ( )
pure virtual

returns the viewer extension name (to be overriden in the derived class)

Implemented in PropertyExplorerExtension, MedicalImageViewerExtension, InteractiveSliceViewerExtension, InteractiveGeometryViewerExtension, FrameExplorerExtension, ExplorerExtension, BitmapViewerExtension, ActionViewerExtension, and ActionStateViewerExtension.

Referenced by camitk::Core::getConfig(), camitk::ExtensionManager::loadExtension(), camitk::Application::registerViewer(), and registerViewer().

+ Here is the caller graph for this function:

◆ getNewInstance()

Viewer * camitk::ViewerExtension::getNewInstance ( QString  name)

factory: create a new viewer instance and register it

Returns
a new instance of the given name, or the previously registered instance if it already exist

References CAMITK_ERROR, CAMITK_INFO, getViewerClassName(), registerViewer(), and viewers.

Referenced by camitk::Application::getNewViewer().

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

◆ getViewerClassName()

QString camitk::ViewerExtension::getViewerClassName ( )

get the class name of the viewer managed by this extension

Referenced by getNewInstance(), camitk::ExtensionManager::loadExtension(), and registerViewer().

+ Here is the caller graph for this function:

◆ getViewers()

const ViewerList & camitk::ViewerExtension::getViewers ( )

get the list of viewer instances registered by this extension

References viewers.

Referenced by camitk::Core::getConfig(), camitk::Application::registerAllViewers(), and camitk::Application::unregisterAllViewers().

+ Here is the caller graph for this function:

◆ init()

virtual void camitk::ViewerExtension::init ( )
pure virtual

this method should just call registerNewViewer(MyViewer) for any MyViewer class you need to register by this extension

Implemented in PropertyExplorerExtension, MedicalImageViewerExtension, InteractiveSliceViewerExtension, InteractiveGeometryViewerExtension, FrameExplorerExtension, ExplorerExtension, BitmapViewerExtension, ActionViewerExtension, and ActionStateViewerExtension.

Referenced by camitk::ExtensionManager::loadExtension().

+ Here is the caller graph for this function:

◆ initResources()

void camitk::ViewerExtension::initResources ( )

Load, for the selected langage (asked to the Application), the associated .qm file.

References CAMITK_INFO, getLocation(), and camitk::Application::getSelectedLanguage().

Referenced by ActionStateMachine::ActionStateMachine(), and camitk::ExtensionManager::loadExtension().

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

◆ registerViewer()

bool camitk::ViewerExtension::registerViewer ( Viewer viewer)
protected

register an viewer instance The first call will also register the managed viewer class name in viewerClassName and its static meta object in

References CAMITK_ERROR, camitk::Viewer::getName(), getName(), getViewerClassName(), and viewers.

Referenced by getNewInstance().

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

◆ setLocation()

void camitk::ViewerExtension::setLocation ( const QString  loc)

set the file path (once loaded as a dynamic library) = where this extension was loaded

Referenced by camitk::ExtensionManager::loadExtension().

+ Here is the caller graph for this function:

◆ setManagedMetaObject()

void camitk::ViewerExtension::setManagedMetaObject ( const QMetaObject *  metaObject)
protected

The first time this method is called, it sets the static meta object.

Member Data Documentation

◆ viewers

ViewerList camitk::ViewerExtension::viewers
protected

the list of viewers

Referenced by getNewInstance(), getViewers(), registerViewer(), and ~ViewerExtension().


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