Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkSlicerApplicationLogic.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Copyright (c) Brigham and Women's Hospital (BWH) All Rights Reserved.
4
5 See License.txt or http://www.slicer.org/copyright/copyright.txt for details.
6
7==========================================================================*/
16//
17
18#ifndef __vtkSlicerApplicationLogic_h
19#define __vtkSlicerApplicationLogic_h
20
21// Slicer includes
22#include "vtkSlicerBaseLogic.h"
23
24// MRMLLogic includes
26
27// VTK includes
28#include <vtkCollection.h>
29
30// ITK includes
31#include <itkPlatformMultiThreader.h>
32
33// STL includes
34#include <mutex>
35
40class vtkPersonInformation;
41class vtkSlicerTask;
42class ModifiedQueue;
43class ProcessingTaskQueue;
44class ReadDataQueue;
45class ReadDataRequest;
46class WriteDataQueue;
47class WriteDataRequest;
48
49class VTK_SLICER_BASE_LOGIC_EXPORT vtkSlicerApplicationLogic
51{
52 public:
53
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
67 vtkMRMLRemoteIOLogic *remoteIOLogic,
68 vtkDataIOManagerLogic *dataIOManagerLogic);
69
70
73
88
93
103 vtkMTimeType RequestModified(vtkObject *);
104
113 vtkMTimeType RequestReadFile(const char *refNode, const char *filename,
114 int displayData = false, int deleteFile = false);
115
122 vtkMTimeType RequestUpdateParentTransform(const std::string &updatedNode, const std::string& parentTransformNode);
123
130 vtkMTimeType RequestUpdateSubjectHierarchyLocation(const std::string &updatedNode, const std::string& siblingNode);
131
138 vtkMTimeType RequestAddNodeReference(const std::string &referencingNode, const std::string& referencedNode, const std::string& role);
139
143 unsigned int GetReadDataQueueSize();
144
145
151 vtkMTimeType RequestWriteData(const char *refNode, const char *filename);
152
163 vtkMTimeType RequestReadScene(const std::string& filename,
164 std::vector<std::string> &targetIDs,
165 std::vector<std::string> &sourceIDs,
166 int displayData = false,
167 int deleteFile = false);
168
174
180
183
187 void SetTracingOn () { this->Tracing = 1; }
188 void SetTracingOff () { this->Tracing = 0; }
189
195 static bool IsEmbeddedModule(const std::string& filePath, const std::string& applicationHomeDir,
196 const std::string& slicerRevision);
197
202 static bool IsPluginInstalled(const std::string& filePath, const std::string& applicationHomeDir);
203
205 static bool IsPluginBuiltIn(const std::string& filePath, const std::string& applicationHomeDir,
206 const std::string& slicerRevision);
207
209 static std::string GetModuleShareDirectory(const std::string& moduleName, const std::string& filePath);
210
212 static std::string GetModuleSlicerXYShareDirectory(const std::string& filePath);
213
215 static std::string GetModuleSlicerXYLibDirectory(const std::string& filePath);
216
219 vtkPersonInformation* GetUserInformation();
220
223 static void RequestModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
224
225protected:
226
229
231 static itk::ITK_THREAD_RETURN_TYPE ProcessingThreaderCallback( void * );
232
234 static itk::ITK_THREAD_RETURN_TYPE NetworkingThreaderCallback( void * );
235
238
241
246 void ProcessReadSceneData( ReadDataRequest &req );
247 void ProcessWriteSceneData( WriteDataRequest &req );
248
254
255private:
257 void operator=(const vtkSlicerApplicationLogic&);
258
259 itk::PlatformMultiThreader::Pointer ProcessingThreader;
260 std::mutex ProcessingThreadActiveLock;
261 std::mutex ProcessingTaskQueueLock;
262 std::mutex ModifiedQueueActiveLock;
263 std::mutex ModifiedQueueLock;
264 std::mutex ReadDataQueueActiveLock;
265 std::mutex ReadDataQueueLock;
266 std::mutex WriteDataQueueActiveLock;
267 std::mutex WriteDataQueueLock;
268 vtkTimeStamp RequestTimeStamp;
269 int ProcessingThreadId;
270 std::vector<int> NetworkingThreadIDs;
271 int ProcessingThreadActive;
272 int ModifiedQueueActive;
273 int ReadDataQueueActive;
274 int WriteDataQueueActive;
275
276 ProcessingTaskQueue* InternalTaskQueue;
277 ModifiedQueue* InternalModifiedQueue;
278 ReadDataQueue* InternalReadDataQueue;
279 WriteDataQueue* InternalWriteDataQueue;
280
281 vtkPersonInformation* UserInformation;
282
284 int Tracing;
285};
286
287#endif
A set of MRML Nodes that supports serialization and undo/redo.
MRML node for storing information about the active nodes in the scene.
vtkMTimeType RequestAddNodeReference(const std::string &referencingNode, const std::string &referencedNode, const std::string &role)
static bool IsEmbeddedModule(const std::string &filePath, const std::string &applicationHomeDir, const std::string &slicerRevision)
unsigned int GetReadDataQueueSize()
static void RequestModifiedCallback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
void CreateProcessingThread()
Create a thread for processing.
vtkMTimeType RequestReadScene(const std::string &filename, std::vector< std::string > &targetIDs, std::vector< std::string > &sourceIDs, int displayData=false, int deleteFile=false)
RequestEvents
List of events potentially fired by the application logic.
static bool IsPluginBuiltIn(const std::string &filePath, const std::string &applicationHomeDir, const std::string &slicerRevision)
Return true if the plugin identified with its filePath is a built-in Slicer module.
void TerminateProcessingThread()
Shutdown the processing thread.
static itk::ITK_THREAD_RETURN_TYPE NetworkingThreaderCallback(void *)
Callback used by a MultiThreader to start a networking thread.
static vtkSlicerApplicationLogic * New()
The Usual vtk class functions.
void SetMRMLSceneDataIO(vtkMRMLScene *scene, vtkMRMLRemoteIOLogic *remoteIOLogic, vtkDataIOManagerLogic *dataIOManagerLogic)
vtkMTimeType RequestWriteData(const char *refNode, const char *filename)
static std::string GetModuleSlicerXYShareDirectory(const std::string &filePath)
Get Slicer-X.Y share directory associated with module located in filePath.
vtkPersonInformation * GetUserInformation()
int ScheduleTask(vtkSlicerTask *)
vtkMTimeType RequestUpdateSubjectHierarchyLocation(const std::string &updatedNode, const std::string &siblingNode)
void ProcessProcessingTasks()
Task processing loop that is run in the processing thread.
~vtkSlicerApplicationLogic() override
static std::string GetModuleSlicerXYLibDirectory(const std::string &filePath)
Get Slicer-X.Y lib directory associated with module located in filePath.
vtkMTimeType RequestModified(vtkObject *)
static itk::ITK_THREAD_RETURN_TYPE ProcessingThreaderCallback(void *)
Callback used by a MultiThreader to start a processing thread.
void PrintSelf(ostream &os, vtkIndent indent) override
void ProcessWriteData()
Process a request to write data from a referenced node.
static bool IsPluginInstalled(const std::string &filePath, const std::string &applicationHomeDir)
static std::string GetModuleShareDirectory(const std::string &moduleName, const std::string &filePath)
Get share directory associated with moduleName located in filePath.
vtkMTimeType RequestReadFile(const char *refNode, const char *filename, int displayData=false, int deleteFile=false)
void ProcessNetworkingTasks()
Networking Task processing loop that is run in a networking thread.
vtkMTimeType RequestUpdateParentTransform(const std::string &updatedNode, const std::string &parentTransformNode)
void ProcessWriteSceneData(WriteDataRequest &req)
virtual void SetCurrentThreadPriorityToBackground()
void ProcessReadSceneData(ReadDataRequest &req)