PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
vtkPlusConfig Class Reference

Singleton class providing tools needed for handling the configuration - finding files, assembling file names, holding and saving the configuration data. More...

#include <src/PlusCommon/vtkPlusConfig.h>

Inheritance diagram for vtkPlusConfig:
Inheritance graph
[legend]
Collaboration diagram for vtkPlusConfig:
Collaboration graph
[legend]

Public Types

typedef vtkObject Superclass
 

Public Member Functions

vtkXMLDataElement * CreateDeviceSetConfigurationFromFile (const std::string &aConfigFile)
 
PlusStatus FindImagePath (const std::string &aImagePath, std::string &aFoundAbsolutePath)
 
PlusStatus FindModelPath (const std::string &aModelPath, std::string &aFoundAbsolutePath)
 
std::string GetAbsolutePath (const std::string &aPath, const std::string &aBasePath)
 
std::string GetApplicationConfigurationFilePath () const
 
virtual const char * GetClassName ()
 
virtual vtkXMLDataElement * GetDeviceSetConfigurationData ()
 
std::string GetDeviceSetConfigurationDirectory ()
 
std::string GetDeviceSetConfigurationFileName ()
 
std::string GetDeviceSetConfigurationPath (const std::string &subPath)
 
std::string GetFirstFileFoundInConfigurationDirectory (const char *aFileName)
 
std::string GetFirstFileFoundInDirectory (const char *aFileName, const char *aDirectory)
 
std::string GetImageDirectory ()
 
std::string GetImagePath (const std::string &subPath)
 
std::string GetModelPath (const std::string &subPath)
 
std::string GetNewDeviceSetConfigurationFileName ()
 
std::string GetOutputDirectory ()
 
std::string GetOutputPath (const std::string &subPath)
 
std::string GetPlusExecutablePath (const std::string &executableName)
 
std::string GetScriptPath (const std::string &subPath)
 
virtual int IsA (const char *type)
 
vtkXMLDataElement * LookupElementWithNameContainingChildWithNameAndAttribute (vtkXMLDataElement *aConfig, const char *aElementName, const char *aChildName, const char *aChildAttributeName, const char *aChildAttributeValue)
 
PlusStatus ReadTransformToCoordinateDefinition (const char *aFromCoordinateFrame, const char *aToCoordinateFrame, vtkMatrix4x4 *aMatrix, double *aError=NULL, std::string *aDate=NULL)
 
PlusStatus ReadTransformToCoordinateDefinition (vtkXMLDataElement *aDeviceSetConfigRootElement, const char *aFromCoordinateFrame, const char *aToCoordinateFrame, vtkMatrix4x4 *aMatrix, double *aError=NULL, std::string *aDate=NULL)
 
PlusStatus ReplaceElementInDeviceSetConfiguration (const char *aElementName, vtkXMLDataElement *aNewRootElement)
 
PlusStatus SaveApplicationConfigurationToFile ()
 
void SetDeviceSetConfigurationData (vtkXMLDataElement *deviceSetConfigurationData)
 
void SetDeviceSetConfigurationDirectory (const std::string &aDir)
 
void SetDeviceSetConfigurationFileName (const std::string &aFilePath)
 
void SetImageDirectory (const std::string &aDir)
 
void SetOutputDirectory (const std::string &aDir)
 
 vtkGetStdStringMacro (EditorApplicationExecutable)
 
 vtkGetStdStringMacro (ApplicationStartTimestamp)
 
 vtkSetStdStringMacro (EditorApplicationExecutable)
 
PlusStatus WriteTransformToCoordinateDefinition (const char *aFromCoordinateFrame, const char *aToCoordinateFrame, vtkMatrix4x4 *aMatrix, double aError=-1, const char *aDate=NULL)
 

Static Public Member Functions

static vtkPlusConfigGetInstance ()
 
static int IsTypeOf (const char *type)
 
static vtkPlusConfigNew ()
 
static vtkPlusConfigSafeDownCast (vtkObject *o)
 
static void SetInstance (vtkPlusConfig *instance)
 

Protected Member Functions

std::string FindFileRecursivelyInDirectory (const char *aFileName, const char *aDirectory)
 
virtual vtkXMLDataElement * GetApplicationConfigurationData ()
 
PlusStatus LoadApplicationConfiguration ()
 
virtual void SetApplicationConfigurationData (vtkXMLDataElement *)
 
void SetProgramDirectory ()
 
 vtkPlusConfig ()
 
PlusStatus WriteApplicationConfiguration ()
 
virtual ~vtkPlusConfig ()
 

Protected Attributes

vtkXMLDataElement * ApplicationConfigurationData
 
std::string ApplicationStartTimestamp
 
vtkXMLDataElement * DeviceSetConfigurationData
 
std::string DeviceSetConfigurationDirectory
 
std::string DeviceSetConfigurationFileName
 
std::string EditorApplicationExecutable
 
std::string ImageDirectory
 
std::string ModelDirectory
 
std::string OutputDirectory
 
std::string ProgramDirectory
 
std::string ScriptsDirectory
 

Detailed Description

Singleton class providing tools needed for handling the configuration - finding files, assembling file names, holding and saving the configuration data.

Definition at line 24 of file vtkPlusConfig.h.

Member Typedef Documentation

◆ Superclass

typedef vtkObject vtkPlusConfig::Superclass

Definition at line 27 of file vtkPlusConfig.h.

Constructor & Destructor Documentation

◆ vtkPlusConfig()

vtkPlusConfig::vtkPlusConfig ( )
protected

Definition at line 125 of file vtkPlusConfig.cxx.

◆ ~vtkPlusConfig()

vtkPlusConfig::~vtkPlusConfig ( )
protectedvirtual

Definition at line 143 of file vtkPlusConfig.cxx.

Member Function Documentation

◆ CreateDeviceSetConfigurationFromFile()

vtkXMLDataElement * vtkPlusConfig::CreateDeviceSetConfigurationFromFile ( const std::string &  aConfigFile)

Convenience function to create a device set configuration from a file Returned pointer must be managed by the caller

Definition at line 228 of file vtkPlusConfig.cxx.

◆ FindFileRecursivelyInDirectory()

std::string vtkPlusConfig::FindFileRecursivelyInDirectory ( const char *  aFileName,
const char *  aDirectory 
)
protected

Search recursively for a file in a specified directory (core, protected function)

Parameters
aFileNameName of the file to be searched
aDirectoryDirectory in which search is performed
Returns
The first file that is found with full path

Definition at line 833 of file vtkPlusConfig.cxx.

◆ FindImagePath()

PlusStatus vtkPlusConfig::FindImagePath ( const std::string &  aImagePath,
std::string &  aFoundAbsolutePath 
)

Get absolute image path from input image path

Parameters
aImagePathImage path read from configuration file
aOutputAbsolutePathAbsolute image path if found (output parameter)

Definition at line 881 of file vtkPlusConfig.cxx.

◆ FindModelPath()

PlusStatus vtkPlusConfig::FindModelPath ( const std::string &  aModelPath,
std::string &  aFoundAbsolutePath 
)

Get absolute model path from input image model path

Parameters
aModelPathModel path read from configuration file
aOutputAbsolutePathAbsolute model path if found (output parameter)

Definition at line 926 of file vtkPlusConfig.cxx.

◆ GetAbsolutePath()

std::string vtkPlusConfig::GetAbsolutePath ( const std::string &  aPath,
const std::string &  aBasePath 
)

Get absolute path from a relative or absolute path

Parameters
aPathRelative or absolute path of a directory.
aBasePathIf aPath is a relative path then this aBasePath will be prepended to the input aPath

Definition at line 985 of file vtkPlusConfig.cxx.

◆ GetApplicationConfigurationData()

virtual vtkXMLDataElement* vtkPlusConfig::GetApplicationConfigurationData ( )
protectedvirtual

Get application configuration data

◆ GetApplicationConfigurationFilePath()

std::string vtkPlusConfig::GetApplicationConfigurationFilePath ( ) const

Returns the path of the application configuration file

Definition at line 542 of file vtkPlusConfig.cxx.

◆ GetClassName()

virtual const char* vtkPlusConfig::GetClassName ( )
virtual

◆ GetDeviceSetConfigurationData()

virtual vtkXMLDataElement* vtkPlusConfig::GetDeviceSetConfigurationData ( )
virtual

Get device set configuration data

◆ GetDeviceSetConfigurationDirectory()

std::string vtkPlusConfig::GetDeviceSetConfigurationDirectory ( )

Get absolute path of the device set configuration directory.

Definition at line 1028 of file vtkPlusConfig.cxx.

◆ GetDeviceSetConfigurationFileName()

std::string vtkPlusConfig::GetDeviceSetConfigurationFileName ( )

Get absolute path of the current device set configuration file

Definition at line 1052 of file vtkPlusConfig.cxx.

◆ GetDeviceSetConfigurationPath()

std::string vtkPlusConfig::GetDeviceSetConfigurationPath ( const std::string &  subPath)

Get absolute path for a device set configuration file specified by a path relative to the device set configuration directory. If subPath is not defined then the absolute path of the device set configuration directory will be returned.

Definition at line 1010 of file vtkPlusConfig.cxx.

◆ GetFirstFileFoundInConfigurationDirectory()

std::string vtkPlusConfig::GetFirstFileFoundInConfigurationDirectory ( const char *  aFileName)

Search recursively for a file in the configuration directory

Parameters
aFileNameName of the file to be searched
Returns
The first file that is found (with full path)

Definition at line 803 of file vtkPlusConfig.cxx.

◆ GetFirstFileFoundInDirectory()

std::string vtkPlusConfig::GetFirstFileFoundInDirectory ( const char *  aFileName,
const char *  aDirectory 
)

Search recursively for a file in a specified directory

Parameters
aFileNameName of the file to be searched
aDirectoryDirectory in which search is performed
Returns
The first file that is found (with full path)

Definition at line 819 of file vtkPlusConfig.cxx.

◆ GetImageDirectory()

std::string vtkPlusConfig::GetImageDirectory ( )

Get absolute path of the image directory.

Definition at line 1034 of file vtkPlusConfig.cxx.

◆ GetImagePath()

std::string vtkPlusConfig::GetImagePath ( const std::string &  subPath)

Get absolute path for an image file specified by a path relative to the image directory. If subPath is not defined then the absolute path of the image directory will be returned.

Definition at line 1040 of file vtkPlusConfig.cxx.

◆ GetInstance()

vtkPlusConfig * vtkPlusConfig::GetInstance ( )
static

Instance getter for the singleton class

Returns
Instance object

Definition at line 71 of file vtkPlusConfig.cxx.

◆ GetModelPath()

std::string vtkPlusConfig::GetModelPath ( const std::string &  subPath)

Get absolute path for a model file specified by a path relative to the model directory. If subPath is not defined then the absolute path of the model directory will be returned.

Definition at line 1004 of file vtkPlusConfig.cxx.

◆ GetNewDeviceSetConfigurationFileName()

std::string vtkPlusConfig::GetNewDeviceSetConfigurationFileName ( )

Assembles a filename for the new device set configuration that is the same as the input file name, only with the current date and time in the end (for saving to a new file)

Returns
New device set configuration file name

Definition at line 485 of file vtkPlusConfig.cxx.

◆ GetOutputDirectory()

std::string vtkPlusConfig::GetOutputDirectory ( )

Get absolute path of the output directory.

Definition at line 1022 of file vtkPlusConfig.cxx.

◆ GetOutputPath()

std::string vtkPlusConfig::GetOutputPath ( const std::string &  subPath)

Get absolute path for an output file specified by a path relative to the output directory.

Definition at line 1016 of file vtkPlusConfig.cxx.

◆ GetPlusExecutablePath()

std::string vtkPlusConfig::GetPlusExecutablePath ( const std::string &  executableName)

Gets the full path of a Plus executable file. executableName should not contain file extension (.exe is added automatically on Windows platforms)

Definition at line 1069 of file vtkPlusConfig.cxx.

◆ GetScriptPath()

std::string vtkPlusConfig::GetScriptPath ( const std::string &  subPath)

Get absolute path for a script file specified by a path relative to the scripts directory. If subPath is not defined then the absolute path of the scripts directory will be returned.

Definition at line 1046 of file vtkPlusConfig.cxx.

◆ IsA()

virtual int vtkPlusConfig::IsA ( const char *  type)
virtual

◆ IsTypeOf()

static int vtkPlusConfig::IsTypeOf ( const char *  type)
static

◆ LoadApplicationConfiguration()

PlusStatus vtkPlusConfig::LoadApplicationConfiguration ( )
protected

Read application configuration from file (PlusConfig.xml in the application's directory)

Returns
Success flag

Definition at line 258 of file vtkPlusConfig.cxx.

◆ LookupElementWithNameContainingChildWithNameAndAttribute()

vtkXMLDataElement * vtkPlusConfig::LookupElementWithNameContainingChildWithNameAndAttribute ( vtkXMLDataElement *  aConfig,
const char *  aElementName,
const char *  aChildName,
const char *  aChildAttributeName,
const char *  aChildAttributeValue 
)

Searches a data element in an XML tree: the child of aElementName that has the name aChildName and has an attribute aChildAttributeName with the value aChildAttributeValue

Parameters
aConfigRoot XML element in that the search is conducted
aElementNameName of the parent of the searched element
aChildNameName of the searched element
aChildAttributeNameName of the attribute based on which we want the element to be found
aChildAttributeValueValue of the attribute based on which we want the element to be found
Returns
Found XML data element

Definition at line 774 of file vtkPlusConfig.cxx.

◆ New()

vtkPlusConfig * vtkPlusConfig::New ( )
static

New

Definition at line 65 of file vtkPlusConfig.cxx.

◆ ReadTransformToCoordinateDefinition() [1/2]

PlusStatus vtkPlusConfig::ReadTransformToCoordinateDefinition ( const char *  aFromCoordinateFrame,
const char *  aToCoordinateFrame,
vtkMatrix4x4 *  aMatrix,
double *  aError = NULL,
std::string *  aDate = NULL 
)

Read coordinate frame definition transfoms from the actual configuration data in the memory (vtkPlusConfig::GetInstance()->GetDeviceSetConfigurationData())

Parameters
aFromCoordinateFrameInput name of the 'from' coordinate frame used to define the transformation
aToCoordinateFrameInput name of the 'to' coordinate frame used to define the transformation
aMatrixOutput matrix value of the FromFrameToFrame transformation
aErrorOutput error value of the computed transform (if NULL, we don't read it)
aDateOutput date in string format (if NULL, we don't read it)

Definition at line 636 of file vtkPlusConfig.cxx.

◆ ReadTransformToCoordinateDefinition() [2/2]

PlusStatus vtkPlusConfig::ReadTransformToCoordinateDefinition ( vtkXMLDataElement *  aDeviceSetConfigRootElement,
const char *  aFromCoordinateFrame,
const char *  aToCoordinateFrame,
vtkMatrix4x4 *  aMatrix,
double *  aError = NULL,
std::string *  aDate = NULL 
)

Read coordinate frame definition transfoms from specified configuration xml data

Parameters
aDeviceSetConfigRootElementDevice set configuration root element
aFromCoordinateFrameInput name of the 'from' coordinate frame used to define the transformation
aToCoordinateFrameInput name of the 'to' coordinate frame used to define the transformation
aMatrixOutput matrix value of the FromFrameToFrame transformation
aErrorOutput error value of the computed transform (if NULL, we don't read it)
aDateOutput date in string format (if NULL, we don't read it)

Definition at line 645 of file vtkPlusConfig.cxx.

◆ ReplaceElementInDeviceSetConfiguration()

PlusStatus vtkPlusConfig::ReplaceElementInDeviceSetConfiguration ( const char *  aElementName,
vtkXMLDataElement *  aNewRootElement 
)

Replaces an element with a name on the level under the top level in device set configuration with the element in the parameter root XML data element

Parameters
aElementNameElement name to replace
aNewRootElementRoot element containing the element to replace with
Returns
Success flag

Definition at line 743 of file vtkPlusConfig.cxx.

◆ SafeDownCast()

static vtkPlusConfig* vtkPlusConfig::SafeDownCast ( vtkObject *  o)
static

◆ SaveApplicationConfigurationToFile()

PlusStatus vtkPlusConfig::SaveApplicationConfigurationToFile ( )

Saves application configuration data to file (into the same file where it was read from)

Returns
Success flag

Definition at line 523 of file vtkPlusConfig.cxx.

◆ SetApplicationConfigurationData()

virtual void vtkPlusConfig::SetApplicationConfigurationData ( vtkXMLDataElement *  )
protectedvirtual

Set application configuration data

◆ SetDeviceSetConfigurationData()

void vtkPlusConfig::SetDeviceSetConfigurationData ( vtkXMLDataElement *  deviceSetConfigurationData)

Set device set configuration data

Definition at line 1058 of file vtkPlusConfig.cxx.

◆ SetDeviceSetConfigurationDirectory()

void vtkPlusConfig::SetDeviceSetConfigurationDirectory ( const std::string &  aDir)

Set device set configuration directory path (if relative then the base is ProgramDirectory)

Definition at line 216 of file vtkPlusConfig.cxx.

◆ SetDeviceSetConfigurationFileName()

void vtkPlusConfig::SetDeviceSetConfigurationFileName ( const std::string &  aFilePath)

Set device set configuration file name (if relative then the base is ProgramDirectory)

Definition at line 222 of file vtkPlusConfig.cxx.

◆ SetImageDirectory()

void vtkPlusConfig::SetImageDirectory ( const std::string &  aDir)

Set image directory path (if relative then the base is ProgramDirectory)

Definition at line 210 of file vtkPlusConfig.cxx.

◆ SetInstance()

void vtkPlusConfig::SetInstance ( vtkPlusConfig instance)
static

Allows cleanup of the singleton at application exit

Definition at line 104 of file vtkPlusConfig.cxx.

◆ SetOutputDirectory()

void vtkPlusConfig::SetOutputDirectory ( const std::string &  aDir)

Set output directory (also changes log file location)

Definition at line 200 of file vtkPlusConfig.cxx.

◆ SetProgramDirectory()

void vtkPlusConfig::SetProgramDirectory ( )
protected

Set program directory path

Definition at line 150 of file vtkPlusConfig.cxx.

◆ vtkGetStdStringMacro() [1/2]

vtkPlusConfig::vtkGetStdStringMacro ( EditorApplicationExecutable  )

Get editor application executable path and file name

◆ vtkGetStdStringMacro() [2/2]

vtkPlusConfig::vtkGetStdStringMacro ( ApplicationStartTimestamp  )

Get application start timestamp

◆ vtkSetStdStringMacro()

vtkPlusConfig::vtkSetStdStringMacro ( EditorApplicationExecutable  )

Set editor application executable path and file name

◆ WriteApplicationConfiguration()

PlusStatus vtkPlusConfig::WriteApplicationConfiguration ( )
protected

Save application configuration file

Returns
Success flag

Definition at line 433 of file vtkPlusConfig.cxx.

◆ WriteTransformToCoordinateDefinition()

PlusStatus vtkPlusConfig::WriteTransformToCoordinateDefinition ( const char *  aFromCoordinateFrame,
const char *  aToCoordinateFrame,
vtkMatrix4x4 *  aMatrix,
double  aError = -1,
const char *  aDate = NULL 
)

Write coordinate frame definition transforms to the configuration file (if already exists update the values)

Parameters
aFromCoordinateFrameName of the 'from' coordinate frame used to define the transformation
aToCoordinateFrameName of the 'to' coordinate frame used to define the transformation
aMatrixMatrix value of the FromFrameToFrame transformation
aErrorError value of the computed transform (if -1, we don't write it)
aDateDate in string format (if NULL, we don't write it)

Definition at line 548 of file vtkPlusConfig.cxx.

Member Data Documentation

◆ ApplicationConfigurationData

vtkXMLDataElement* vtkPlusConfig::ApplicationConfigurationData
protected

Application configuration data

Definition at line 274 of file vtkPlusConfig.h.

◆ ApplicationStartTimestamp

std::string vtkPlusConfig::ApplicationStartTimestamp
protected

Formatted string timestamp of the application start time - used as a prefix for most outputs

Definition at line 295 of file vtkPlusConfig.h.

◆ DeviceSetConfigurationData

vtkXMLDataElement* vtkPlusConfig::DeviceSetConfigurationData
protected

Session device set configuration data

Definition at line 271 of file vtkPlusConfig.h.

◆ DeviceSetConfigurationDirectory

std::string vtkPlusConfig::DeviceSetConfigurationDirectory
protected

Device set configuration directory path. If relative then the base is ProgramDirectory.

Definition at line 265 of file vtkPlusConfig.h.

◆ DeviceSetConfigurationFileName

std::string vtkPlusConfig::DeviceSetConfigurationFileName
protected

Used device set configuration file name (for assembling the new file name with the date)

Definition at line 268 of file vtkPlusConfig.h.

◆ EditorApplicationExecutable

std::string vtkPlusConfig::EditorApplicationExecutable
protected

Path and filename of the editor application executable to be used

Definition at line 277 of file vtkPlusConfig.h.

◆ ImageDirectory

std::string vtkPlusConfig::ImageDirectory
protected

Image directory path. It is used as home directory for images when the image path for a saved dataset is not an absolute path. If relative then the base is ProgramDirectory.

Definition at line 286 of file vtkPlusConfig.h.

◆ ModelDirectory

std::string vtkPlusConfig::ModelDirectory
protected

Model directory path. It is used as home directory for models when the model path for a saved dataset is not an absolute path. If relative then the base is ProgramDirectory.

Definition at line 289 of file vtkPlusConfig.h.

◆ OutputDirectory

std::string vtkPlusConfig::OutputDirectory
protected

Output directory path. If relative then the base is ProgramDirectory.

Definition at line 280 of file vtkPlusConfig.h.

◆ ProgramDirectory

std::string vtkPlusConfig::ProgramDirectory
protected

Program directory of the executable. Absolute path.

Definition at line 283 of file vtkPlusConfig.h.

◆ ScriptsDirectory

std::string vtkPlusConfig::ScriptsDirectory
protected

Scripts directory path. If relative then the base is ProgramDirectory.

Definition at line 292 of file vtkPlusConfig.h.


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