vtkFetchMIGUI.h

Go to the documentation of this file.
00001 #ifndef __vtkFetchMIGUI_h
00002 #define __vtkFetchMIGUI_h
00003 
00004 #include "vtkSlicerBaseGUIWin32Header.h"
00005 #include "vtkSlicerModuleGUI.h"
00006 
00007 #include "vtkMRMLScene.h"
00008 #include "vtkFetchMILogic.h"
00009 #include "vtkMRMLFetchMINode.h"
00010 #include "vtkIntArray.h"
00011 #include "vtkFetchMI.h"
00012 
00013 // Had to add this to force loading of these support libraries
00014 // Only libraries with entries that will be dynamically called from TCL need to be instantiated
00015 #include "vtkTcl.h"
00016 extern "C" int Vtkslicerfetchmimodulelogic_Init(Tcl_Interp *interp);
00017 
00018 class vtkSlicerNodeSelectorWidget;
00019 class vtkFetchMIQueryTermWidget;
00020 class vtkFetchMIFlatResourceWidget;
00021 class vtkFetchMIResourceUploadWidget;
00022 class vtkFetchMITagViewWidget;
00023 class vtkXNDHandler;
00024 
00025 class vtkKWFrame;
00026 class vtkKWNotebook;
00027 class vtkKWLabel;
00028 class vtkKWFrameWithLabel;
00029 class vtkKWPushButton;
00030 class vtkKWEntry;
00031 class vtkKWEntryWithLabel;
00032 class vtkKWTopLevel;
00033 class vtkKWMenuButton;
00034 class vtkFetchMIIcons;
00035 
00036 
00037 class VTK_FETCHMI_EXPORT vtkFetchMIGUI : public vtkSlicerModuleGUI
00038 {
00039   public:
00040   static vtkFetchMIGUI *New();
00041   vtkTypeMacro(vtkFetchMIGUI,vtkSlicerModuleGUI);
00042   void PrintSelf(ostream& os, vtkIndent indent);
00043 
00044   // Description:
00045   // Set the logic pointer from parent class pointer.
00046   // Overloads implementation in vtkSlicerModulesGUI
00047   // to allow loadable modules.
00048   virtual void SetModuleLogic ( vtkSlicerLogic *logic )
00049   {
00050   this->SetLogic(reinterpret_cast<vtkFetchMILogic*> (logic)); 
00051   }
00052 
00053    // Description: Get/Set MRML node
00054   vtkGetObjectMacro (Logic, vtkFetchMILogic);
00055   vtkSetObjectMacro (Logic, vtkFetchMILogic);
00056   
00057   // Description: Get/Set MRML node
00058   vtkGetObjectMacro (FetchMINode, vtkMRMLFetchMINode);
00059   vtkSetObjectMacro (FetchMINode, vtkMRMLFetchMINode);
00060 
00061   vtkGetObjectMacro ( QueryList, vtkFetchMIQueryTermWidget );
00062   vtkGetObjectMacro ( ResourceList, vtkFetchMIFlatResourceWidget );
00063   vtkGetObjectMacro ( TaggedDataList, vtkFetchMIResourceUploadWidget );
00064   vtkGetObjectMacro ( AddServerButton, vtkKWPushButton );
00065   vtkGetObjectMacro ( ServerMenuButton, vtkKWMenuButton );
00066   vtkGetObjectMacro ( NewServerLabel, vtkKWLabel );
00067   vtkGetObjectMacro ( RefreshButton, vtkKWPushButton );
00068   vtkGetObjectMacro ( AddServerEntry, vtkKWEntry );
00069   vtkGetObjectMacro ( FetchMIIcons, vtkFetchMIIcons );
00070   vtkGetObjectMacro ( QueryTagsButton, vtkKWPushButton );
00071   vtkGetObjectMacro ( TagViewer, vtkFetchMITagViewWidget);
00072   vtkGetObjectMacro ( ServerTypeMenuButton, vtkKWMenuButton );
00073   vtkGetObjectMacro ( CloseNewServerButton, vtkKWPushButton );
00074   vtkGetObjectMacro ( NewServerWindow, vtkKWTopLevel );
00075   vtkGetObjectMacro ( Notebook, vtkKWNotebook );
00076 
00077   vtkGetMacro (GUIWidth, int );
00078   vtkSetMacro (GUIWidth, int );
00079 
00080   // Description:
00081   // Create widgets
00082 
00083   virtual void BuildGUI ( );
00084   //BTX
00085   using vtkSlicerComponentGUI::BuildGUI; 
00086   //ETX
00087   virtual void TearDownGUI ( );
00088   void LoadTclPackage ( );
00089   virtual void SwallowGUIEvent();
00090 
00091   vtkIntArray *NewObservableEvents();
00092 
00093   // Description:
00094   // Add obsereves to GUI widgets
00095   virtual void AddGUIObservers ( );
00096 
00097   // Description:
00098   // Remove obsereves to GUI widgets
00099   virtual void RemoveGUIObservers ( );
00100   virtual void RemoveMRMLNodeObservers ( );
00101   virtual void RemoveLogicObservers ( );
00102   
00103   // Description:
00104   // Pprocess events generated by Logic
00105   virtual void ProcessLogicEvents ( vtkObject *vtkNotUsed(caller), unsigned long vtkNotUsed(event),
00106                                   void *vtkNotUsed(callData) ){};
00107 
00108   // Description:
00109   // Pprocess events generated by GUI widgets
00110   virtual void ProcessGUIEvents ( vtkObject *caller, unsigned long event,
00111                                   void *callData );
00112 
00113   // Description:
00114   // Pprocess events generated by MRML
00115   virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, 
00116                                   void *callData);
00117   // Description:
00118   // Pops up a window into which the name of a new server
00119   // can be added. There is currently no check for whether
00120   // the server is valid. 
00121   void RaiseNewServerWindow();
00122   void WithdrawNewServerWindow();
00123   void DestroyNewServerWindow();
00124 
00125   // Description:
00126   // Describe behavior at module startup and exit.
00127   virtual void Enter ( );
00128   //BTX
00129   using vtkSlicerComponentGUI::Enter; 
00130   //ETX
00131   virtual void Exit ( );
00132   virtual void Init ( );
00133 
00134   // Description:
00135   // Get the categorization of the module.  The category is used for
00136   // grouping modules together into menus.
00137   const char *GetCategory() const {return "Informatics";}
00138 
00139 protected:
00140   vtkFetchMIGUI();
00141   ~vtkFetchMIGUI();
00142   vtkFetchMIGUI(const vtkFetchMIGUI&);
00143   void operator=(const vtkFetchMIGUI&);
00144 
00145   // Description:
00146   // Updates GUI widgets based on parameters values in MRML node
00147   void UpdateGUI();
00148   void UpdateTagTableFromGUI();
00149   void PopulateQueryListFromServer();
00150   
00151   // Description:
00152   // If the selected server is re-selected, then the
00153   // appropriate tagtable's RestoreSelectionState variable is
00154   // set, and Logic repopulates its list of available Tags and
00155   // values for query. This method restores
00156   // the values that a user had previously selected
00157   // for tags in the GUI as a user convenience.
00158   void RestoreSelectedValuesForTagsFromMRML();
00159   
00160   // Description:
00161   //--- Method restores user's selection state for all tags.
00162   void UpdateTagTableFromMRML();
00163   void UpdateResourceTableFromMRML();
00164   void InitializeSceneTable();
00165   void UpdateSceneTableFromMRML();
00166   void AddMRMLSceneRow();
00167   void UpdateVolumeNodes();
00168   void UpdateModelNodes();
00169   void UpdateFiducialListNodes();
00170   void UpdateUnstructuredGridNodes();
00171   void UpdateColorTableNodes();
00172 
00173   // Description:
00174   // Apply/remove current  tag to selected data.
00175   void TagSelectedData();
00176   void RemoveTagFromSelectedData();
00177 
00178   // Description:
00179   //--- This method loops through all resources selected in the ResourceList.
00180   //--- For each selected resource, the DeleteResourceFromServer method on the Logic
00181   //--- is called, which in turn requests the DeleteResource method on the appropriate handler.
00182   //--- Then handler returns 0 if an error occurs, and the logic passes this back.
00183   //--- For each resource successfully deleted, the ResourceList is updated; and if any
00184   //--- resource deletion causes an error, a message dialog is posted warning the user
00185   //--- that not all resources may have been deleted.
00186   void DeleteSelectedResourcesFromServer();
00187 
00188   void ShowAllTagView();
00189   void ShowSelectionTagView();
00190 
00191   // Description:
00192   // updates status text in the slicer window.
00193   void SetStatusText( const char *txt);
00194 
00195 
00196   vtkFetchMILogic *Logic;
00197   vtkMRMLFetchMINode* FetchMINode;
00198   vtkFetchMIQueryTermWidget *QueryList;
00199   vtkFetchMIFlatResourceWidget *ResourceList;
00200   vtkFetchMIResourceUploadWidget *TaggedDataList;
00201   vtkKWPushButton *AddServerButton;
00202   vtkKWMenuButton *ServerTypeMenuButton;
00203   vtkKWPushButton *CloseNewServerButton;
00204   vtkKWTopLevel *NewServerWindow;
00205   vtkKWLabel *NewServerLabel;
00206   vtkKWMenuButton *ServerMenuButton;
00207   vtkKWPushButton *RefreshButton;
00208   vtkKWEntry *AddServerEntry;
00209   vtkKWPushButton *QueryTagsButton;
00210   vtkFetchMITagViewWidget *TagViewer;
00211   vtkFetchMIIcons *FetchMIIcons;
00212   vtkKWNotebook *Notebook;
00213 
00214   int UpdatingGUI;
00215   int UpdatingMRML;
00216   int GUIWidth;
00217   // Description:
00218   // This flag gets set when the module is entered,
00219   // and unset when the module is exited. It is used
00220   // to put observers on and off the MRML Scene.
00221   bool Raised;
00222 
00223 };
00224 
00225 #endif
00226 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1