00001
00002
00003
00004
00005
00019 #ifndef _SIGNCONTEXT_H_
00020 #define _SIGNCONTEXT_H_
00021
00022 #include <map>
00023 #include <vector>
00024 #include <string>
00025
00026
00027 #include <vtkKWApplication.h>
00028
00029 #include <SignDLL.h>
00030
00031 #include <OpenTracker/OpenTracker.h>
00032
00033
00034 class SignOTModule;
00035 class SignViewer;
00036 class Sign3DViewer;
00037 class SignVolume;
00038 class SignImageReslice;
00039 class SignUIBase;
00040 class SignConfiguration;
00041 class ThreadHandler;
00042 class SignStateManager;
00043 class SignFiducial;
00044 class SignProbe;
00045 class SignEventLog;
00046 class SignMRMLManager;
00047 class vtkMutexLock;
00048 class vtkRenderWindow;
00049 class vtkTransform;
00050
00051 class ThreadEvent
00052 {
00053 public:
00054 vtkObject* caller;
00055 unsigned long event;
00056 void* data;
00057 void* calldata;
00058 };
00059
00060 typedef std::map<vtkRenderWindow*,bool> RenderWindows;
00061 typedef std::vector<SignImageReslice*> SignSlicers;
00062 typedef std::map<std::string, SignViewer*> SignViewers;
00063 typedef std::vector<SignProbe*> Probes;
00064 typedef std::vector<ThreadEvent*> ThreadEventVector;
00065
00066 typedef std::map<std::string,float[3]> ColorNames;
00067
00068 class SIGN_EXPORT SignContext : public vtkKWApplication
00069 {
00070 public:
00071 vtkTypeRevisionMacro(SignContext,vtkKWApplication);
00072 static SignContext* New();
00073 virtual void PrintSelf(ostream& os, vtkIndent indent){};
00074
00075
00076 static void InitTCL(int argc, char**);
00077
00079 void SetMRMLFile(std::string file);
00080 void Init(char* mrml, char* otcfg);
00081 void SetGUI(SignUIBase *);
00082 SignUIBase *GetGUI();
00083 void Start();
00084 void CleanUp();
00085
00086 virtual SignContext* GetApplication();
00087
00088 ot::Context * otc;
00090
00092 RenderWindows renderWindowsUpdate;
00094 SignViewers ViewerCollection;
00096 int timePoint;
00098 ColorNames colors;
00100 SignStateManager* StateManager;
00102 bool annotation2D;
00104 bool annotation3D;
00105
00107 bool hasSplashScreen;
00108
00110 bool hasStatusBar;
00111
00113 void RenderAllWatched();
00114
00116 void AddProbes();
00117
00119 void UpdateProbes();
00120
00123 SignViewer* FindViewer(std::string name);
00124
00126 SignConfiguration* GetConfiguration();
00127
00129 bool hasTransferFunction;
00130
00132 bool stopRendering;
00133
00135 std::string currentFiducialVolumeID;
00136
00138 SignMRMLManager* GetMRMLManager() {return mrmlManager;}
00139
00141 void Use3DTexturesOn() {use_3D_textures = true;}
00142
00144 void Use3DTexturesOff() {use_3D_textures = false;}
00145
00147 bool Use3DTextures() {return use_3D_textures;}
00148
00150 void SetApplicationName(std::string name);
00151
00153 static void SetTimePoint(vtkObject* caller,unsigned long,void* data,void*);
00154
00156 static void OnEventFromThread(vtkObject* caller,unsigned long,void* data,void*);
00157
00159 SignOTModule* GetOTModule();
00160
00161
00162 virtual int CreateLogDialog();
00163
00164 private:
00166 SignUIBase *GUI;
00167
00168
00170 vtkTransform *tran;
00172 SignConfiguration* configuration;
00174 bool started;
00176
00177 SignMRMLManager* mrmlManager;
00179 bool use_3D_textures;
00183 static void handle_idle(void* data);
00184
00185 std::string applicationName;
00186 void CheckThreadEvents();
00187 vtkMutexLock *mutex;
00188 ThreadEventVector ThreadEvents;
00189 protected:
00190 SignContext();
00191 ~SignContext();
00192
00193 virtual void AddAboutText(ostream&);
00194 virtual void AddAboutCopyrights(ostream&);
00195
00196 SignContext(const SignContext&);
00197 void operator=(const SignContext&);
00198
00199
00200 };
00201 #endif