Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 <itkMultiThreader.h>
32 #include <itkMutexLock.h>
33 
38 class vtkSlicerTask;
39 class ModifiedQueue;
40 class ProcessingTaskQueue;
41 class ReadDataQueue;
42 class ReadDataRequest;
43 class WriteDataQueue;
44 class WriteDataRequest;
45 
46 class VTK_SLICER_BASE_LOGIC_EXPORT vtkSlicerApplicationLogic
48 {
49  public:
50 
54  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
55 
63  void SetMRMLSceneDataIO(vtkMRMLScene *scene,
64  vtkMRMLRemoteIOLogic *remoteIOLogic,
65  vtkDataIOManagerLogic *dataIOManagerLogic);
66 
67 
70  void PropagateFiducialListSelection();
71 
73  void CreateProcessingThread();
74 
76  void TerminateProcessingThread();
79  {
80  RequestModifiedEvent = vtkMRMLApplicationLogic::RequestInvokeEvent + 1,
87  RequestProcessedEvent
88  };
89 
93  int ScheduleTask( vtkSlicerTask* );
94 
104  vtkMTimeType RequestModified(vtkObject *);
105 
114  vtkMTimeType RequestReadFile(const char *refNode, const char *filename,
115  int displayData = false, int deleteFile = false);
116 
123  vtkMTimeType RequestUpdateParentTransform(const std::string &updatedNode, const std::string& parentTransformNode);
124 
131  vtkMTimeType RequestUpdateSubjectHierarchyLocation(const std::string &updatedNode, const std::string& siblingNode);
132 
136  unsigned int GetReadDataQueueSize();
137 
138 
144  vtkMTimeType RequestWriteData(const char *refNode, const char *filename);
145 
156  vtkMTimeType RequestReadScene(const std::string& filename,
157  std::vector<std::string> &targetIDs,
158  std::vector<std::string> &sourceIDs,
159  int displayData = false,
160  int deleteFile = false);
161 
166  void ProcessModified();
167 
172  void ProcessReadData();
173 
175  void ProcessWriteData();
176 
180  void SetTracingOn () { this->Tracing = 1; }
181  void SetTracingOff () { this->Tracing = 0; }
182 
188  static bool IsEmbeddedModule(const std::string& filePath, const std::string& applicationHomeDir,
189  const std::string& slicerRevision);
190 
195  static bool IsPluginInstalled(const std::string& filePath, const std::string& applicationHomeDir);
196 
198  static bool IsPluginBuiltIn(const std::string& filePath, const std::string& applicationHomeDir);
199 
201  static std::string GetModuleShareDirectory(const std::string& moduleName, const std::string& filePath);
202 
204  static std::string GetModuleSlicerXYShareDirectory(const std::string& filePath);
205 
207  static std::string GetModuleSlicerXYLibDirectory(const std::string& filePath);
208 
209 protected:
210 
213 
215  static ITK_THREAD_RETURN_TYPE ProcessingThreaderCallback( void * );
216 
218  static ITK_THREAD_RETURN_TYPE NetworkingThreaderCallback( void * );
219 
221  void ProcessProcessingTasks();
222 
224  void ProcessNetworkingTasks();
225 
230  void ProcessReadSceneData( ReadDataRequest &req );
231  void ProcessWriteSceneData( WriteDataRequest &req );
232 
233 private:
235  void operator=(const vtkSlicerApplicationLogic&);
236 
237  itk::MultiThreader::Pointer ProcessingThreader;
238  itk::MutexLock::Pointer ProcessingThreadActiveLock;
239  itk::MutexLock::Pointer ProcessingTaskQueueLock;
240  itk::MutexLock::Pointer ModifiedQueueActiveLock;
241  itk::MutexLock::Pointer ModifiedQueueLock;
242  itk::MutexLock::Pointer ReadDataQueueActiveLock;
243  itk::MutexLock::Pointer ReadDataQueueLock;
244  itk::MutexLock::Pointer WriteDataQueueActiveLock;
245  itk::MutexLock::Pointer WriteDataQueueLock;
246  vtkTimeStamp RequestTimeStamp;
247  int ProcessingThreadId;
248  std::vector<int> NetworkingThreadIDs;
249  int ProcessingThreadActive;
250  int ModifiedQueueActive;
251  int ReadDataQueueActive;
252  int WriteDataQueueActive;
253 
254  ProcessingTaskQueue* InternalTaskQueue;
255  ModifiedQueue* InternalModifiedQueue;
256  ReadDataQueue* InternalReadDataQueue;
257  WriteDataQueue* InternalWriteDataQueue;
258 
260  int Tracing;
261 };
262 
263 #endif
static vtkMRMLApplicationLogic * New()
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
RequestEvents
List of events potentially fired by the application logic.
MRML node for storing information about the active nodes in the scene.