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

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

#include <ComponentExtension.h>

+ Inheritance diagram for camitk::ComponentExtension:
+ Collaboration diagram for camitk::ComponentExtension:

Public Member Functions

 ~ComponentExtension () override=default
 protected destructor, More...
 
ComponentExtension plugin interface methods

get the plugin name

virtual QString getName () const =0
 
virtual QString getDescription () const =0
 get the plugin description More...
 
virtual QStringList getFileExtensions () const =0
 get the list of managed extensions (each file with an extension in the list can be loaded by this Component) More...
 
virtual Componentopen (const QString &)=0
 get a new instance from data stored in a file (this is the most important method to redefine in your subclass) More...
 
virtual bool save (Component *component) const
 save a given Component (does not have to be top-level) into one of the currently managed format (check the component QFileInfo(component->getFileName()).completeSuffix(). More...
 
virtual bool hasDataDirectory () const
 return true if this component manages directory instead of individual files (e.g. Dicom series are stored in directories, not files) More...
 
QString getLocation () const
 get the file path (location of the .dll/.so/.dylib) of this plugin More...
 
void setLocation (const QString loc)
 set the file path (once loaded as a dynamic library) More...
 
void initResources ()
 Load, for the selected langage (asked to the Application), the associated .qm file. More...
 

Protected Member Functions

 ComponentExtension ()
 protected constructor, More...
 

Detailed Description

This class describes what is a generic Component extension.

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

There are two types of component extension: the classical one manages (mime type) file extension, the other one manages all files in a given directory (e.g. Dicom images). For the latter you have to redefine hasDataDirectory().

The following methods HAVE to be redefined in your subclass:

  • getName
  • getDescription
  • getFileExtensions
  • open

The following methods can be redefined:

  • save: saving from a Component to one of the managed format
  • hasDataDirectory: for directory type extension

Constructor & Destructor Documentation

◆ ComponentExtension()

camitk::ComponentExtension::ComponentExtension ( )
protected

protected constructor,

Note
never directly instantiate a ComponentExtension, use loadExtension(...) instead!

◆ ~ComponentExtension()

camitk::ComponentExtension::~ComponentExtension ( )
overridedefault

protected destructor,

Note
never directly delete a ComponentExtension, use UnloadExtension(...) instead!

Member Function Documentation

◆ getDescription()

virtual QString camitk::ComponentExtension::getDescription ( ) const
pure virtual

get the plugin description

Implemented in camitk::MeshComponentExtension, camitk::ImageComponentExtension, WorkspaceExtension, VtkMeshComponentExtension, VtkImageComponentExtension, VRMLComponentExtension, StlExtension, OffExtension, ObjExtension, MshExtension, PMLComponentExtension, MMLComponentExtension, ItkImageComponentExtension, and DicomComponentExtension.

Referenced by main().

+ Here is the caller graph for this function:

◆ getFileExtensions()

virtual QStringList camitk::ComponentExtension::getFileExtensions ( ) const
pure virtual

get the list of managed extensions (each file with an extension in the list can be loaded by this Component)

Implemented in WorkspaceExtension, VtkMeshComponentExtension, VtkImageComponentExtension, VRMLComponentExtension, StlExtension, OffExtension, ObjExtension, MshExtension, PMLComponentExtension, MMLComponentExtension, ItkImageComponentExtension, and DicomComponentExtension.

Referenced by OpenAction::apply(), SaveAsAction::apply(), camitk::Core::getConfig(), camitk::ExtensionManager::loadExtension(), main(), and OpenFile::selectFile().

+ Here is the caller graph for this function:

◆ getLocation()

QString camitk::ComponentExtension::getLocation ( ) const
inline

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

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

+ Here is the caller graph for this function:

◆ getName()

◆ hasDataDirectory()

virtual bool camitk::ComponentExtension::hasDataDirectory ( ) const
inlinevirtual

return true if this component manages directory instead of individual files (e.g. Dicom series are stored in directories, not files)

Reimplemented in DicomComponentExtension.

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

+ Here is the caller graph for this function:

◆ initResources()

void camitk::ComponentExtension::initResources ( )

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

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

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

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

◆ open()

virtual Component* camitk::ComponentExtension::open ( const QString &  )
pure virtual

get a new instance from data stored in a file (this is the most important method to redefine in your subclass)

This method may throw an AbortException if a problem occurs.

Note
The parameter is a filename with an absolute path (from Qt's QFileInfo::absoluteFilePath method): On Unix (including Mac OS) this will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'

Implemented in camitk::MeshComponentExtension, camitk::ImageComponentExtension, WorkspaceExtension, VtkMeshComponentExtension, VtkImageComponentExtension, VRMLComponentExtension, StlExtension, OffExtension, ObjExtension, MshExtension, PMLComponentExtension, MMLComponentExtension, ItkImageComponentExtension, and DicomComponentExtension.

Referenced by camitk::Application::open(), and camitk::Application::openDirectory().

+ Here is the caller graph for this function:

◆ save()

bool camitk::ComponentExtension::save ( Component component) const
virtual

save a given Component (does not have to be top-level) into one of the currently managed format (check the component QFileInfo(component->getFileName()).completeSuffix().

Redefine this method to extract all needed data/information from the Geometry or BitMap representation in order to export a given component to one of the file extension managed by this component extension.

Note
this will enable to export to one of the managed filename extension at the CamiTK level (i.e. if you write this method, any compatible component can be saved to your managed format!
this method is called by CamiTK only if the filename extension is managed by this component extension. There should be no need to check it in the method.

The default behaviour is a "not implemented yet" message box.

Returns
false if the operation was not performed properly or not performed at all.

Reimplemented in WorkspaceExtension, StlExtension, OffExtension, ObjExtension, MshExtension, PMLComponentExtension, MMLComponentExtension, VtkMeshComponentExtension, VtkImageComponentExtension, VRMLComponentExtension, ItkImageComponentExtension, and DicomComponentExtension.

References CAMITK_WARNING, camitk::Component::getFileName(), getName(), and camitk::Component::getName().

Referenced by MMLComponentExtension::save(), and camitk::Application::save().

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

◆ setLocation()

void camitk::ComponentExtension::setLocation ( const QString  loc)
inline

set the file path (once loaded as a dynamic library)

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

+ Here is the caller graph for this function:

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