Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
camitk::Core Class Reference

Core class specifies the basic static information for the CamiTK API. More...

#include <Core.h>

+ Collaboration diagram for camitk::Core:

Static Public Member Functions

runtime directory information
static const QStringList getComponentDirectories ()
 get all the component directories.
 
static const QStringList getActionDirectories ()
 get all the action directories.
 
static const QStringList getViewerDirectories ()
 get all the viewers directories.
 
static const QString getTestDataDir ()
 Get a valid camitk test data directory name.
 
static const QStringList getInstallDirectories (QString suffix, bool exitOnError=true)
 get all installation directories, suffixed by the given word.
 
static const QStringList getExtensionDirectories (QString extensionType)
 Used by getInstallDirectories to determine the list of extension repositories This method check both Core::libDir() and lib/ (if different) subdirectories in order to take multiarch into account.
 
static QStringList getExtensionFilter ()
 return a list with all possible file extension for shared object/dynamic library/dll (.so, .dll...)
 
static const QString getConfig ()
 get more information about installation, etc... as a formatted string
 
static const QJsonObject getConfigAsJson ()
 get more information about installation, etc... as a JSON string instead of the text/console version of getConfig
 
static const QString getPaths ()
 get all important paths as a formatted string
 
static const QJsonObject getPathsAsJson ()
 get all important paths as a JSON string instead of the text/console version of getPaths()
 
static const QString getGlobalInstallDir ()
 get the CAMITK_DIR (where camitk-config is installed)
 
static const QString getUserInstallDir ()
 get the user config directory (this is the local installation directory)
 
static const QString getCurrentWorkingDir ()
 get the current working directory (during dev, this should be the build directory, which is an installation directory)
 
static const QString getBugReport ()
 get a well formed bug report with all necessary information
 
static const QString getPythonStatus ()
 get the python status
 
runtime build information

get the type of build we are running, Debug or Release

Returns
true if running in Debug, elsewhere false for Release build.
static const bool isDebugBuild ()
 
CamiTK Version and build information set at configure time

complete version string

static const char * version ()
 
static const char * shortVersion ()
 short version string (all in lower case, without the patch number)
 
static const char * soVersion ()
 version used for so name
 
static const char * debugPostfix ()
 debug postfix used on MSVC to distinguished between release and debug version
 
static const char * libDir ()
 library folder set depending on the compiler and environment choice (it could be lib/ or lib64/ on Linux).
 

Detailed Description

Core class specifies the basic static information for the CamiTK API.

Extensions can only be in three different places:

  • CAMITK_DIR (where the libcamitkcore is)
  • user config directory
  • current wording directory

Taking into account multiarch is difficult as some compiler/OS define CMAKE_INSTALL_LIBDIR to different values ("lib", "lib64" or even "lib/x86_64-linux-gnu" or more complicated paths). This value sometimes depends on where CMAKE_INSTALL_PATH points to (see CMake GNUInstallDirs module). For instance on debian, if CMAKE_INSTALL_PATH is equals to "/usr" then CMAKE_INSTALL_LIBDIR is set to "lib/ARCH", but if CMAKE_INSTALL_PATH is anything else, it is just set to "lib". The Core::libDir() method returns something different than "" when CamiTK core is compiled (see CamiTKVersion.h.in), but the CamiTK repositories are required also when a CamiTK application is launched.

The difficulty therefore arises as CamiTK has to load all type of extensions in all type of repositories and this must include:

  • extensions build during CamiTK core compilation (which lands in CMAKE_INSTALL_LIBDIR, and might be as complex as "lib/x86_64-linux-gnu", i.e., include a subdirectory)
  • extensions build by CEP outside CamiTK Community Edition (which will most certainly/by default be "lib/")

Note that "lib/" was the only possible value of CMAKE_INSTALL_LIBDIR before multiarch was taken into account in CamiTK 5.0.

To take into account both situations, that result in a multitude of possible directories, it was decided that:

  • repositories should be looked for either in Core::libDir() or lib/
  • the case when Core::libDir() is equal to lib/ must be taken into account to avoid duplicates

Member Function Documentation

◆ debugPostfix()

static const char * camitk::Core::debugPostfix ( )
static

debug postfix used on MSVC to distinguished between release and debug version

Referenced by getExtensionFilter(), and camitk::CppHotPlugAction::update().

+ Here is the caller graph for this function:

◆ getActionDirectories()

const QStringList camitk::Core::getActionDirectories ( )
static

get all the action directories.

It gets all the valid directories where actions are installed, and insert them in this particular order:

  1. current working directory (build install tree)
  2. user config directory (user install tree)
  3. CamiTK SDK installation directory (global install tree)

References getExtensionDirectories().

Referenced by camitk::ExtensionManager::autoload(), getPathsAsJson(), and ImpMainWindow::ImpMainWindow().

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

◆ getBugReport()

const QString camitk::Core::getBugReport ( )
static

get a well formed bug report with all necessary information

References getConfig().

Referenced by main(), and GenerateBugReportProcess::run().

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

◆ getComponentDirectories()

const QStringList camitk::Core::getComponentDirectories ( )
static

get all the component directories.

It gets all the valid directories where components are installed, and insert them in this particular order:

  1. current working directory (build install tree)
  2. user config directory (user install tree)
  3. CamiTK SDK installation directory (global install tree)

References getExtensionDirectories().

Referenced by camitk::ExtensionManager::autoload(), getPathsAsJson(), camitk::Application::open(), camitk::Application::openDirectory(), and camitk::Application::save().

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

◆ getConfig()

const QString camitk::Core::getConfig ( )
static

get more information about installation, etc... as a formatted string

References camitk::ExtensionManager::getActionExtensionsList(), camitk::ExtensionManager::getComponentExtensionsList(), getCurrentWorkingDir(), camitk::ExtensionManager::getDataDirectoryComponentsList(), getGlobalInstallDir(), camitk::ExtensionManager::getInstallationString(), getPaths(), getUserInstallDir(), and camitk::ExtensionManager::getViewerExtensionsList().

Referenced by getBugReport(), and main().

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

◆ getConfigAsJson()

const QJsonObject camitk::Core::getConfigAsJson ( )
static

get more information about installation, etc... as a JSON string instead of the text/console version of getConfig

References camitk::Viewer::EMBEDDED, camitk::ExtensionManager::getActionExtensionsList(), camitk::ExtensionManager::getComponentExtensionsList(), getCurrentWorkingDir(), camitk::ExtensionManager::getDataDirectoryComponentsList(), camitk::Property::getDescription(), getGlobalInstallDir(), camitk::Property::getInitialValue(), camitk::ExtensionManager::getInstallationString(), camitk::PropertyObject::getNumberOfProperties(), getPathsAsJson(), camitk::PropertyObject::getProperty(), camitk::Property::getPropertyInformation(), camitk::PropertyObject::getPropertyName(), getUserInstallDir(), and camitk::ExtensionManager::getViewerExtensionsList().

Referenced by main().

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

◆ getCurrentWorkingDir()

const QString camitk::Core::getCurrentWorkingDir ( )
static

get the current working directory (during dev, this should be the build directory, which is an installation directory)

Referenced by getConfig(), getConfigAsJson(), camitk::ExtensionManager::getInstallationRepository(), getInstallDirectories(), getPathsAsJson(), and camitk::Application::saveHistoryAsSCXML().

+ Here is the caller graph for this function:

◆ getExtensionDirectories()

const QStringList camitk::Core::getExtensionDirectories ( QString  extensionType)
static

Used by getInstallDirectories to determine the list of extension repositories This method check both Core::libDir() and lib/ (if different) subdirectories in order to take multiarch into account.

Parameters
extensionTypethe type of extensions ("actions", "components" or "viewers")

References getInstallDirectories(), libDir(), and shortVersion().

Referenced by getActionDirectories(), getComponentDirectories(), and getViewerDirectories().

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

◆ getExtensionFilter()

QStringList camitk::Core::getExtensionFilter ( )
static

return a list with all possible file extension for shared object/dynamic library/dll (.so, .dll...)

References debugPostfix(), isDebugBuild(), and soVersion().

+ Here is the call graph for this function:

◆ getGlobalInstallDir()

const QString camitk::Core::getGlobalInstallDir ( )
static

get the CAMITK_DIR (where camitk-config is installed)

References camitk::Application::getName(), and getUserInstallDir().

Referenced by getConfig(), getConfigAsJson(), camitk::ExtensionManager::getInstallationRepository(), getInstallDirectories(), getPathsAsJson(), camitk::ExtensionManager::loadExtension(), and main().

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

◆ getInstallDirectories()

const QStringList camitk::Core::getInstallDirectories ( QString  suffix,
bool  exitOnError = true 
)
static

get all installation directories, suffixed by the given word.

All the returned Strings are unique valid directories, sorted in this particular order:

  1. current working directory (build install tree)
  2. user config directory (user install tree)
  3. CamiTK SDK installation directory (global install tree)

It uses getExtensionDirectories() to take multiarch into account

If no directory is available and exitOnError is true, the application exits. There are situation (namely for checking testdata dir) where it not mandatory to find a directory. In this case, exitOnError should be set to false so that the application does not exit.

References CAMITK_ERROR_ALT, getCurrentWorkingDir(), getGlobalInstallDir(), and getUserInstallDir().

Referenced by getExtensionDirectories(), getTestDataDir(), and SimpleElastixRegistrationAction::SimpleElastixRegistrationAction().

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

◆ getPaths()

const QString camitk::Core::getPaths ( )
static

get all important paths as a formatted string

References getPathsAsJson().

Referenced by getConfig(), and main().

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

◆ getPathsAsJson()

const QJsonObject camitk::Core::getPathsAsJson ( )
static

get all important paths as a JSON string instead of the text/console version of getPaths()

References getActionDirectories(), getComponentDirectories(), getCurrentWorkingDir(), getGlobalInstallDir(), getPythonStatus(), getTestDataDir(), getUserInstallDir(), getViewerDirectories(), isDebugBuild(), shortVersion(), soVersion(), and version().

Referenced by getConfigAsJson(), and getPaths().

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

◆ getPythonStatus()

const QString camitk::Core::getPythonStatus ( )
static

get the python status

Referenced by AboutAction::apply(), and getPathsAsJson().

+ Here is the caller graph for this function:

◆ getTestDataDir()

const QString camitk::Core::getTestDataDir ( )
static

Get a valid camitk test data directory name.

It returns the first valid test data directory that is found. Checking is done in this particular order:

  1. current working directory (build install tree)
  2. user config directory (user install tree)
  3. CamiTK SDK installation directory (global install tree)

If none of this three directories is valid, return user's home directory.

A test data directory is valid if it exists and contains a least one file.

Returns
a null QString, checkable with isNull(), if no test data directory found

References getInstallDirectories(), and shortVersion().

Referenced by camitk::Application::Application(), SetPathToTestData::apply(), getPathsAsJson(), brownian_movement::init(), compute_barycenter::init(), test_image_component::init(), and transformations_and_frames::init().

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

◆ getUserInstallDir()

const QString camitk::Core::getUserInstallDir ( )
static

get the user config directory (this is the local installation directory)

References camitk::Application::getSettings().

Referenced by getConfig(), getConfigAsJson(), getGlobalInstallDir(), camitk::ExtensionManager::getInstallationRepository(), getInstallDirectories(), and getPathsAsJson().

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

◆ getViewerDirectories()

const QStringList camitk::Core::getViewerDirectories ( )
static

get all the viewers directories.

It gets all the valid directories where viewers are installed, and insert them in this particular order:

  1. current working directory (build install tree)
  2. user config directory (user install tree)
  3. CamiTK SDK installation directory (global install tree)

References getExtensionDirectories().

Referenced by camitk::ExtensionManager::autoload(), and getPathsAsJson().

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

◆ isDebugBuild()

const bool camitk::Core::isDebugBuild ( )
static

Referenced by AboutAction::apply(), getExtensionFilter(), getPathsAsJson(), and camitk::CppHotPlugAction::update().

+ Here is the caller graph for this function:

◆ libDir()

static const char * camitk::Core::libDir ( )
static

library folder set depending on the compiler and environment choice (it could be lib/ or lib64/ on Linux).

libDir value is set directly to the value of CMAKE_INSTALL_LIBDIR.

Although it can not be called a version variable per se, it is required for the extension manager to find the available extensions.

Referenced by getExtensionDirectories(), camitk::ExtensionManager::getInstallationString(), and camitk::ExtensionManager::loadExtension().

+ Here is the caller graph for this function:

◆ shortVersion()

static const char * camitk::Core::shortVersion ( )
static

short version string (all in lower case, without the patch number)

Referenced by getExtensionDirectories(), getPathsAsJson(), getTestDataDir(), camitk::ExtensionManager::loadExtension(), main(), and camitk::CppHotPlugAction::update().

+ Here is the caller graph for this function:

◆ soVersion()

static const char * camitk::Core::soVersion ( )
static

version used for so name

Referenced by getExtensionFilter(), and getPathsAsJson().

+ Here is the caller graph for this function:

◆ version()

static const char * camitk::Core::version ( )
static

Referenced by AboutAction::apply(), getPathsAsJson(), main(), camitk::MainWindow::redirectToConsole(), camitk::SplashScreen::SplashScreen(), usage(), and usage().

+ Here is the caller graph for this function:

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