Slicer  4.10
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 
39 class vtkSlicerTask;
40 class ModifiedQueue;
41 class ProcessingTaskQueue;
42 class ReadDataQueue;
43 class ReadDataRequest;
44 class WriteDataQueue;
45 class WriteDataRequest;
46 
47 class VTK_SLICER_BASE_LOGIC_EXPORT vtkSlicerApplicationLogic
49 {
50  public:
51 
55  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
56 
64  void SetMRMLSceneDataIO(vtkMRMLScene *scene,
65  vtkMRMLRemoteIOLogic *remoteIOLogic,
66  vtkDataIOManagerLogic *dataIOManagerLogic);
67 
68 
71  void PropagateFiducialListSelection();
72 
74  void CreateProcessingThread();
75 
77  void TerminateProcessingThread();
80  {
81  RequestModifiedEvent = vtkMRMLApplicationLogic::RequestInvokeEvent + 1,
88  RequestProcessedEvent
89  };
90 
94  int ScheduleTask( vtkSlicerTask* );
95 
105  vtkMTimeType RequestModified(vtkObject *);
106 
115  vtkMTimeType RequestReadFile(const char *refNode, const char *filename,
116  int displayData = false, int deleteFile = false);
117 
124  vtkMTimeType RequestUpdateParentTransform(const std::string &updatedNode, const std::string& parentTransformNode);
125 
132  vtkMTimeType RequestUpdateSubjectHierarchyLocation(const std::string &updatedNode, const std::string& siblingNode);
133 
137  unsigned int GetReadDataQueueSize();
138 
139 
145  vtkMTimeType RequestWriteData(const char *refNode, const char *filename);
146 
157  vtkMTimeType RequestReadScene(const std::string& filename,
158  std::vector<std::string> &targetIDs,
159  std::vector<std::string> &sourceIDs,
160  int displayData = false,
161  int deleteFile = false);
162 
167  void ProcessModified();
168 
173  void ProcessReadData();
174 
176  void ProcessWriteData();
177 
181  void SetTracingOn () { this->Tracing = 1; }
182  void SetTracingOff () { this->Tracing = 0; }
183 
189  static bool IsEmbeddedModule(const std::string& filePath, const std::string& applicationHomeDir,
190  const std::string& slicerRevision);
191 
196  static bool IsPluginInstalled(const std::string& filePath, const std::string& applicationHomeDir);
197 
199  static bool IsPluginBuiltIn(const std::string& filePath, const std::string& applicationHomeDir);
200 
202  static std::string GetModuleShareDirectory(const std::string& moduleName, const std::string& filePath);
203 
205  static std::string GetModuleSlicerXYShareDirectory(const std::string& filePath);
206 
208  static std::string GetModuleSlicerXYLibDirectory(const std::string& filePath);
209 
212  vtkPersonInformation* GetUserInformation();
213 
214 protected:
215 
218 
220  static ITK_THREAD_RETURN_TYPE ProcessingThreaderCallback( void * );
221 
223  static ITK_THREAD_RETURN_TYPE NetworkingThreaderCallback( void * );
224 
226  void ProcessProcessingTasks();
227 
229  void ProcessNetworkingTasks();
230 
235  void ProcessReadSceneData( ReadDataRequest &req );
236  void ProcessWriteSceneData( WriteDataRequest &req );
237 
238 private:
240  void operator=(const vtkSlicerApplicationLogic&);
241 
242  itk::MultiThreader::Pointer ProcessingThreader;
243  itk::MutexLock::Pointer ProcessingThreadActiveLock;
244  itk::MutexLock::Pointer ProcessingTaskQueueLock;
245  itk::MutexLock::Pointer ModifiedQueueActiveLock;
246  itk::MutexLock::Pointer ModifiedQueueLock;
247  itk::MutexLock::Pointer ReadDataQueueActiveLock;
248  itk::MutexLock::Pointer ReadDataQueueLock;
249  itk::MutexLock::Pointer WriteDataQueueActiveLock;
250  itk::MutexLock::Pointer WriteDataQueueLock;
251  vtkTimeStamp RequestTimeStamp;
252  int ProcessingThreadId;
253  std::vector<int> NetworkingThreadIDs;
254  int ProcessingThreadActive;
255  int ModifiedQueueActive;
256  int ReadDataQueueActive;
257  int WriteDataQueueActive;
258 
259  ProcessingTaskQueue* InternalTaskQueue;
260  ModifiedQueue* InternalModifiedQueue;
261  ReadDataQueue* InternalReadDataQueue;
262  WriteDataQueue* InternalWriteDataQueue;
263 
264  vtkPersonInformation* UserInformation;
265 
267  int Tracing;
268 };
269 
270 #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.
vtkPersonInformation - specify name and other information to identify a person.
MRML node for storing information about the active nodes in the scene.