]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.h
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMPRWidget.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: wxMPRWidget.h,v $
5   Language:  C++
6   Date:      $Date: 2008/12/06 15:15:34 $
7   Version:   $Revision: 1.5 $
8
9   Copyright: (c) 2002, 2003
10   License:
11   
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17
18 #ifndef __WX__MPR__WIDGET__HXX__
19 #define __WX__MPR__WIDGET__HXX__
20
21 #include "marTypes.h"
22 #include <vector>
23
24 #include <vtkObjectBase.h>
25 #include <vtkCommand.h>
26 #include <vtkActor.h>
27 #include <vtkPoints.h>
28 #include <vtkPolyData.h>
29 #include <vtkPolyDataMapper.h>
30 #include <vtkProbeFilter.h>
31 #include <vtkPlaneSource.h> 
32 #include <vtkImageChangeInformation.h>
33 #include <vtkStructuredPoints.h> 
34 #include <vtkTransform.h> 
35 #include <vtkImageViewer2.h> 
36 #include <vtkBoxWidget.h>
37 #include <vtkPointWidget.h>
38 #include <vtkPlaneWidget.h>
39
40 #include <vtkCubeSource.h>
41 #include <vtkCylinderSource.h>
42 #include <vtkSphereSource.h>
43 #include <vtkProperty2D.h>
44 #include <vtkTextProperty.h>
45 #include <vtkXYPlotActor.h>
46
47
48 //#include "kernel/marInterface.h"
49 #include "manualContour.h"
50
51 #include "wxMPRBaseData.h"
52 #include "wxVtkBaseView.h"
53
54 #include <wx/notebook.h>
55 #include <wx/listbox.h>
56 #include <wx/tglbtn.h>
57 #include <wx/splitter.h>
58 #include "marTypes.h"
59
60 class wxMPRWidget;
61
62
63 //------------------------------------------------------------------
64 //------------------------------------------------------------------
65 //------------------------------------------------------------------
66
67 class vtkInteractorStyleSphere : public InteractorStyleMaracas
68 {
69 public:
70         vtkInteractorStyleSphere();
71         ~vtkInteractorStyleSphere();
72         virtual bool  OnLeftButtonUp(); 
73         virtual bool  OnLeftButtonDown(); 
74         virtual bool  OnMouseMove(); 
75         virtual bool  OnRightButtonUp();
76         virtual bool  OnRightButtonDown();
77
78 private:
79         bool    _stateRotate;
80         bool    _stateRadio;
81         int     _fordwareX;
82         int     _fordwareY;
83
84         double  _radio;
85 };
86
87
88
89
90
91
92 //------------------------------------------------------------------
93 //------------------------------------------------------------------
94 //------------------------------------------------------------------
95 class idAlBeRa
96 {
97 public:
98         int             _id;
99         double  _radio;
100         int             _deltavoxel;
101         idAlBeRa(int id, double radio,int deltavoxel);
102 };
103
104
105 //------------------------------------------------------------------
106 //------------------------------------------------------------------
107 //------------------------------------------------------------------
108
109 class wxSphereView : public wxVtk2DBaseView
110 {
111 public:
112         wxSphereView( wxWindow *parent, vtkMPRBaseData *vtkmprbasedata, vtkImageData *imageData);
113         ~wxSphereView();
114         virtual void Configure();
115         void RotationEnd();
116         void RotationStart(double vx, double vy, bool ok_v, bool ok_ang);
117         virtual void    RefreshView();
118         virtual void    SetVoxel(double i, double j, int delta, double id, unsigned short gris);
119                         void    SetDeltaVoxel(int delta);
120                         double  GetRadio();
121                         void    SetRadio(double radio);
122                         int             GetIdOfImage(double radio);
123                         void    SetXYZtoParent(double i, double j);
124                         void    RefreshPoint();
125
126 private:        
127         std::vector<idAlBeRa*> _lstId;
128
129         int                                                     _centerX;
130         int                                                     _centerY;
131         int                                                     _centerZ;
132         double                                          _radio;
133
134         double                                          _ang;
135         double                                          _vxb;
136         double                                          _vyb;
137
138         int                                                     _delta;
139
140         vtkImageData                            *_imageDataOriginal;
141         vtkImageData                            *_imageSphere;
142
143         vtkMPRBaseData                          *_vtkmprbasedata;
144         vtkInteractorStyleSphere        *_vtkinteractorstylesphere;
145
146         vtkTransform                            *_transform; 
147         vtkTransform                            *_transform1; 
148         vtkTransform                            *_transform2; 
149
150         void    FiltreImage(int id, double radio);
151         void    FiltreImageB(int id, double radio, bool ok,int deltaTMP);
152         void    DefineImageSphere();
153         void    ResetlstId();
154
155         void    InitSphere(double points[4][3]);
156         double  SphereFindCenter(double P[4][3], double cc[3]);
157         double  determinant(double a[4][4], int n);
158
159         void    GetPointSphere(double p[3],double r1,double angA,double angB);
160         void    RotatePointOverTheSphere( double pp[3], double p[3],double cc[3]);
161         void    TransferePoints(double pp1[3],double pp2[3],double AngX,double AngY,vtkImageData *image);
162 };
163
164 //-------------------------------------------------------------------
165 //-------------------------------------------------------------------
166 //-------------------------------------------------------------------
167
168 class vtkInteractorStylePlane2D;
169 class vtkInfoTextImageInteractorPlane2D;
170
171 class vtkPlane2DView : public wxVtk2DBaseView
172 {
173 public:
174         vtkPlane2DView(wxWindow *parent);
175         ~vtkPlane2DView();
176         void                    Configure();
177         void                    ExtractPlane();
178         int                             GetImgSize();
179         void                    SetImgSize( int imgSize );
180
181         void                    RotationStart();
182         void                    RotationDrag(double vx, double vy,  bool ok_v, bool ok_ang);
183
184         virtual int             GetActualSlice(); 
185         virtual void    SetActualSlice(int slice);
186
187         virtual void    Refresh( );
188
189         vtkMPRBaseData                          *GetVtkmprbasedata();
190         vtkInteractorStylePlane2D       *GetInteractorstyleplane2D();
191
192         void                    SetActive(bool active);
193         void                    SetVisibleLine(bool ok);
194
195         void                    TransfromeCoordViewWorld2(double &X, double &Y, double &Z);
196
197         int                             GetMipWidth();
198         void                    SetMipWidth(int value);
199         bool                    GetMipVisualization();
200         void                    SetMipVisualization(bool ok);
201
202         void                    ResetBack();
203
204 private:
205         bool                    _active;
206         int                             _mip_width;
207         bool                    _mip_visualization;
208
209         double                  _backX;
210         double                  _backY;
211         double                  _backZ;
212         double                  _backOrient[4];
213
214         double                  _ang;
215         double                  _vxb;
216         double                  _vyb;
217         double                  _n[3];   // Normal
218
219         double                  _cx;
220         double                  _cy;
221         double                  _cz;
222
223         int                             _sizeIma;
224
225         vtkImageData *  _imageResult;
226
227         // Horizontal line
228         vtkPoints                                                       *_pts;
229         vtkActor                                                        *_lineActor;
230         vtkPolyDataMapper                                       *_lineMapper;
231     vtkPolyData                                                 *_pd;
232
233     vtkProbeFilter                                              *_3Dslices;
234         vtkPlaneSource                                          *_pSource;
235         vtkStructuredPoints                                     *_stPoints;
236     vtkImageChangeInformation                   *_change;
237         vtkTransform                                            *_transform1; 
238         vtkTransform                                            *_transform2; 
239
240         vtkInteractorStylePlane2D                       *_interactorstyleplane2D;
241
242         vtkInfoTextImage                                        *_vtkInfoTextImage;
243         vtkInfoTextImageInteractorPlane2D       *_vtkInfoTextImageInteractorPlane2D;
244
245
246         void SetPSource(int sizeIma);
247         void HorizontalLine();
248         void ResetPlane();
249         void Extract_One_PlaneVTK();
250         void Extract_MIP_PlaneVTK();
251
252 protected:
253 };
254
255
256 //------------------------------------------------------------------
257 //------------------------------------------------------------------
258 //------------------------------------------------------------------
259
260 class vtkInfoTextImageInteractorPlane2D : public vtkInfoTextImageInteractor{
261 public:
262         vtkInfoTextImageInteractorPlane2D();
263         ~vtkInfoTextImageInteractorPlane2D();
264
265 protected:
266
267         virtual bool  OnMouseMove();
268
269 private:
270 };
271
272
273 //------------------------------------------------------------------
274 //------------------------------------------------------------------
275 //------------------------------------------------------------------
276
277 class vtkInteractorStylePlane2D : public InteractorStyleMaracas 
278 {
279 public:
280         vtkInteractorStylePlane2D();
281         ~vtkInteractorStylePlane2D();
282         virtual bool  OnLeftButtonDown(); 
283         virtual bool  OnLeftButtonUp();
284         virtual bool  OnMouseMove(); 
285         virtual bool  OnRightButtonUp();
286         virtual bool  OnLeftDClick();
287                         bool  GetStateRotate();
288
289 private:
290         bool    _stateRotate;
291
292         int     _fordwareX;
293         int     _fordwareY;
294 };
295
296
297
298 // ----------------------------------------------------------------------------
299 // ----------------------------------------------------------------------------
300 // ----------------------------------------------------------------------------
301
302 class manualViewPerpPlaneContour : public manualViewContour
303 {
304 public:
305         manualViewPerpPlaneContour();
306         ~manualViewPerpPlaneContour();
307         virtual manualViewPerpPlaneContour * Clone();
308         void CopyAttributesTo( manualViewPerpPlaneContour *cloneObject );
309
310         virtual void UpdateViewPoint(int id);
311         virtual void RefreshContour();
312         virtual void TransfromeCoordViewWorld( double &X,double &Y,double &Z,int type );
313         virtual bool ifTouchContour( int x, int y, int z);
314
315 protected:
316 private:
317         void FilterCordinateXYZ (double &x, double &y, double &z);
318 };
319
320
321
322 //------------------------------------------------------------------
323 //------------------------------------------------------------------
324 //------------------------------------------------------------------
325                                 
326 class vtkInteractorStyleMPRView;
327         
328 class MARACASVISULIB_EXPORTS wxVtkMPR2DView :  public wxVtk2DBaseView
329 {
330 public:
331         wxVtkMPR2DView( wxWindow *parent, int direction );
332         ~wxVtkMPR2DView();
333         void Configure();
334         virtual void                    Refresh();
335                         vtkMPRBaseData  *GetVtkmprbasedata();
336         virtual int                             GetActualSlice();
337         virtual void                    SetActualSlice(int slice);
338
339                         bool                    IfMouseTouchX(double x, double y, double z);
340                         bool                    IfMouseTouchY(double x, double y, double z);
341                         bool                    IfMouseTouchZ(double x, double y, double z);
342                         void                    MoveX(double x, double y, double z);
343                         void                    MoveY(double x, double y, double z);
344                         void                    MoveZ(double x, double y, double z);
345                         void                    ChangeAxisColor(double x, double y, double z);
346         virtual void                    TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type);
347                         void                    SetVisibleAxis(bool ok);
348
349
350 private:
351
352         int                                                     _backX;
353         int                                                     _backY;
354         int                                                     _backZ;
355
356         bool                                            _visibleAxis;
357
358         int                                                     _direction;
359         vtkPoints                                       *_ptsA;
360         vtkActor                                        *_lineAActor;
361         vtkPolyDataMapper                       *_lineAMapper;
362     vtkPolyData                                 *_pdA;
363         vtkPoints                                       *_ptsB;
364         vtkActor                                        *_lineBActor;
365         vtkPolyDataMapper                       *_lineBMapper;
366     vtkPolyData                                 *_pdB;
367 //      vtkInteractorStyle2DMaracas     *_interactorStyle2DMaracas; 
368         vtkInteractorStyleMPRView       *_interactorstylemprview;
369 };
370
371
372
373
374 //------------------------------------------------------------------
375 //------------------------------------------------------------------
376 //------------------------------------------------------------------
377
378 class vtkInteractorStyleMPRView : public InteractorStyleMaracas
379 {
380 public:
381         vtkInteractorStyleMPRView();
382         ~vtkInteractorStyleMPRView();
383
384         virtual bool  OnMouseMove();
385         virtual bool  OnLeftButtonDown(); 
386         virtual bool  OnLeftButtonUp();
387         virtual bool  OnLeftDClick();
388
389 protected:
390 /*EED Borrame
391                 double  _xBack;
392                 double  _yBack;
393 */
394                 bool    _stateMoveAxisX;
395                 bool    _stateMoveAxisY;
396                 bool    _stateMoveAxisZ;
397 };
398
399
400
401
402
403
404 //------------------------------------------------------------------
405 //------------------------------------------------------------------
406 //------------------------------------------------------------------
407 class wxVtkMPR3DView;
408
409 class wxVtkMPR3DViewCntrlPanel: public wxPanel
410 {
411 public:
412         wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DView *wxvtkmpr3Dview);
413         ~wxVtkMPR3DViewCntrlPanel();
414         void            OnVisibleAxisX(wxCommandEvent& event);
415         void            OnVisibleAxisY(wxCommandEvent& event);
416         void            OnVisibleAxisZ(wxCommandEvent& event);
417         void            OnPositionX(wxScrollEvent& event);
418         void            OnPositionY(wxScrollEvent& event);
419         void            OnPositionZ(wxScrollEvent& event);
420         void            OnVisibleAxisXYZ(wxCommandEvent& event);
421         void            OnVisiblePlane(wxCommandEvent& event);
422         void            OnEditColorTable(wxCommandEvent& event);
423         virtual void Refresh();
424
425 private:
426         wxVtkMPR3DView  *_wxvtkmpr3Dview;
427
428         wxSlider                *_opacity;
429         wxSlider                *_isoValue;
430         wxSlider                *_isoValueSpin;
431         wxStaticText    *_isoValueText;
432         wxRadioButton   *_surfA;
433         wxRadioButton   *_surfB;
434         wxRadioButton   *_surfC;
435         wxRadioButton   *_surfD;
436         wxCheckBox              *_visible;
437         wxButton                *_color;
438         wxSlider                *_positionX;
439         wxSlider                *_positionY;    
440         wxSlider                *_positionZ;
441
442         wxCheckBox              *_ckBoxXYZ;
443         wxCheckBox              *_ckBoxPlane;
444
445
446 protected:
447
448 };
449
450
451 //------------------------------------------------------------------
452 //------------------------------------------------------------------
453 //------------------------------------------------------------------
454 class wxVtkClipping3DView;
455
456
457
458 class wxVtkClipping3DViewCntrlPanel: public wxPanel
459 {
460 public:
461         wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview);
462         ~wxVtkClipping3DViewCntrlPanel();
463                         void    OnSurface(wxCommandEvent& event);
464                         void    OnRepresentationSurfaceWireFrame(wxCommandEvent& event);
465                         void    OnVisibleVolume(wxCommandEvent& event);
466                         void    OnVisibleBoxSurface(wxCommandEvent& event);
467                         void    OnVisibleBoxVolume(wxCommandEvent& event);
468                         void    OnColor(wxCommandEvent& event);
469                         void    OnVisibleSurface(wxCommandEvent& event);
470                         void    OnOpacity(wxScrollEvent& event);
471                         void    OnIsoValue(wxScrollEvent& event);
472                         void    OnIsoValueSpin(wxScrollEvent& event);
473         virtual void    Refresh();
474                         void    OnBtnCreateFileSTL(wxCommandEvent& event);
475                         void    OnBtnSaveRawVolume(wxCommandEvent& event);
476                         void    OnBtnVolumeFunctions(wxCommandEvent& event);
477                         void    OnBtnMeshVTKLoad(wxCommandEvent& event);
478
479
480 private:
481         wxVtkClipping3DView     *_wxvtkclipping3Dview;
482         wxSlider                        *_opacity;
483         wxSlider                        *_isoValue;
484         wxSlider                        *_isoValueSpin;
485         wxRadioButton           *_surfA;
486         wxRadioButton           *_surfB;
487         wxRadioButton           *_surfC;
488         wxRadioButton           *_surfD;
489         wxCheckBox                      *_visible;
490         wxButton                        *_color;
491
492         wxRadioButton           *_wireFrameRep;
493         wxRadioButton           *_surfaceRep;
494
495         int                             GetIdTissue();
496 protected:
497
498 };
499
500
501 //------------------------------------------------------------------
502 //------------------------------------------------------------------
503 //------------------------------------------------------------------
504
505
506 class vtkmyPWCallback_3DPointWidget : public vtkCommand
507 {
508 public:
509   static vtkmyPWCallback_3DPointWidget *New() 
510     { return new vtkmyPWCallback_3DPointWidget; }
511   virtual void Execute(vtkObject *caller, unsigned long, void*);
512   vtkmyPWCallback_3DPointWidget(){}
513   void SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
514   void SetVtkPointWidget( vtkPointWidget *pointWidget );
515   void SetVtkPlaneWidget( vtkPlaneWidget *planeWidget );
516 private:
517
518         double                                                  _backNormal[3];
519         vtkPlaneWidget                                  *_planeWidget;
520         vtkPointWidget                                  *_pointWidget;
521         wxVtkMPR3DView *_wxvtkmpr3Dview;
522 };
523
524
525 //------------------------------------------------------------------
526 //------------------------------------------------------------------
527 //------------------------------------------------------------------
528
529 class MARACASVISULIB_EXPORTS wxVtkMPR3DView
530 {
531 public:
532         wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview );
533         virtual ~wxVtkMPR3DView();
534         void                            VisibleImageActor(int idPosition, bool visible);
535         void                            VisiblePointWidget( bool visible );
536         void                            VisiblePlaneWidget( bool visible );
537
538         void                            SetVisibleTissue(int idTissue, bool visible);
539         bool                            GetVisibleTissue(int idTissue);
540         virtual void            Refresh();
541         virtual void            RefreshView();
542         virtual void            Configure();
543         void                            SetVtkMPR3DDataViewer( vtkMPR3DDataViewer *vtkmpr3Ddataviewer );
544         wxPanel*                        CreateControlPanel(wxWindow *parent);
545
546         vtkMPR3DDataViewer* GetVtkMPR3DDataViewer();
547         wxVtk3DBaseView*        GetWxvtk3Dbaseview();
548
549         void                            InitOrientationPointWidget(); 
550
551         // EED 25 Janvier 2007 testLoic
552         void                            TestLoic1();
553         void                            TestLoic2();
554
555
556 private:
557         wxVtk3DBaseView                                 *_wxvtk3Dbaseview;
558         vtkMPR3DDataViewer                              *_vtkmpr3Ddataviewer;
559         wxVtkMPR3DViewCntrlPanel                *_wxvtkmpr3DviewCntrlPanel;
560
561         // Plane Widget (3D)
562         vtkPolyData                                             *_vtkplane;
563         vtkActor                                                *_contourPlaneActor;
564         vtkPlaneWidget                                  *_planeWidget;
565
566         // Point Widget (3D)
567         vtkPointWidget                                  *_pointWidget;
568         vtkmyPWCallback_3DPointWidget   *_myCallback;
569
570 protected:
571 };
572
573
574
575
576 //------------------------------------------------------------------
577 //------------------------------------------------------------------
578 //------------------------------------------------------------------
579
580 class wxVtkClipping3DView
581 {
582 public:
583         wxVtkClipping3DView( wxVtk3DBaseView* wxvtk3Dbaseview );
584         virtual ~wxVtkClipping3DView();
585         virtual void                            Refresh();
586         virtual void                            Configure();
587         void                                            SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
588         wxPanel*                                        CreateControlPanel(wxWindow *parent);
589         vtkClipping3DDataViewer*        GetVtkClipping3DDataViewer();
590
591         void                                            VisibleActor(int idTissue, bool visTissue);
592         void                                            VisibleVolumeActor( bool visVolume );
593         void                                            SetVisibleBoxSurface(bool visible);
594         void                                            SetVisibleBoxVolume(bool visible);
595         void                                            SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
596
597         wxVtk3DBaseView*                        GetWxvtk3Dbaseview();
598
599 private:
600         wxVtk3DBaseView                                 *_wxvtk3Dbaseview;
601         vtkClipping3DDataViewer                 *_vtkclipping3Ddataviewer;
602         vtkBoxWidget                                    *_boxWidgetS1;
603         vtkBoxWidget                                    *_boxWidgetVolume;
604         wxVtkClipping3DViewCntrlPanel   *_wxvtkclipping3DviewCntrlPanel;
605 protected:
606 };
607
608
609
610 //------------------------------------------------------------------
611 //------------------------------------------------------------------
612 //------------------------------------------------------------------
613
614 class vtkInteractorStyle3DView : public InteractorStyleMaracas
615 {
616 public:
617         vtkInteractorStyle3DView();
618         ~vtkInteractorStyle3DView();
619
620         virtual bool                    OnLeftDClick();
621         bool                                    SelectMarchibCubePoint();
622
623
624         wxVtkMPR3DView                  *GetWxVtkMPR3DView();
625         void                                    SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
626
627         wxVtkClipping3DView             *GetWxVtkClipping3DView();
628         void                                    SetWxVtkClipping3DView( wxVtkClipping3DView *wxvtkclipping3Dview);
629
630 protected:
631 private:
632         wxVtkMPR3DView                  *_wxvtkmpr3Dview;
633         wxVtkClipping3DView             *_wxvtkclipping3Dview;
634 };
635
636
637 //------------------------------------------------------------------
638 //------------------------------------------------------------------
639 //------------------------------------------------------------------
640
641 class figureCuttingModel
642 {
643 public:
644         figureCuttingModel();
645         virtual ~figureCuttingModel();
646
647         void                    SetPosition(double x,double y, double z);
648         double                  GetPositionX();
649         double                  GetPositionY();
650         double                  GetPositionZ();
651
652         void                    SetScale(double sx,double sy, double sz);
653         double                  GetScaleX();
654         double                  GetScaleY();
655         double                  GetScaleZ();
656
657         void                    SetRotation(double alfa,double beta, double teta);
658         double                  GetAngleAlfa();
659         double                  GetAngleBeta();
660         double                  GetAngleTeta();
661
662         void                    SetSpacing(double spcX,double spcY, double spcZ);
663
664         void                    CalculeMatrix();
665         void                    CalculeInversMatrix();
666         virtual bool    IfPointInside(double x, double y, double z);
667         vtkTransform    *GetVtkTransform();
668 //      void                    SetVtkTransform(vtkTransform *matrix);
669         virtual double  GetTheoricVolume();
670         virtual                 char *GetName();
671
672 private:
673         double                  _px;
674         double                  _py;
675         double                  _pz;
676         double                  _alfa;
677         double                  _beta;
678         double                  _teta;
679         double                  _spcX;
680         double                  _spcY;
681         double                  _spcZ;
682 protected:
683         double                  _sx;
684         double                  _sy;
685         double                  _sz;
686         vtkTransform    *_inversModel;
687         vtkTransform    *_matrixModel;
688         vtkTransform    *_matrixVisual;
689
690 };
691
692
693
694 //------------------------------------------------------------------
695 //------------------------------------------------------------------
696 //------------------------------------------------------------------
697
698
699 class figureCuttingSphereModel : public figureCuttingModel
700 {
701 public:
702         figureCuttingSphereModel();
703         virtual ~figureCuttingSphereModel();
704         virtual bool IfPointInside(double x, double y, double z);
705         virtual double  GetTheoricVolume();
706         virtual char *GetName();
707 private:
708 protected:
709 };
710
711 //------------------------------------------------------------------
712 //------------------------------------------------------------------
713 //------------------------------------------------------------------
714
715 class figureCuttingCubeModel : public figureCuttingModel
716 {
717 public:
718         figureCuttingCubeModel();
719         virtual ~figureCuttingCubeModel();
720         virtual bool    IfPointInside(double x, double y, double z);
721         virtual double  GetTheoricVolume();
722         virtual char *GetName();
723 private:
724 protected:
725 };
726
727 //------------------------------------------------------------------
728 //------------------------------------------------------------------
729 //------------------------------------------------------------------
730
731 class figureCuttingCylinderModel : public figureCuttingModel
732 {
733 public:
734         figureCuttingCylinderModel();
735         virtual ~figureCuttingCylinderModel();
736         virtual bool    IfPointInside(double x, double y, double z);
737         virtual double  GetTheoricVolume();
738         virtual char *GetName();
739 private:
740 protected:
741 };
742
743
744 //------------------------------------------------------------------
745 //------------------------------------------------------------------
746 //------------------------------------------------------------------
747
748 class wxPanelCuttingImageData : public wxPanel
749 {
750 public:
751         wxPanelCuttingImageData (wxWindow *parent);
752         ~wxPanelCuttingImageData ();
753         void OnTransform(wxScrollEvent& event);
754         void OnOpacityFig(wxScrollEvent& event);
755         void OnTypeFig(wxCommandEvent& event);
756         void OnExtract(wxCommandEvent& event);
757         void SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata );
758         void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
759         void SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview );
760
761         void SetParamsOfTransformation( );
762         void Configure();
763         void Refresh();
764         void RefreshView();
765         void RemoveActors();
766
767
768 private:
769         wxSlider                                                *_opacityFig;
770         wxSlider                                                *_scaleX;
771         wxSlider                                                *_scaleY;
772         wxSlider                                                *_scaleZ;
773         wxSlider                                                *_rotationX;
774         wxSlider                                                *_rotationY;
775         wxSlider                                                *_rotationZ;
776         
777         wxRadioButton                                   *_volIntern;
778         wxRadioButton                                   *_volExtern;
779         wxCheckBox                                              *_histogrammeAccumulated;
780         wxSlider                                                *_isoValue;
781         wxSlider                                                *_valueBeforeIsoValue;
782         wxSlider                                                *_valueAfterIsoValue;
783         wxChoice                                                *_typeFig;
784
785         wxStaticText                                    *_infoToVo;
786         wxStaticText                                    *_infoSuVo;
787         wxStaticText                                    *_infoSuVoA;
788         wxStaticText                                    *_infoPixLe;
789         wxStaticText                                    *_infoPixHi;
790
791         // Model
792         figureCuttingCylinderModel              *_modelCylinder;
793         figureCuttingCubeModel                  *_modelCube;
794         figureCuttingSphereModel                *_modelSphere;
795         figureCuttingModel                              *_actualCuttingModel;
796
797         // view
798         vtkCubeSource                                   *_vtkcube;
799         vtkSphereSource                                 *_vtksphere;
800         vtkCylinderSource                               *_vtkcylinder;
801         vtkPolyDataMapper                               *_cubeMapper;
802         vtkPolyDataMapper                               *_sphereMapper;
803         vtkPolyDataMapper                               *_cylinderMapper;
804         vtkActor                                                *_cubeActor;
805         vtkActor                                                *_sphereActor;
806         vtkActor                                                *_cylinderActor;
807         vtkActor                                                *_actualActor;
808
809
810         vtkMPRBaseData                                  *_vtkmprbasedata;
811         wxVtk3DBaseView                                 *_wxvtk3Dbaseview;
812         vtkImageData                                    *_imageData;
813         vtkClipping3DDataViewer                 *_vtkclipping3Ddataviewer;
814
815         vtkImageData                                    *_histogrammeVector;
816         vtkXYPlotActor                                  *_xyplot;
817         wxVtkBaseView                                   *_wxvtkbaseView;
818
819         void    CreateModel();
820         void    CreateInterface();
821         void    Create3DViewObjects();
822         void    RefreshOpacity();
823         wxWindow *CreatePlotHistogrammeInterface();
824         void    InitHistogramme();
825
826
827 protected:
828 };
829
830 //------------------------------------------------------------------
831 //------------------------------------------------------------------
832 //------------------------------------------------------------------
833
834 class wxWidgetMesure2D : public wxSplitterWindow
835 {
836 public: 
837         wxWidgetMesure2D( wxWindow *parent );
838         ~wxWidgetMesure2D();
839
840         void OnActiveMessureTool(wxCommandEvent& event);
841         void OnVisibleMessureTool(wxCommandEvent& event);
842         void OnCloseContour(wxCommandEvent& event);
843         void OnVisibleInformation(wxCommandEvent& event);
844
845         void SetMesureScale(double mesureScale);
846
847         manualContourModel*     GetManualContourModel();
848         virtual void ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
849
850 protected:
851         wxVtk2DBaseView                 *_wxvtk2Dbaseview;
852         virtual wxWindow                *CreateWin1a(wxWindow *parent);
853 private:
854         wxCheckBox                              *_cb_messuretool; 
855         wxCheckBox                              *_cb_mt_visible; 
856         wxCheckBox                              *_cb_closeContour; 
857         wxCheckBox                              *_cb_visibleText; 
858
859         manualContourControler  *_manContourControl_1;
860         manualContourModel              *_mContourModel_1;
861         manualViewContour               *_mViewContour_1;
862
863         void    ActiveMessureTool(bool ok);
864
865 //      DECLARE_EVENT_TABLE();
866 };
867
868 //------------------------------------------------------------------
869 //------------------------------------------------------------------
870 //------------------------------------------------------------------
871
872 class wxWidgetMesure2D_Plane : public wxWidgetMesure2D
873 {
874 public:
875          wxWidgetMesure2D_Plane(wxWindow *parent);
876          ~wxWidgetMesure2D_Plane();
877         void                    OnActiveLine(wxCommandEvent& event);
878         void                    OnActiveCirlcle(wxCommandEvent& event);
879         virtual void    ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
880         void                    ConfigureCircleLine();
881         void                    CircleLine();
882
883 protected:
884         virtual wxWindow                *CreateWin1a(wxWindow *parent);
885 private:
886         wxCheckBox                              *_cb_line; 
887         wxCheckBox                              *_cb_circle; 
888
889         // Circle 1
890         vtkPoints                                       *_ptsCircle1;
891         vtkActor                                        *_circle1Actor;
892         vtkPolyDataMapper                       *_circle1Mapper;
893     vtkPolyData                                 *_pdCircle1;
894         // Circle 2
895         vtkPoints                                       *_ptsCircle2;
896         vtkActor                                        *_circle2Actor;
897         vtkPolyDataMapper                       *_circle2Mapper;
898     vtkPolyData                                 *_pdCircle2;
899         // line reference 1
900         vtkPoints                                       *_ptsLineRef1;
901         vtkActor                                        *_lineRef1Actor;
902         vtkPolyDataMapper                       *_lineRef1Mapper;
903     vtkPolyData                                 *_pdLineRef1;
904         // line reference 2
905         vtkPoints                                       *_ptsLineRef2;
906         vtkActor                                        *_lineRef2Actor;
907         vtkPolyDataMapper                       *_lineRef2Mapper;
908     vtkPolyData                                 *_pdLineRef2;
909
910         void SetVisibleCircle( bool ok );
911
912 };
913
914 //------------------------------------------------------------------
915 //------------------------------------------------------------------
916 //------------------------------------------------------------------
917
918
919 class wxWidgetMesure2D_Plane_in_MPR : public wxWidgetMesure2D_Plane
920 {
921 public:
922          wxWidgetMesure2D_Plane_in_MPR(wxWindow *parent);
923          ~wxWidgetMesure2D_Plane_in_MPR();
924         void OnActiveLink(wxCommandEvent& event);
925         void SetVtkPlane2DView(vtkPlane2DView *vtkplane2Dview);
926         void SetActiveLink(bool ok);
927
928 protected:
929         virtual wxWindow                *CreateWin1a(wxWindow *parent);
930 private:
931         wxCheckBox                              *_cb_link; 
932         vtkPlane2DView                  *_vtkplane2Dview;
933 };
934
935
936 //------------------------------------------------------------------
937 //------------------------------------------------------------------
938 //------------------------------------------------------------------
939
940
941
942 class MARACASVISULIB_EXPORTS wxMPRWidget : public wxPanel
943 {
944 public:
945     wxMPRWidget(wxWindow* parent,marImageData *marimageData,double voxelSize);
946         ~wxMPRWidget( );
947         void ConfigureVTK();
948
949         virtual void OnRefreshView(wxCommandEvent & event);
950         void OnDClickLeft(wxCommandEvent & event);
951
952         void OnPageAChanged(wxNotebookEvent & event);
953         void OnPageBChanged(wxNotebookEvent & event);
954
955         vtkMPRBaseData  *GetVtkMPRBaseData();
956         vtkPlane2DView  *GetVtkPlane2DView();
957         
958         //returns the 3d view of the widget
959         wxVtkMPR3DView  *GetWxvtkmpr3Dview_BB();
960
961         void    RefreshView(bool firsttime=false);
962
963         wxVtkBaseView *GetWxVtkBaseView(int page, int id);
964
965         //returns the 2d view of the specific direction (0|1|2)
966         wxVtkMPR2DView *GetWxvtkMPR2Dview(int direction);
967
968 private:
969         double                                  _voxelSize;
970         marImageData                    *_marImageData; 
971         vtkMPRBaseData                  *_vtkmprbasedata; 
972         wxVtkMPR2DView                  *_vtkmpr2Dview[3]; 
973         vtkPlane2DView                  *_vtkplane2Dview;
974         wxSphereView                    *_wxsphereview;
975         wxVtkMPR2DView                  *_vtkmpr2Dview_B[3]; 
976         vtkPlane2DView                  *_vtkplane2Dview_B;
977         wxSphereView                    *_wxsphereview_B;
978
979         wxVtk3DBaseView                 *_wxvtk3Dbaseview_MPRClipping3D;
980         wxVtkMPR3DView                  *_wxvtkmpr3Dview;
981         wxVtkClipping3DView             *_wxvtkclipping3Dview;
982
983         wxVtk3DBaseView                 *_wxvtk3Dbaseview_MPR3D_B;
984         wxVtkMPR3DView                  *_wxvtkmpr3Dview_B;
985
986         wxVtk3DBaseView                 *_wxvtk3Dbaseview_Clipping3D_BB;
987         wxVtkMPR3DView                  *_wxvtkmpr3Dview_BB;
988         wxVtkClipping3DView             *_wxvtkclipping3Dview_BB;
989
990         int                                             _refreshAPage;
991         int                                             _refreshBPage;
992
993
994         wxFrame                                 *_framePanelCutting;
995         wxCheckBox                              *_btnCutImageData;
996         wxPanelCuttingImageData *_panelCutting;
997
998         wxWidgetMesure2D_Plane_in_MPR   *_widgetMesure;
999         wxWidgetMesure2D_Plane_in_MPR   *_widgetMesure_B;
1000
1001         wxPanel *CreateControlPanel(wxWindow *parent);
1002         wxPanel *CreateMPRPanel(wxWindow *parent, vtkMPRBaseData *vtkmprbasedata);
1003         wxPanel *CreateMPRPanel4View(wxWindow *parent, vtkMPRBaseData *vtkmprbasedata);
1004         wxPanel *CreateView(int type,wxWindow *parent, vtkMPRBaseData *vtkmprbasedata);
1005
1006         void    OnCutImagaData( wxCommandEvent &event);
1007
1008         DECLARE_EVENT_TABLE( );
1009 };
1010
1011
1012 class MARACASVISULIB_EXPORTS wxMPRWidget2 : public wxMPRWidget
1013 {
1014 public:
1015         wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize);
1016         ~wxMPRWidget2();
1017         virtual void OnRefreshView(wxCommandEvent & event);
1018 private:
1019 protected:
1020 };
1021
1022
1023
1024
1025 #endif // __WX__MPR__WIDGET__HXX__
1026
1027
1028
1029 // EOF - wxMPRWidget.h