PlusLib
2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
|
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>
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 vtkPlusConfig * | GetInstance () |
static int | IsTypeOf (const char *type) |
static vtkPlusConfig * | New () |
static vtkPlusConfig * | SafeDownCast (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 |
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.
typedef vtkObject vtkPlusConfig::Superclass |
Definition at line 27 of file vtkPlusConfig.h.
|
protected |
Definition at line 125 of file vtkPlusConfig.cxx.
|
protectedvirtual |
Definition at line 143 of file vtkPlusConfig.cxx.
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.
|
protected |
Search recursively for a file in a specified directory (core, protected function)
aFileName | Name of the file to be searched |
aDirectory | Directory in which search is performed |
Definition at line 833 of file vtkPlusConfig.cxx.
PlusStatus vtkPlusConfig::FindImagePath | ( | const std::string & | aImagePath, |
std::string & | aFoundAbsolutePath | ||
) |
Get absolute image path from input image path
aImagePath | Image path read from configuration file |
aOutputAbsolutePath | Absolute image path if found (output parameter) |
Definition at line 881 of file vtkPlusConfig.cxx.
PlusStatus vtkPlusConfig::FindModelPath | ( | const std::string & | aModelPath, |
std::string & | aFoundAbsolutePath | ||
) |
Get absolute model path from input image model path
aModelPath | Model path read from configuration file |
aOutputAbsolutePath | Absolute model path if found (output parameter) |
Definition at line 926 of file vtkPlusConfig.cxx.
std::string vtkPlusConfig::GetAbsolutePath | ( | const std::string & | aPath, |
const std::string & | aBasePath | ||
) |
Get absolute path from a relative or absolute path
aPath | Relative or absolute path of a directory. |
aBasePath | If aPath is a relative path then this aBasePath will be prepended to the input aPath |
Definition at line 985 of file vtkPlusConfig.cxx.
|
protectedvirtual |
Get application configuration data
std::string vtkPlusConfig::GetApplicationConfigurationFilePath | ( | ) | const |
Returns the path of the application configuration file
Definition at line 542 of file vtkPlusConfig.cxx.
|
virtual |
|
virtual |
Get device set configuration data
std::string vtkPlusConfig::GetDeviceSetConfigurationDirectory | ( | ) |
Get absolute path of the device set configuration directory.
Definition at line 1028 of file vtkPlusConfig.cxx.
std::string vtkPlusConfig::GetDeviceSetConfigurationFileName | ( | ) |
Get absolute path of the current device set configuration file
Definition at line 1052 of file vtkPlusConfig.cxx.
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.
std::string vtkPlusConfig::GetFirstFileFoundInConfigurationDirectory | ( | const char * | aFileName | ) |
Search recursively for a file in the configuration directory
aFileName | Name of the file to be searched |
Definition at line 803 of file vtkPlusConfig.cxx.
std::string vtkPlusConfig::GetFirstFileFoundInDirectory | ( | const char * | aFileName, |
const char * | aDirectory | ||
) |
Search recursively for a file in a specified directory
aFileName | Name of the file to be searched |
aDirectory | Directory in which search is performed |
Definition at line 819 of file vtkPlusConfig.cxx.
std::string vtkPlusConfig::GetImageDirectory | ( | ) |
Get absolute path of the image directory.
Definition at line 1034 of file vtkPlusConfig.cxx.
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.
|
static |
Instance getter for the singleton class
Definition at line 71 of file vtkPlusConfig.cxx.
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.
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)
Definition at line 485 of file vtkPlusConfig.cxx.
std::string vtkPlusConfig::GetOutputDirectory | ( | ) |
Get absolute path of the output directory.
Definition at line 1022 of file vtkPlusConfig.cxx.
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.
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.
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.
|
virtual |
|
static |
|
protected |
Read application configuration from file (PlusConfig.xml in the application's directory)
Definition at line 258 of file vtkPlusConfig.cxx.
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
aConfig | Root XML element in that the search is conducted |
aElementName | Name of the parent of the searched element |
aChildName | Name of the searched element |
aChildAttributeName | Name of the attribute based on which we want the element to be found |
aChildAttributeValue | Value of the attribute based on which we want the element to be found |
Definition at line 774 of file vtkPlusConfig.cxx.
|
static |
New
Definition at line 65 of file vtkPlusConfig.cxx.
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())
aFromCoordinateFrame | Input name of the 'from' coordinate frame used to define the transformation |
aToCoordinateFrame | Input name of the 'to' coordinate frame used to define the transformation |
aMatrix | Output matrix value of the FromFrameToFrame transformation |
aError | Output error value of the computed transform (if NULL, we don't read it) |
aDate | Output date in string format (if NULL, we don't read it) |
Definition at line 636 of file vtkPlusConfig.cxx.
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
aDeviceSetConfigRootElement | Device set configuration root element |
aFromCoordinateFrame | Input name of the 'from' coordinate frame used to define the transformation |
aToCoordinateFrame | Input name of the 'to' coordinate frame used to define the transformation |
aMatrix | Output matrix value of the FromFrameToFrame transformation |
aError | Output error value of the computed transform (if NULL, we don't read it) |
aDate | Output date in string format (if NULL, we don't read it) |
Definition at line 645 of file vtkPlusConfig.cxx.
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
aElementName | Element name to replace |
aNewRootElement | Root element containing the element to replace with |
Definition at line 743 of file vtkPlusConfig.cxx.
|
static |
PlusStatus vtkPlusConfig::SaveApplicationConfigurationToFile | ( | ) |
Saves application configuration data to file (into the same file where it was read from)
Definition at line 523 of file vtkPlusConfig.cxx.
|
protectedvirtual |
Set application configuration data
void vtkPlusConfig::SetDeviceSetConfigurationData | ( | vtkXMLDataElement * | deviceSetConfigurationData | ) |
Set device set configuration data
Definition at line 1058 of file vtkPlusConfig.cxx.
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.
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.
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.
|
static |
Allows cleanup of the singleton at application exit
Definition at line 104 of file vtkPlusConfig.cxx.
void vtkPlusConfig::SetOutputDirectory | ( | const std::string & | aDir | ) |
Set output directory (also changes log file location)
Definition at line 200 of file vtkPlusConfig.cxx.
|
protected |
Set program directory path
Definition at line 150 of file vtkPlusConfig.cxx.
vtkPlusConfig::vtkGetStdStringMacro | ( | EditorApplicationExecutable | ) |
Get editor application executable path and file name
vtkPlusConfig::vtkGetStdStringMacro | ( | ApplicationStartTimestamp | ) |
Get application start timestamp
vtkPlusConfig::vtkSetStdStringMacro | ( | EditorApplicationExecutable | ) |
Set editor application executable path and file name
|
protected |
Save application configuration file
Definition at line 433 of file vtkPlusConfig.cxx.
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)
aFromCoordinateFrame | Name of the 'from' coordinate frame used to define the transformation |
aToCoordinateFrame | Name of the 'to' coordinate frame used to define the transformation |
aMatrix | Matrix value of the FromFrameToFrame transformation |
aError | Error value of the computed transform (if -1, we don't write it) |
aDate | Date in string format (if NULL, we don't write it) |
Definition at line 548 of file vtkPlusConfig.cxx.
|
protected |
Application configuration data
Definition at line 274 of file vtkPlusConfig.h.
|
protected |
Formatted string timestamp of the application start time - used as a prefix for most outputs
Definition at line 295 of file vtkPlusConfig.h.
|
protected |
Session device set configuration data
Definition at line 271 of file vtkPlusConfig.h.
|
protected |
Device set configuration directory path. If relative then the base is ProgramDirectory.
Definition at line 265 of file vtkPlusConfig.h.
|
protected |
Used device set configuration file name (for assembling the new file name with the date)
Definition at line 268 of file vtkPlusConfig.h.
|
protected |
Path and filename of the editor application executable to be used
Definition at line 277 of file vtkPlusConfig.h.
|
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.
|
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.
|
protected |
Output directory path. If relative then the base is ProgramDirectory.
Definition at line 280 of file vtkPlusConfig.h.
|
protected |
Program directory of the executable. Absolute path.
Definition at line 283 of file vtkPlusConfig.h.
|
protected |
Scripts directory path. If relative then the base is ProgramDirectory.
Definition at line 292 of file vtkPlusConfig.h.