NIREP
|
00001 /*========================================================================= 00002 00003 Program: vtkINRIA3D 00004 Module: $Id: wxVtkImageFlip.h,v 1.2 2009/08/03 18:57:39 hawle Exp $ 00005 Language: C++ 00006 Author: $Author: hawle $ 00007 Date: $Date: 2009/08/03 18:57:39 $ 00008 Version: $Revision: 1.2 $ 00009 00010 Copyright (c) 2007 INRIA - Asclepios Project. All rights reserved. 00011 See Copyright.txt for details. 00012 00013 This software is distributed WITHOUT ANY WARRANTY; without even 00014 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00015 PURPOSE. See the above copyright notices for more information. 00016 00017 =========================================================================*/ 00018 00019 //I made a slight change in the code so that we would not get 00020 //some errors. 00021 //Inside of the function SetImage (vtkImageData* image): 00022 //I moved the this->UpdateReslicer(); and added in the 00023 //this->Reslicer->Update(); so that the View1->SetImage would 00024 //stop complaining about the Extents of the images being 0,-1, etc. 00025 //Jeffrey Hawley 00026 00027 00028 #ifndef _wx_VtkImageFlip_h_ 00029 #define _wx_VtkImageFlip_h_ 00030 00031 // For compilers that support precompilation, includes "wx/wx.h". 00032 #include "wx/wxprec.h" 00033 00034 #ifdef __BORLANDC__ 00035 #pragma hdrstop 00036 #endif 00037 00038 // for all others, include the necessary headers 00039 #ifndef WX_PRECOMP 00040 #include "wx/wx.h" 00041 #endif 00042 00043 #include "wx/wizard.h" 00044 #include <string> 00045 #include <vtkINRIA3DConfigure.h> 00046 00070 #include <NIREPvtkViewImage2D.h> 00071 #include <vtkImageReslice.h> 00072 class wxVTKRenderWindowInteractor; 00073 /* class NIREPvtkViewImage2D; */ 00074 class vtkImageData; 00075 class vtkImageFlip; 00076 00077 00078 class WX_VTK_EXPORT wxVtkImageFlip: public wxDialog 00079 { 00080 00081 public: 00082 wxVtkImageFlip (wxWindow* parent, int id, 00083 const wxString& title=wxT (""), 00084 const wxPoint& pos=wxDefaultPosition, 00085 const wxSize& size=wxDefaultSize, 00086 long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); 00087 virtual ~wxVtkImageFlip(); 00088 00089 00090 void OnComboAcquisition (wxCommandEvent &event); 00091 void OnButtonFlipRL (wxCommandEvent &event); 00092 void OnButtonFlipFH (wxCommandEvent &event); 00093 void OnButtonFlipAP (wxCommandEvent &event); 00094 void OnButtonCANCEL (wxCommandEvent &event); 00095 void OnButtonOK (wxCommandEvent &event); 00096 void OnButtonSave (wxCommandEvent &event); 00097 00098 void UpdateReslicer(void); 00099 void Synchronize (void); 00100 00101 00103 void SetImage (vtkImageData* image); 00104 00106 void SetInput (vtkImageData* input) 00107 { this->SetImage (input); } 00108 00109 vtkImageData* GetOutput (void) const 00110 { return this->View1->GetImage(); } 00111 00112 template <class TImage> 00113 void SaveImage (vtkImageData*, const char*); 00114 00116 vtkImageData* GetImage (void) const 00117 { return this->Image; } 00118 00119 vtkImageData* GetInput (void) const 00120 { return this->Image; } 00121 00123 void SetAxesFlipped (bool axes[3]) 00124 { 00125 this->AxesFlipped[0]=axes[0]; 00126 this->AxesFlipped[1]=axes[1]; 00127 this->AxesFlipped[2]=axes[2]; 00128 } 00129 00130 bool* GetAxesFlipped (void) 00131 { return AxesFlipped; } 00132 bool GetAxisFlipped (int i) 00133 { return AxesFlipped[i]; } 00134 00135 enum AcquisitionOrientation 00136 { 00137 ACQ_AXIAL, 00138 ACQ_CORONAL, 00139 ACQ_SAGITTAL 00140 }; 00147 void SetAcquisitionFlag (unsigned int flag) 00148 { this->AcquisitionFlag = flag; 00149 this->ComboAcquisition ->SetSelection (flag); } 00150 00151 unsigned int GetAcquisitionFlag (void) const 00152 { return this->AcquisitionFlag; } 00153 00155 vtkImageReslice* GetReslicer (void) const 00156 { return this->Reslicer;} 00157 00158 double* GetReslicerDirectionCosines (void) const 00159 { return this->Reslicer->GetResliceAxesDirectionCosines(); } 00160 00161 double* GetReslicerAxesOrigin (void) const 00162 { return this->Reslicer->GetResliceAxesOrigin(); } 00163 00164 00165 wxString Title; 00166 wxSize Size; 00167 wxPoint Pos; 00168 long Style; 00169 00170 wxStaticText* AcquisitionTxt; 00171 wxComboBox* ComboAcquisition; 00172 00173 wxButton* ButtonFlipRL; 00174 wxButton* ButtonFlipFH; 00175 wxButton* ButtonFlipAP; 00176 wxButton* ButtonCANCEL; 00177 wxButton* ButtonOK; 00178 wxButton* ButtonSave; 00179 00180 protected: 00181 00182 DECLARE_EVENT_TABLE() 00183 void SetProperties (void); 00184 void DoLayout(void); 00185 00186 private: 00187 00188 vtkImageData* Image; 00189 vtkImageReslice* Reslicer; 00190 00191 wxVTKRenderWindowInteractor* VtkView1; 00192 wxVTKRenderWindowInteractor* VtkView2; 00193 wxVTKRenderWindowInteractor* VtkView3; 00194 00195 00196 NIREPvtkViewImage2D* View1; 00197 NIREPvtkViewImage2D* View2; 00198 NIREPvtkViewImage2D* View3; 00199 00200 int ImageDim[3]; 00201 double ImageOrigin[3]; 00202 double ImageCenter[3]; 00203 int ImageExtent[6]; 00204 double ImageSpacing[3]; 00205 00206 00207 00208 bool AxesFlipped[3]; 00209 unsigned int AcquisitionFlag; 00210 00211 bool FirstRender; 00212 00213 enum 00214 { 00215 COMBOBOX_ACQ, 00216 BUTTON_FLIPRL, 00217 BUTTON_FLIPFH, 00218 BUTTON_FLIPAP, 00219 BUTTON_CANCEL, 00220 BUTTON_OK, 00221 BUTTON_SAVE 00222 }; 00223 00224 00225 }; 00226 00227 00228 #include "wxVtkImageFlip.txx" 00229 00230 #endif