vtkOpenIGTLinkIFGUI.h

Go to the documentation of this file.
00001 /*==========================================================================
00002 
00003   Portions (c) Copyright 2008-2009 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   3D Slicer
00009   Module:    $HeadURL: http://svn.slicer.org/Slicer3/trunk/Modules/OpenIGTLinkIF/vtkOpenIGTLinkIFGUI.h $
00010   Date:      $Date: 2010-11-23 00:58:13 -0500 (Tue, 23 Nov 2010) $
00011   Version:   $Revision: 15552 $
00012 
00013 ==========================================================================*/
00014 
00015 #ifndef __vtkOpenIGTLinkIFGUI_h
00016 #define __vtkOpenIGTLinkIFGUI_h
00017 
00018 #ifdef WIN32
00019 #include "vtkOpenIGTLinkIFWin32Header.h"
00020 #endif
00021 
00022 #include "vtkSlicerModuleGUI.h"
00023 #include "vtkOpenIGTLinkIFLogic.h"
00024 #include "vtkMRMLIGTLConnectorNode.h"
00025 
00026 #ifdef OpenIGTLinkIF_USE_VERSION_2
00027   #include "vtkIGTLRemoteDataListWindow.h"
00028   #include "vtkIGTLTrackingDataControllerWindow.h"
00029 #endif //OpenIGTLinkIF_USE_VERSION_2
00030 
00031 #include "vtkIGTDataManager.h"
00032 #include "vtkIGTPat2ImgRegistration.h"
00033 
00034 #include "vtkCallbackCommand.h"
00035 #include "vtkSlicerInteractorStyle.h"
00036 
00037 #include <string>
00038 #include <vector>
00039 
00040 class vtkKWPushButton;
00041 class vtkKWRadioButtonSet;
00042 class vtkKWMenuButton;
00043 class vtkKWCheckButton;
00044 class vtkKWScaleWithEntry;
00045 class vtkKWEntry;
00046 class vtkKWFrame;
00047 class vtkKWMultiColumnListWithScrollbars;
00048 class vtkKWTreeWithScrollbars;
00049 class vtkSlicerNodeSelectorWidget;
00050 class vtkKWRadioButtonSetWithLabel;
00051 
00052 class vtkTransform;
00053 
00054 // Description:    
00055 // This class implements Slicer's Volumes GUI
00056 //
00057 class VTK_OPENIGTLINKIF_EXPORT vtkOpenIGTLinkIFGUI : public vtkSlicerModuleGUI
00058 {
00059 
00060   //----------------------------------------------------------------
00061   // Type defines
00062   //----------------------------------------------------------------
00063  public:
00064   //BTX
00065   enum {
00066     SLICE_PLANE_RED    = 0,
00067     SLICE_PLANE_YELLOW = 1,
00068     SLICE_PLANE_GREEN  = 2
00069   };
00070 
00071   // Connector List update level options
00072   enum {
00073     UPDATE_SELECTED_ONLY   = 0,  // Update selected item only
00074     UPDATE_STATUS_ALL      = 1,  // Update status for all items
00075     UPDATE_PROPERTY_ALL    = 2,  // Update all properties for all items
00076     UPDATE_ALL             = 3,  // Update whole list (incl. changed number of items)
00077   };
00078 
00079   enum {
00080     NODE_NONE      = 0,
00081     NODE_CONNECTOR = 1,
00082     NODE_IO        = 2,
00083     NODE_DEVICE    = 3
00084   };
00085 
00086   static const char* ConnectorTypeStr[vtkMRMLIGTLConnectorNode::NUM_TYPE];
00087   static const char* ConnectorStatusStr[vtkMRMLIGTLConnectorNode::NUM_STATE];
00088 
00089   typedef struct {
00090     std::string nodeName;
00091     std::string connectorID;
00092     std::string nodeID;
00093     int         io;
00094   } IOConfigNodeInfoType;
00095 
00096   typedef std::list<IOConfigNodeInfoType> IOConfigNodeInfoListType;
00097   //ETX
00098 
00099   //----------------------------------------------------------------
00100   // Access functions
00101   //----------------------------------------------------------------
00102  public:
00103   // Description:    
00104   // Usual vtk class functions
00105   static vtkOpenIGTLinkIFGUI* New ();
00106   vtkTypeRevisionMacro ( vtkOpenIGTLinkIFGUI, vtkSlicerModuleGUI );
00107   void PrintSelf (ostream& os, vtkIndent indent );
00108   
00109   // Description: 
00110   // Get the categorization of the module.
00111   const char *GetCategory() const { return "IGT"; }
00112 
00113   //SendDATANavitrack
00114   // Description:    
00115   // Get methods on class members (no Set methods required)
00116   vtkGetObjectMacro ( Logic, vtkOpenIGTLinkIFLogic );
00117   
00118   // Description:
00119   // API for setting VolumeNode, VolumeLogic and
00120   // for both setting and observing them.
00121   void SetModuleLogic ( vtkSlicerLogic *logic )
00122   { 
00123     this->SetLogic ( vtkObjectPointer (&this->Logic), logic ); }
00124 
00125   //void SetAndObserveModuleLogic ( vtkOpenIGTLinkIFLogic *logic )
00126   //{ this->SetAndObserveLogic ( vtkObjectPointer (&this->Logic), logic ); }
00127   // Description: 
00128 
00129   // Get Target Fiducials (used in the wizard steps)
00130   vtkGetStringMacro ( FiducialListNodeID );
00131   vtkSetStringMacro ( FiducialListNodeID );
00132   vtkGetObjectMacro ( FiducialListNode, vtkMRMLFiducialListNode );
00133   vtkSetObjectMacro ( FiducialListNode, vtkMRMLFiducialListNode );
00134 
00135   //----------------------------------------------------------------
00136   // Event handlers
00137   //----------------------------------------------------------------
00138  public:
00139   // Description:    
00140   // This method builds the IGTDemo module GUI
00141   virtual void BuildGUI ( );
00142 
00143  private:
00144   void BuildGUIForWizardFrame();
00145   void BuildGUIForHelpFrame();
00146   void BuildGUIForConnectorBrowserFrame();
00147   void BuildGUIForIOConfig();
00148   void BuildGUIForDeviceFrame();
00149   void BuildGUIForVisualizationControlFrame();
00150   
00151   //----------------------------------------------------------------
00152   // Event handlers
00153   //----------------------------------------------------------------
00154  public:
00155   // Description:
00156   // Add/Remove observers and even handlers
00157   virtual void AddGUIObservers ( );
00158   virtual void RemoveGUIObservers ( );
00159   void         AddLogicObservers ( );
00160   void         RemoveLogicObservers ( );
00161 
00162   virtual void OpenRemoteDataListWindow(const char* conID);
00163   virtual void OpenTrackingDataControllerWindow(const char* conID);
00164 
00165   //virtual void AddNodeCallback(const char* conID, int io, const char* name, const char* type);
00166   virtual void AddNodeCallback(const char* conID, int io, const char* nodeID, const char* devType);
00167   virtual void ExportDataToIGTLCallback(const char* conID, const char* nodeID);
00168   virtual void DeleteNodeCallback(const char* conID, int io, const char* nodeID);
00169 
00170   // Description:
00171   // Class's mediator methods for processing events invoked by
00172   // either the Logic, MRML or GUI.    
00173 
00174   virtual void ProcessLogicEvents ( vtkObject *caller, unsigned long event, void *callData );
00175   virtual void ProcessGUIEvents ( vtkObject *caller, unsigned long event, void *callData );
00176   virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData );
00177   //virtual int  OnMrmlNodeListChanged(int row, int col, const char* item);
00178   void         ProcessTimerEvents();
00179   void         HandleMouseEvent(vtkSlicerInteractorStyle *style);
00180   //BTX
00181   static void  DataCallback(vtkObject *caller, 
00182                            unsigned long eid, void *clientData, void *callData);
00183   //ETX
00184   
00185  public:
00186   // Description:
00187   // Describe behavior at module startup and exit.
00188   virtual void Enter ( );
00189   virtual void Exit ( );
00190   void Init();
00191 
00192   void UpdateAll();
00193   
00194   //----------------------------------------------------------------
00195   // Constructor / Destructor
00196   //----------------------------------------------------------------
00197  protected:
00198   vtkOpenIGTLinkIFGUI ( );
00199   virtual ~vtkOpenIGTLinkIFGUI ( );
00200 
00201   //----------------------------------------------------------------
00202   // Operators
00203   //----------------------------------------------------------------
00204  private:
00205   vtkOpenIGTLinkIFGUI ( const vtkOpenIGTLinkIFGUI& ); // Not implemented.
00206   void operator = ( const vtkOpenIGTLinkIFGUI& ); //Not implemented.
00207   
00208   //----------------------------------------------------------------
00209   // Dynamic GUIs
00210   //----------------------------------------------------------------
00211  private:
00212   void IOConfigTreeContextMenu(const char *callData);
00213   //BTX
00214   //int  IsIOConfigTreeLeafSelected(const char* callData, std::string& conID, int* devID, int* io);
00215   int  IsIOConfigTreeLeafSelected(const char* callData, std::string& conID, int* io, std::string& nodeID);
00216   //ETX
00217   void AddIOConfigContextMenuItem(int type, const char* conID, int io, const char* nodeID);
00218 
00219   // Description:
00220   //  Enable/disable menus in Driver panel based on Locator source data.
00221   void UpdateDriverPanel();
00222 
00223   void ChangeSlicePlaneDriver(int slice, const char* driver);
00224   void UpdateIOConfigTree();
00225   void UpdateConnectorList(int updateLevel);
00226   void UpdateConnectorPropertyFrame(int i);
00227   void UpdateConnectorNodeList();
00228 
00229   vtkMRMLIGTLConnectorNode* GetConnector(const char* nodeID);
00230 
00231  private:
00232   //----------------------------------------------------------------
00233   // Timer
00234   //----------------------------------------------------------------
00235   int TimerFlag;
00236   int TimerInterval;
00237   vtkTimerLog* TimerLog;
00238 
00239   //----------------------------------------------------------------
00240   // GUI widgets
00241   //----------------------------------------------------------------
00242   
00243   //----------------------------------------------------------------
00244   // Connector Browser Frame
00245 
00246   vtkKWMultiColumnListWithScrollbars* ConnectorList;
00247   vtkKWPushButton*     AddConnectorButton;
00248   vtkKWPushButton*     DeleteConnectorButton;
00249   vtkKWEntry*          ConnectorNameEntry;
00250   vtkKWRadioButtonSet* ConnectorTypeButtonSet;
00251   vtkKWCheckButton*    ConnectorStatusCheckButton;
00252   vtkKWEntry*          ConnectorAddressEntry;
00253   vtkKWEntry*          ConnectorPortEntry;
00254   vtkKWRadioButtonSetWithLabel* CheckCRCButtonSet;
00255 
00256   //----------------------------------------------------------------
00257   // Data I/O Configuration frame
00258 
00259   vtkKWCheckButton*        EnableAdvancedSettingButton;
00260   vtkKWTreeWithScrollbars* IOConfigTree;
00261   vtkKWMenu*               IOConfigContextMenu;
00262   vtkKWMultiColumnListWithScrollbars* MrmlNodeList;
00263 
00264   //----------------------------------------------------------------
00265   // Visualization Control Frame
00266 
00267   vtkKWCheckButton*    FreezeImageCheckButton;
00268   vtkKWCheckButton*    ObliqueCheckButton;
00269   vtkKWPushButton*     SetLocatorModeButton;
00270   vtkKWPushButton*     SetUserModeButton;
00271 
00272   vtkKWMenuButton*     RedSliceMenu;
00273   vtkKWMenuButton*     YellowSliceMenu;
00274   vtkKWMenuButton*     GreenSliceMenu;
00275   vtkKWCheckButton*    ImagingControlCheckButton;
00276   vtkKWMenuButton*     ImagingMenu;
00277 
00278   vtkSlicerNodeSelectorWidget* ImageSourceSelectorWidget;
00279   vtkSlicerNodeSelectorWidget* LocatorSourceSelectorWidget;
00280 
00281   vtkKWCheckButton* LocatorCheckButton;
00282   bool              IsSliceOrientationAdded;
00283   // Module logic and mrml pointers
00284 
00285 #ifdef OpenIGTLinkIF_USE_VERSION_2
00286   //----------------------------------------------------------------
00287   // Remote Data List Window
00288   vtkIGTLRemoteDataListWindow* RemoteDataWindow;
00289   vtkIGTLTrackingDataControllerWindow* TrackingDataControllerWindow;
00290 #endif //OpenIGTLinkIF_USE_VERSION_2
00291 
00292 
00293   //----------------------------------------------------------------
00294   // Logic Values
00295   //----------------------------------------------------------------
00296 
00297   vtkOpenIGTLinkIFLogic* Logic;
00298 
00299   vtkIGTDataManager* DataManager;
00300   vtkCallbackCommand* DataCallbackCommand;
00301 
00302   // Access the slice windows
00303   vtkMRMLSliceNode *SliceNode0;
00304   vtkMRMLSliceNode *SliceNode1;
00305   vtkMRMLSliceNode *SliceNode2;
00306 
00307   // GUI Update flags
00308   int UpdateConnectorListFlag;
00309   int UpdateConnectorPropertyFrameFlag;
00310   int UpdateIOConfigTreeFlag;
00311 
00312   //----------------------------------------------------------------
00313   // Connector and MRML Node list management
00314   //----------------------------------------------------------------
00315 
00316   //ConnectorIDListType ConnectorIDList;
00317   //BTX
00318   // List of connector node
00319   std::vector<std::string> ConnectorNodeList;
00320   //ETX
00321 
00322   //BTX
00323   vtkOpenIGTLinkIFLogic::IGTLMrmlNodeListType CurrentNodeListAvailable;
00324   vtkOpenIGTLinkIFLogic::IGTLMrmlNodeListType CurrentNodeListSelected;
00325   vtkOpenIGTLinkIFLogic::IGTLMrmlNodeListType LocatorSourceList;
00326   vtkOpenIGTLinkIFLogic::IGTLMrmlNodeListType RealTimeImageSourceList;
00327 
00328   IOConfigNodeInfoListType IOConfigTreeConnectorList;
00329   IOConfigNodeInfoListType IOConfigTreeIOList;
00330   IOConfigNodeInfoListType IOConfigTreeNodeList;
00331 
00332   //ETX
00333 
00334   //----------------------------------------------------------------
00335   // Locator Model
00336   //----------------------------------------------------------------
00337 
00338   int                        CloseScene;
00339 
00340   //----------------------------------------------------------------
00341   // Target Fiducials
00342   //----------------------------------------------------------------
00343 
00344   char *FiducialListNodeID;
00345   vtkMRMLFiducialListNode *FiducialListNode;
00346 
00347 };
00348 
00349 
00350 
00351 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1