00001 00002 /* 00003 #ifndef SURFACE_MPR_H 00004 #define SURFACE_MPR_H 00005 00006 #include "vtkRenderWindow.h" 00007 #include <vtkVolumeRayCastMapper.h> 00008 #include "vtkImageActor.h" 00009 #include "vtkActor.h" 00010 #include "vtkPolyDataMapper.h" 00011 #include "vtkStripper.h" 00012 #include <vtkGlyph3D.h> 00013 #include "vtkLODActor.h" 00014 #include "vtkContourFilter.h" 00015 #include "vtkPolyDataNormals.h" 00016 #include <vtkClipPolyData.h> 00017 #include "vtkOutlineFilter.h" 00018 #include <vtkPiecewiseFunction.h> 00019 #include <vtkColorTransferFunction.h> 00020 #include <vtkVolume.h> 00021 #include <vtkVolumeProperty.h> 00022 #include <vtkVolumeRayCastMapper.h> 00023 #include <vtkVolumeRayCastCompositeFunction.h> 00024 #include <vtkBoxWidget.h> 00025 00026 #include "wxMPRBaseData.h" 00027 #include "wxVtkBaseView.h" 00028 00029 //---------------------------------------------------------------------------- 00030 00031 00032 #define VTKMPRDATA_MAXTISSUE 4 00033 00034 00035 //------------------------------------------------------------------ 00036 //------------------------------------------------------------------ 00037 //------------------------------------------------------------------ 00038 00039 // Callback for the interaction 00040 class boxVolumeObserver : public vtkCommand{ 00041 public: 00042 vtkRenderWindow *_renWin; 00043 vtkVolumeRayCastMapper *_volumeMapper; 00044 00045 boxVolumeObserver() { } 00046 00047 virtual char const *GetClassName() const { return "boxVolumeObserver";} 00048 00049 static boxVolumeObserver *New(){ 00050 boxVolumeObserver * result; 00051 result = new boxVolumeObserver(); 00052 return result; 00053 } 00054 00055 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ; 00056 void SetRenWin( vtkRenderWindow *renWin ); 00057 void SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper); 00058 }; 00059 00060 //------------------------------------------------------------------ 00061 //------------------------------------------------------------------ 00062 //------------------------------------------------------------------ 00063 00064 // Callback for the interaction 00065 class boxSurfaceObserver : public vtkCommand{ 00066 public: 00067 vtkPlanes *_planes; 00068 vtkActor *_actor; 00069 00070 boxSurfaceObserver() { } 00071 00072 virtual char const *GetClassName() const { return "boxSurfaceObserver";} 00073 00074 static boxSurfaceObserver *New(){ 00075 boxSurfaceObserver * result; 00076 result = new boxSurfaceObserver(); 00077 return result; 00078 } 00079 00080 virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ; 00081 void SetPlanes(vtkPlanes *planes); 00082 void SetActor(vtkActor *actor); 00083 }; 00084 00085 00086 00087 //------------------------------------------------------------------ 00088 //------------------------------------------------------------------ 00089 //------------------------------------------------------------------ 00090 00091 class vtkMPR3DData : public vtkMPRBaseData{ 00092 public: 00093 vtkMPR3DData(); 00094 ~vtkMPR3DData(); 00095 vtkImageActor* GetImageActor(int id); 00096 vtkActor* GetOutlineActor(); 00097 vtkPolyDataMapper* GetTissueMapper(int id); 00098 vtkPlanes* GetTissuePlanes(int id); 00099 vtkStripper* GetTissueStripper(int id); 00100 vtkGlyph3D* GetGlyph(int id); 00101 vtkLODActor* GetMaceActor(int id); 00102 00103 virtual void Configure(); 00104 void SetIsovalue(int idTissue, int isoValue); 00105 wxColour* GetColour(int idColour); 00106 void SetVisiblePosition(int idPosition, bool visible); 00107 bool GetVisiblePosition(int idPosition); 00108 vtkVolume* GetVolumeActor(); 00109 vtkVolumeRayCastMapper *GetVolumeMapper(); 00110 00111 private: 00112 00113 bool _visiblePosition[3]; 00114 wxColour *_colour[ VTKMPRDATA_MAXTISSUE ]; 00115 00116 // tissue 00117 vtkContourFilter *_tissueExtractor[ VTKMPRDATA_MAXTISSUE ]; 00118 vtkPolyDataNormals *_tissueNormals[ VTKMPRDATA_MAXTISSUE ]; 00119 vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ]; 00120 vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ]; 00121 vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ]; 00122 vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ]; 00123 00124 // outline 00125 vtkOutlineFilter *_outlineData; 00126 vtkPolyDataMapper *_mapOutline; 00127 vtkActor *_outline; 00128 00130 vtkPiecewiseFunction *_tfun; 00131 vtkColorTransferFunction *_ctfun; 00132 vtkVolumeRayCastCompositeFunction *_compositeFunction; 00133 vtkVolumeRayCastMapper *_volumeMapper; 00134 vtkVolumeProperty *_volumeProperty; 00135 vtkVolume *_newvol; 00136 }; 00137 00138 00139 //------------------------------------------------------------------ 00140 //------------------------------------------------------------------ 00141 //------------------------------------------------------------------ 00142 00143 00144 class wxVtkMPR3DView: public wxVtk3DBaseView, public vtkMPRBaseView{ 00145 public: 00146 wxVtkMPR3DView( wxWindow *parent ); 00147 ~wxVtkMPR3DView(); 00148 void SetVtkMPRData(vtkMPR3DData *tmp_vtkmpr3Ddata); 00149 vtkActor* GetTissueActor(int id); 00150 void VisibleActor(int idTissue, bool visTissue, bool visGuide); 00151 void VisibleImageActor(int idPosition, bool visible); 00152 void VisibleVolumeActor( bool visVolume,bool visGuide); 00153 void SetVisibleTissue(int idTissue, bool visible); 00154 bool GetVisibleTissue(int idTissue); 00155 virtual void Configure(); 00156 00157 private: 00158 bool _visibleTissue[VTKMPRDATA_MAXTISSUE]; 00159 bool _visibleVolume; 00160 vtkActor *_tissue[VTKMPRDATA_MAXTISSUE]; 00161 //volume 00162 boxVolumeObserver *_observerV; 00163 vtkBoxWidget *_boxWidget; 00164 boxSurfaceObserver *_observerS1; 00165 vtkBoxWidget *_boxWidgetS1; 00166 00167 protected: 00168 }; 00169 00170 //------------------------------------------------------------------ 00171 //------------------------------------------------------------------ 00172 //------------------------------------------------------------------ 00173 00174 class wxSurfaceMPR: public wxFrame{ 00175 public: 00176 00177 wxSurfaceMPR(wxWindow *parent, vtkImageData *imagedata, const wxString& title); 00178 void ConfigureVTK(); 00179 void OnPositionX(wxScrollEvent& event); 00180 void OnPositionY(wxScrollEvent& event); 00181 void OnPositionZ(wxScrollEvent& event); 00182 void VisibleActor(int idView, int idTissue, bool visTissue, bool visGuide); 00183 void VisibleImageActor(int idView, int idTissue, bool visible); 00184 void VisibleVolumeActor(int idView, bool visVolume, bool visGuide); 00185 00186 void OnVisibleX(wxCommandEvent& event); 00187 void OnVisibleY(wxCommandEvent& event); 00188 void OnVisibleZ(wxCommandEvent& event); 00189 void OnVisibleTissueA(wxCommandEvent& event); 00190 void OnVisibleTissueB(wxCommandEvent& event); 00191 void OnVisibleTissueC(wxCommandEvent& event); 00192 void OnVisibleTissueD(wxCommandEvent& event); 00193 void OnVisibleVolume(wxCommandEvent& event); 00194 00195 void OpacityTissue(int idView, int idTissue, int opacity); 00196 void OnOpacity0(wxScrollEvent& event); 00197 void OnOpacity1(wxScrollEvent& event); 00198 void OnOpacity2(wxScrollEvent& event); 00199 void OnOpacity3(wxScrollEvent& event); 00200 void OnIsoValue0(wxScrollEvent& event); 00201 void OnIsoValue1(wxScrollEvent& event); 00202 void OnIsoValue2(wxScrollEvent& event); 00203 void OnIsoValue3(wxScrollEvent& event); 00204 void OnIsoValue_0(wxScrollEvent& event); 00205 void OnIsoValue_1(wxScrollEvent& event); 00206 void OnIsoValue_2(wxScrollEvent& event); 00207 void OnIsoValue_3(wxScrollEvent& event); 00208 void OnBtnColourA(wxCommandEvent& event); 00209 void OnBtnColourB(wxCommandEvent& event); 00210 void OnBtnColourC(wxCommandEvent& event); 00211 void OnBtnColourD(wxCommandEvent& event); 00212 00213 void Refresh(); 00214 00215 private: 00216 00217 wxSlider *_sl1_box1; 00218 wxSlider *_sl2_box1; 00219 wxSlider *_sl3_box1; 00220 wxCheckBox *_chk1_box1; 00221 wxCheckBox *_chk2_box1; 00222 wxCheckBox *_chk3_box1; 00223 00224 wxButton *_btnA; 00225 wxButton *_btnB; 00226 wxButton *_btnC; 00227 wxButton *_btnD; 00228 wxSlider *_slA1_box2; 00229 wxSlider *_slA2_box2; 00230 wxSlider *_slA3_box2; 00231 wxSlider *_slB1_box2; 00232 wxSlider *_slB2_box2; 00233 wxSlider *_slB3_box2; 00234 wxSlider *_slC1_box2; 00235 wxSlider *_slC2_box2; 00236 wxSlider *_slC3_box2; 00237 wxSlider *_slD1_box2; 00238 wxSlider *_slD2_box2; 00239 wxSlider *_slD3_box2; 00240 wxCheckBox *_chkA_box2; 00241 wxCheckBox *_chkB_box2; 00242 wxCheckBox *_chkC_box2; 00243 wxCheckBox *_chkD_box2; 00244 wxCheckBox *_chkAA_box2; 00245 wxCheckBox *_chkBB_box2; 00246 wxCheckBox *_chkCC_box2; 00247 wxCheckBox *_chkDD_box2; 00248 wxCheckBox *_chkViewA_box2; 00249 wxCheckBox *_chkViewB_box2; 00250 wxCheckBox *_chkViewC_box2; 00251 wxCheckBox *_chkViewD_box2; 00252 00253 wxStaticText *_text_A; 00254 wxStaticText *_text_B; 00255 wxStaticText *_text_C; 00256 wxStaticText *_text_D; 00257 00258 wxSlider *_sl1_box3; 00259 wxSlider *_sl2_box3; 00260 wxSlider *_sl3_box3; 00261 wxCheckBox *_chk_box3; 00262 wxCheckBox *_chk_box33; 00263 00264 wxSlider *_slA_box4; 00265 wxSlider *_slB_box4; 00266 wxSlider *_sl1_box4; 00267 wxSlider *_sl2_box4; 00268 wxSlider *_sl3_box4; 00269 wxSlider *_sl4_box4; 00270 wxSlider *_sl5_box4; 00271 wxSlider *_sl6_box4; 00272 wxCheckBox *_chk_box4; 00273 00274 00275 vtkMPR3DData *_vtkmpr3Ddata; 00276 wxVtkMPR3DView *_vtkmprview[4]; 00277 00278 wxPanel* CreateControlPanel(wxWindow *parent); 00279 wxPanel* CreateMPRPanel(wxWindow *parent,vtkMPR3DData *vtkmpr3Ddata); 00280 00281 }; 00282 00283 #endif // SURFACE_MPR_H 00284 00285 00286 00287 */