NIREP
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 #ifndef _PANEL_H_ 00014 #define _PANEL_H_ 00015 00016 00017 // For compilers that support precompilation, includes "wx/wx.h". 00018 #include "wx/wxprec.h" 00019 00020 #ifdef __BORLANDC__ 00021 #pragma hdrstop 00022 #endif 00023 00024 #ifndef WX_PRECOMP 00025 #include "wx/wx.h" 00026 #endif 00027 00032 #include "vtkImageData.h" 00033 #include "vtkProperty.h" 00034 #include "vtkImageActor.h" 00035 #include "vtkRenderer.h" 00036 #include "vtkImageImport.h" 00037 #include "vtkActor.h" 00038 #include "NIREPwxVTKRenderWindowInteractor.h" 00039 #include <vector> 00040 #include <string> 00041 #include "NIREPvtkViewImage2D.h" 00042 #include "Checkerboard.h" 00043 #include "Wipe.h" 00044 00045 #include "DisplayDescription.h" 00046 // geclibs includes 00047 #include "gecObjectMap.h" 00048 #include "NIREPEvaluator.h" 00049 #include "vtkLookupTableWithEnabling.h" 00050 #include "vtkImageBlendWithMask.h" 00051 #include "vtkImageMapToColors.h" 00052 #include "wx/fontdlg.h" 00053 #include "wx/splitter.h" 00054 #include "wx/sstream.h" 00055 #include "wx/html/htmlwin.h" 00056 #include "wx/richtext/richtextctrl.h" 00057 #include "wx/richtext/richtextstyles.h" 00058 #include "wx/richtext/richtextxml.h" 00059 #include "wx/richtext/richtexthtml.h" 00060 #include "wx/richtext/richtextformatdlg.h" 00061 #include "wx/richtext/richtextsymboldlg.h" 00062 #include "wx/richtext/richtextstyledlg.h" 00063 #include "wx/richtext/richtextprint.h" 00064 #include <wx/richtext/richtextbuffer.h> 00065 00066 #if wxUSE_FILESYSTEM 00067 #include "wx/filesys.h" 00068 #include "wx/fs_mem.h" 00069 #endif 00070 00071 #if wxUSE_HELP 00072 #include "wx/cshelp.h" 00073 #endif 00074 00075 /* +--------+ 00076 | Macros | 00077 +--------+ */ 00078 00079 00080 enum 00081 { 00082 XY_ORIENTATION_CONSTANT, 00083 YZ_ORIENTATION_CONSTANT, 00084 XZ_ORIENTATION_CONSTANT 00085 00086 }; 00087 00088 //enum 00089 //{ 00090 // IMAGE_WIDGET, 00091 // CHECKERBOARD_WIDGET, 00092 // WIPE_WIDGET, 00093 // OBJECTMAP_WIDGET, 00094 // OVERLAY_OBJECTMAP_WIDGET, 00095 // OVERLAY_IMAGE_WIDGET, 00096 // RELATIVE_OVERLAP, 00097 // RELATIVE_OVERLAP_TEXT, 00098 // INTENSITY_VARIANCE_TEXT, 00099 // INVERSE_CONSISTENCY_TEXT, 00100 // TRANSITIVITY_ERROR_TEXT, 00101 // VARIANCE_TRANSFORM_TEXT, 00102 // VARIANCE_IMAGE_TEXT, 00103 // BLANK_WIDGET 00104 //}; 00105 00106 00107 enum{ 00108 BW, 00109 BW_INVERSE, 00110 SPECTRUM, 00111 HOT_METAL, 00112 GE_COLOR, 00113 FLOW, 00114 LONI, 00115 LONI2, 00116 ASYMMETRY, 00117 P_VALUE, 00118 ROI, 00119 OTHER 00120 00121 }; 00122 00123 00124 00125 00126 00131 #define ID_PANEL500 10002 00132 #define ID_VTKWINDOW 10003 00133 #define SYMBOL_PANEL_STYLE wxSUNKEN_BORDER|wxTAB_TRAVERSAL 00134 #define SYMBOL_PANEL_IDNAME ID_PANEL2 00135 #define SYMBOL_PANEL_SIZE wxDefaultSize 00136 #define SYMBOL_PANEL_POSITION wxDefaultPosition 00137 #define ID_POPUP 10055 00138 #define ID_POPUPTWO 10056 00139 #define ID_POPUPTHREE 10057 00140 #define ID_POPUPFOUR 10058 00141 #define ID_POPUPFIVE 10054 00142 #define ID_POPUPSIX 10059 00143 #define ID_POPUPSEVEN 10060 00144 00145 00146 /* +---------+ 00147 | Classes | 00148 +---------+ */ 00149 00150 00151 class Panel; 00152 class NIREPEvaluator; 00153 class NIREPDisplay; 00154 00155 00171 00172 class Panel: public wxPanel 00173 { 00174 DECLARE_DYNAMIC_CLASS( Panel ) 00175 DECLARE_EVENT_TABLE() 00176 00177 public: 00178 00179 /* +----------------+ 00180 | Public Methods | 00181 +----------------+ */ 00182 00183 00188 Panel(); 00189 00193 Panel(wxWindow* parent, DisplayDescription *dd, wxWindowID id = ID_PANEL500, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL); 00194 00198 bool Create(wxWindow* parent, wxWindowID id = ID_PANEL500, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL); 00199 00203 ~Panel(); 00204 00208 void Init(); 00209 00213 void CreateControls(); 00214 00218 wxBitmap GetBitmapResource( const wxString& name ); 00219 00223 wxIcon GetIconResource( const wxString& name ); 00224 00228 static bool ShowToolTips(); 00229 00232 00235 00236 void UseImage(); 00237 00240 void UseCheckerboard(); 00241 00244 void UseWipe(); 00245 00248 void UseObjectMap(); 00249 00252 void UseOverlayObjectMap(); 00253 00256 void UseOverlayImage(); 00257 00260 void UseRelativeOverlap(); 00261 00264 void UseRelativeOverlapTextStatistic(); 00265 00268 void UseIntensityVarianceTextStatistic(); 00269 00272 void UseInverseConsistencyTextStatistic(); 00273 00276 void UseTransitivityErrorTextStatistic(); 00277 00280 void UseVarianceTransformTextStatistic(); 00281 00284 void UseVarianceImageTextStatistic(); 00285 00288 void UseBlank(); 00289 00292 void UseVectorField(); 00293 00294 00302 void UseWidget(const std::string& widget); 00303 00308 std::string GetWidgetType(){return m_widgetType;}; 00309 00310 00311 00317 void ClearIds(const std::string& id = ""); 00318 00325 void SetIds(const std::string& d); 00326 00330 std::vector<std::string> GetIds(); 00331 00334 void UpdatePanel(); 00335 00338 void PanelFrame(wxCommandEvent &event); 00339 00342 void ObjectMapForm(wxCommandEvent &event); 00343 00346 void Render(); 00347 00350 vtkRenderWindow* GetRenderWindow(); 00351 00354 void OnRightButton(wxMouseEvent &event); 00355 00358 NIREPvtkViewImage2D* GetView(); 00359 00362 void RightClick(int x, int y); 00363 00366 void Delete(); 00367 00370 void SetParent(NIREPDisplay *p){parent=p;}; 00371 00374 void SetID(int i){id = i;}; 00375 00378 int GetID(){return id;}; 00379 00382 NIREPDisplay *GetPanelParent(){return parent;}; 00383 00386 void Flip(wxCommandEvent& event); 00387 00390 void Mouse(wxCommandEvent &event); 00391 00394 void SetEvaluator(NIREPEvaluator *EV) {evaluator = EV;}; 00395 00398 void SetLookUpTable(vtkLookupTable *vlt, int Selection = OTHER); 00399 00402 vtkLookupTable * GetLookUpTable(){return PanelLookupTable;}; 00403 00406 int GetLookupTableSelection(){return m_lookupTableSelection;}; 00407 00410 void BlendImages(); 00411 00414 itk::AnalyzeObjectEntryArrayType * GetObjectEntries(); 00415 00418 NIREPvtkViewImage2D* GetWidget(){return m_widget;}; 00419 00422 std::vector<int> GetLinkedWidgets(){return m_linkedWidgets;}; 00423 00426 void SetLinkedWidgets(std::vector<int> LW){m_linkedWidgets = LW;}; 00427 00430 void SetOrientation(unsigned int o){m_orientation = o; if(this->m_widget != NULL) this->m_widget->SetOrientation(o);}; 00431 00434 unsigned int GetOrientation(){return m_orientation;}; 00435 00436 void SetCursorLocation(int x, int y); 00437 00438 void SetSlice(int s); 00439 00440 00441 private: 00442 00443 bool CheckImage(gec::Image *image); 00444 /* +--------------------+ 00445 | Private Parameters | 00446 +--------------------+ */ 00447 std::vector< std::string > ids; 00448 wxMenu * TreePopupMenu; 00449 00450 NIREPwxVTKRenderWindowInteractor* wxView; 00451 NIREPvtkViewImage2D* m_widget; 00452 NIREPDisplay *parent; 00453 int id; 00454 std::string m_widgetType; 00455 int mouse; 00456 NIREPEvaluator *evaluator; 00457 vtkLookupTable *PanelLookupTable; 00458 itk::AnalyzeObjectEntryArrayType ObjectEntryTable; 00459 std::vector<int> m_linkedWidgets; 00460 int m_lookupTableSelection; 00461 unsigned int m_orientation; 00462 wxFlexGridSizer* m_flexGridSizer; 00463 wxRichTextCtrl* m_richTextController; 00464 00465 DisplayDescription *m_displayDescription; 00466 00467 }; 00468 00469 #endif 00470 // _PANEL_H_