Computer Assited Medical Intervention Tool Kit  version 5.0
camitk::ViewerExtension Class Referenceabstract

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

Private Attributes

QString dynamicLibraryFileName
 the shared lib (.so, .dll or .dylib) used to instantiate the ComponentExtension subclass instance More...
 
const QMetaObject * managedMetaObject
 static meta object of the viewer class managed by this extension More...
 
QTranslator * translator
 Provide internationalization support for text output. 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);

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

References getLocation().

+ Here is the call graph for this function:

◆ ~ViewerExtension()

camitk::ViewerExtension::~ViewerExtension ( )
override

destructor

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 ViewerExtension().

+ 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 InteractiveSliceViewerExtension, ActionViewerExtension, ExplorerExtension, FrameExplorerExtension, InteractiveGeometryViewerExtension, MedicalImageViewerExtension, PropertyExplorerExtension, BitmapViewerExtension, and ActionStateViewerExtension.

Referenced by camitk::Application::registerViewer(), and setManagedMetaObject().

+ 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

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

+ 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 setManagedMetaObject().

+ Here is the caller graph for this function:

◆ getViewers()

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

get the list of viewer instances registered by this extension

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

+ Here is the caller graph for this function:

◆ init()

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

◆ initResources()

void camitk::ViewerExtension::initResources ( )

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

Referenced by ActionStateMachine::ActionStateMachine().

+ 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

◆ setLocation()

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

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

◆ setManagedMetaObject()

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

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

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

+ Here is the call graph for this function:

Member Data Documentation

◆ dynamicLibraryFileName

QString camitk::ViewerExtension::dynamicLibraryFileName
private

the shared lib (.so, .dll or .dylib) used to instantiate the ComponentExtension subclass instance

◆ managedMetaObject

const QMetaObject* camitk::ViewerExtension::managedMetaObject
private

static meta object of the viewer class managed by this extension

◆ translator

QTranslator* camitk::ViewerExtension::translator
private

Provide internationalization support for text output.

◆ viewers

ViewerList camitk::ViewerExtension::viewers
protected

the list of viewers


The documentation for this class was generated from the following files:
registerDefaultViewer
#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:66