PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusConfig.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2  Program: Plus
3  Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4  See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef __vtkPlusConfig_h
8 #define __vtkPlusConfig_h
9 
10 #include "PlusConfigure.h"
11 #include "vtkPlusCommonExport.h"
12 
13 #include "vtkObject.h"
14 #include "vtkXMLDataElement.h"
15 
16 class vtkMatrix4x4;
17 class vtkIGSIORecursiveCriticalSection;
18 
24 class vtkPlusCommonExport vtkPlusConfig : public vtkObject
25 {
26 public:
27  vtkTypeMacro(vtkPlusConfig, vtkObject);
28 
30  static vtkPlusConfig* New();
31 
36  static vtkPlusConfig* GetInstance();
37 
39  static void SetInstance(vtkPlusConfig* instance);
40 
45  PlusStatus SaveApplicationConfigurationToFile();
46 
50  std::string GetApplicationConfigurationFilePath() const;
51 
56  std::string GetNewDeviceSetConfigurationFileName();
57 
66  PlusStatus WriteTransformToCoordinateDefinition(const char* aFromCoordinateFrame, const char* aToCoordinateFrame, vtkMatrix4x4* aMatrix, double aError = -1, const char* aDate = NULL);
67 
76  PlusStatus ReadTransformToCoordinateDefinition(const char* aFromCoordinateFrame, const char* aToCoordinateFrame, vtkMatrix4x4* aMatrix, double* aError = NULL, std::string* aDate = NULL);
77 
86  PlusStatus ReadTransformToCoordinateDefinition(vtkXMLDataElement* aDeviceSetConfigRootElement, const char* aFromCoordinateFrame, const char* aToCoordinateFrame, vtkMatrix4x4* aMatrix, double* aError = NULL, std::string* aDate = NULL);
87 
94  PlusStatus ReplaceElementInDeviceSetConfiguration(const char* aElementName, vtkXMLDataElement* aNewRootElement);
95 
105  vtkXMLDataElement* LookupElementWithNameContainingChildWithNameAndAttribute(vtkXMLDataElement* aConfig, const char* aElementName, const char* aChildName, const char* aChildAttributeName, const char* aChildAttributeValue);
106 
112  std::string GetFirstFileFoundInConfigurationDirectory(const char* aFileName);
113 
120  std::string GetFirstFileFoundInDirectory(const char* aFileName, const char* aDirectory);
121 
125  void SetOutputDirectory(const std::string& aDir);
126 
128  void SetImageDirectory(const std::string& aDir);
129 
135  PlusStatus FindImagePath(const std::string& aImagePath, std::string& aFoundAbsolutePath);
136 
142  PlusStatus FindModelPath(const std::string& aModelPath, std::string& aFoundAbsolutePath);
143 
148  std::string GetModelPath(const std::string& subPath);
149 
154  std::string GetDeviceSetConfigurationPath(const std::string& subPath);
155 
157  std::string GetDeviceSetConfigurationFileName();
158 
160  void SetDeviceSetConfigurationDirectory(const std::string& aDir);
161 
163  void SetDeviceSetConfigurationFileName(const std::string& aFilePath);
164 
169  vtkXMLDataElement* CreateDeviceSetConfigurationFromFile(const std::string& aConfigFile);
170 
174  std::string GetOutputPath(const std::string& subPath);
175 
179  std::string GetOutputDirectory();
180 
184  std::string GetDeviceSetConfigurationDirectory();
185 
189  std::string GetImageDirectory();
190 
195  std::string GetImagePath(const std::string& subPath);
196 
201  std::string GetScriptPath(const std::string& subPath);
202 
204  vtkGetObjectMacro(DeviceSetConfigurationData, vtkXMLDataElement);
206  void SetDeviceSetConfigurationData(vtkXMLDataElement* deviceSetConfigurationData);
207 
209  vtkGetStdStringMacro(EditorApplicationExecutable);
211  vtkSetStdStringMacro(EditorApplicationExecutable);
212 
214  vtkGetStdStringMacro(ApplicationStartTimestamp);
215 
220  std::string GetPlusExecutablePath(const std::string& executableName);
221 
227  std::string GetAbsolutePath(const std::string& aPath, const std::string& aBasePath);
228 
229 protected:
231  void SetProgramDirectory();
232 
234  vtkGetObjectMacro(ApplicationConfigurationData, vtkXMLDataElement);
236  vtkSetObjectMacro(ApplicationConfigurationData, vtkXMLDataElement);
237 
238 protected:
243  PlusStatus WriteApplicationConfiguration();
244 
249  PlusStatus LoadApplicationConfiguration();
250 
257  std::string FindFileRecursivelyInDirectory(const char* aFileName, const char* aDirectory);
258 
259 protected:
260  vtkPlusConfig();
261  virtual ~vtkPlusConfig();
262 
263 protected:
266 
269 
271  vtkXMLDataElement* DeviceSetConfigurationData;
272 
274  vtkXMLDataElement* ApplicationConfigurationData;
275 
278 
280  std::string OutputDirectory;
281 
283  std::string ProgramDirectory;
284 
286  std::string ImageDirectory;
287 
289  std::string ModelDirectory;
290 
292  std::string ScriptsDirectory;
293 
296 
297 private:
299  static vtkPlusConfig* Instance;
300 };
301 
302 
303 #endif
std::string ApplicationStartTimestamp
vtkXMLDataElement * DeviceSetConfigurationData
igsioStatus PlusStatus
Definition: PlusCommon.h:40
Singleton class providing tools needed for handling the configuration - finding files,...
Definition: vtkPlusConfig.h:24
vtkXMLDataElement * ApplicationConfigurationData
std::string EditorApplicationExecutable
std::string DeviceSetConfigurationFileName
std::string ModelDirectory
std::string OutputDirectory
std::string ProgramDirectory
std::string ScriptsDirectory
std::string DeviceSetConfigurationDirectory
std::string ImageDirectory