]> 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: 2009/05/04 07:35:42 $
7   Version:   $Revision: 1.8 $
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 creaMaracasVisu_EXPORT 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         void            UpdateControlPanel();
425
426 private:
427         wxVtkMPR3DView  *_wxvtkmpr3Dview;
428
429         wxSlider                *_opacity;
430         wxSlider                *_isoValue;
431         wxSlider                *_isoValueSpin;
432         wxStaticText    *_isoValueText;
433         wxRadioButton   *_surfA;
434         wxRadioButton   *_surfB;
435         wxRadioButton   *_surfC;
436         wxRadioButton   *_surfD;
437         wxCheckBox              *_visible;
438         wxButton                *_color;
439         wxSlider                *_positionX;
440         wxSlider                *_positionY;    
441         wxSlider                *_positionZ;
442
443         wxCheckBox              *_ckBoxXYZ;
444         wxCheckBox              *_ckBoxPlane;
445
446
447 protected:
448
449 };
450
451
452 //------------------------------------------------------------------
453 //------------------------------------------------------------------
454 //------------------------------------------------------------------
455 class wxVtkClipping3DView;
456
457
458
459 class wxVtkClipping3DViewCntrlPanel: public wxPanel
460 {
461 public:
462         wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview);
463         ~wxVtkClipping3DViewCntrlPanel();
464                         void    OnSurface(wxCommandEvent& event);
465                         void    OnRepresentationSurfaceWireFrame(wxCommandEvent& event);
466                         void    OnVisibleVolume(wxCommandEvent& event);
467                         void    OnVisibleBoxSurface(wxCommandEvent& event);
468                         void    OnVisibleBoxVolume(wxCommandEvent& event);
469                         void    OnColor(wxCommandEvent& event);
470                         void    OnVisibleSurface(wxCommandEvent& event);
471                         void    OnOpacity(wxScrollEvent& event);
472                         void    OnIsoValue(wxScrollEvent& event);
473                         void    OnIsoValueSpin(wxScrollEvent& event);
474         virtual void    Refresh();
475                         void    OnBtnCreateFileSTL(wxCommandEvent& event);
476                         void    OnBtnSaveRawVolume(wxCommandEvent& event);
477                         void    OnBtnVolumeFunctions(wxCommandEvent& event);
478                         void    OnBtnMeshVTKLoad(wxCommandEvent& event);
479
480
481 private:
482         wxVtkClipping3DView     *_wxvtkclipping3Dview;
483         wxSlider                        *_opacity;
484         wxSlider                        *_isoValue;
485         wxSlider                        *_isoValueSpin;
486         wxRadioButton           *_surfA;
487         wxRadioButton           *_surfB;
488         wxRadioButton           *_surfC;
489         wxRadioButton           *_surfD;
490         wxCheckBox                      *_visible;
491         wxButton                        *_color;
492
493         wxRadioButton           *_wireFrameRep;
494         wxRadioButton           *_surfaceRep;
495
496         int                             GetIdTissue();
497 protected:
498
499 };
500
501
502 //------------------------------------------------------------------
503 //------------------------------------------------------------------
504 //------------------------------------------------------------------
505
506
507 class vtkmyPWCallback_3DPointWidget : public vtkCommand
508 {
509 public:
510   static vtkmyPWCallback_3DPointWidget *New() 
511     { return new vtkmyPWCallback_3DPointWidget; }
512   virtual void Execute(vtkObject *caller, unsigned long, void*);
513   vtkmyPWCallback_3DPointWidget(){}
514   void SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
515   void SetVtkPointWidget( vtkPointWidget *pointWidget );
516   void SetVtkPlaneWidget( vtkPlaneWidget *planeWidget );
517 private:
518
519         double                                                  _backNormal[3];
520         vtkPlaneWidget                                  *_planeWidget;
521         vtkPointWidget                                  *_pointWidget;
522         wxVtkMPR3DView *_wxvtkmpr3Dview;
523 };
524
525
526 //------------------------------------------------------------------
527 //------------------------------------------------------------------
528 //------------------------------------------------------------------
529
530 class creaMaracasVisu_EXPORT wxVtkMPR3DView
531 {
532 public:
533         wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview );
534         virtual ~wxVtkMPR3DView();      
535         void                            VisibleImageActor(int idPosition, bool visible);
536         void                            VisiblePointWidget( bool visible );
537         void                            VisiblePlaneWidget( bool visible );
538
539         void                            SetVisibleTissue(int idTissue, bool visible);
540         bool                            GetVisibleTissue(int idTissue);
541         virtual void            Refresh();
542         virtual void            RefreshView();
543         virtual void            Configure();
544         void                            SetVtkMPR3DDataViewer( vtkMPR3DDataViewer *vtkmpr3Ddataviewer );
545         wxPanel*                        CreateControlPanel(wxWindow *parent);
546
547         vtkMPR3DDataViewer* GetVtkMPR3DDataViewer()throw (char*);
548         wxVtk3DBaseView*        GetWxvtk3Dbaseview();
549
550         void                            InitOrientationPointWidget(); 
551
552         // EED 25 Janvier 2007 testLoic
553         void                            TestLoic1();
554         void                            TestLoic2();
555
556         void RemoveActor(vtkActor* actor);
557         void ResetCamera(int *ext=NULL, double* origin=NULL,double* spc=NULL);
558
559 private:
560         wxVtk3DBaseView                                 *_wxvtk3Dbaseview;
561         vtkMPR3DDataViewer                              *_vtkmpr3Ddataviewer;
562         wxVtkMPR3DViewCntrlPanel                *_wxvtkmpr3DviewCntrlPanel;
563
564         // Plane Widget (3D)
565         vtkPolyData                                             *_vtkplane;
566         vtkActor                                                *_contourPlaneActor;
567         vtkPlaneWidget                                  *_planeWidget;
568
569         // Point Widget (3D)
570         vtkPointWidget                                  *_pointWidget;
571         vtkmyPWCallback_3DPointWidget   *_myCallback;
572         vtkProbeFilter *_probe;
573         vtkPolyDataMapper *_contourMapper;
574
575         
576
577 protected:
578 };
579
580
581
582
583 //------------------------------------------------------------------
584 //------------------------------------------------------------------
585 //------------------------------------------------------------------
586
587 class wxVtkClipping3DView
588 {
589 public:
590         wxVtkClipping3DView( wxVtk3DBaseView* wxvtk3Dbaseview );
591         virtual ~wxVtkClipping3DView();
592         virtual void                            Refresh();
593         virtual void                            Configure();
594         void                                            SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
595         wxPanel*                                        CreateControlPanel(wxWindow *parent);
596         vtkClipping3DDataViewer*        GetVtkClipping3DDataViewer();
597
598         void                                            VisibleActor(int idTissue, bool visTissue);
599         void                                            VisibleVolumeActor( bool visVolume );
600         void                                            SetVisibleBoxSurface(bool visible);
601         void                                            SetVisibleBoxVolume(bool visible);
602         void                                            SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
603
604         wxVtk3DBaseView*                        GetWxvtk3Dbaseview()throw(char*);
605
606 private:
607         wxVtk3DBaseView                                 *_wxvtk3Dbaseview;
608         vtkClipping3DDataViewer                 *_vtkclipping3Ddataviewer;
609         vtkBoxWidget                                    *_boxWidgetS1;
610         vtkBoxWidget                                    *_boxWidgetVolume;
611         wxVtkClipping3DViewCntrlPanel   *_wxvtkclipping3DviewCntrlPanel;
612 protected:
613 };
614
615
616
617 //------------------------------------------------------------------
618 //------------------------------------------------------------------
619 //------------------------------------------------------------------
620
621 class vtkInteractorStyle3DView : public InteractorStyleMaracas
622 {
623 public:
624         vtkInteractorStyle3DView();
625         ~vtkInteractorStyle3DView();
626
627         virtual bool                    OnLeftDClick();
628         bool                                    SelectMarchibCubePoint();
629
630
631         wxVtkMPR3DView                  *GetWxVtkMPR3DView();
632         void                                    SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
633
634         wxVtkClipping3DView             *GetWxVtkClipping3DView();
635         void                                    SetWxVtkClipping3DView( wxVtkClipping3DView *wxvtkclipping3Dview);
636
637 protected:
638 private:
639         wxVtkMPR3DView                  *_wxvtkmpr3Dview;
640         wxVtkClipping3DView             *_wxvtkclipping3Dview;
641 };
642
643
644 //------------------------------------------------------------------
645 //------------------------------------------------------------------
646 //------------------------------------------------------------------
647
648 class figureCuttingModel
649 {
650 public:
651         figureCuttingModel();
652         virtual ~figureCuttingModel();
653
654         void                    SetPosition(double x,double y, double z);
655         double                  GetPositionX();
656         double                  GetPositionY();
657         double                  GetPositionZ();
658
659         void                    SetScale(double sx,double sy, double sz);
660         double                  GetScaleX();
661         double                  GetScaleY();
662         double                  GetScaleZ();
663
664         void                    SetRotation(double alfa,double beta, double teta);
665         double                  GetAngleAlfa();
666         double                  GetAngleBeta();
667         double                  GetAngleTeta();
668
669         void                    SetSpacing(double spcX,double spcY, double spcZ);
670
671         void                    CalculeMatrix();
672         void                    CalculeInversMatrix();
673         virtual bool    IfPointInside(double x, double y, double z);
674         vtkTransform    *GetVtkTransform();
675 //      void                    SetVtkTransform(vtkTransform *matrix);
676         virtual double  GetTheoricVolume();
677         virtual                 char *GetName();
678
679 private:
680         double                  _px;
681         double                  _py;
682         double                  _pz;
683         double                  _alfa;
684         double                  _beta;
685         double                  _teta;
686         double                  _spcX;
687         double                  _spcY;
688         double                  _spcZ;
689 protected:
690         double                  _sx;
691         double                  _sy;
692         double                  _sz;
693         vtkTransform    *_inversModel;
694         vtkTransform    *_matrixModel;
695         vtkTransform    *_matrixVisual;
696
697 };
698
699
700
701 //------------------------------------------------------------------
702 //------------------------------------------------------------------
703 //------------------------------------------------------------------
704
705
706 class figureCuttingSphereModel : public figureCuttingModel
707 {
708 public:
709         figureCuttingSphereModel();
710         virtual ~figureCuttingSphereModel();
711         virtual bool IfPointInside(double x, double y, double z);
712         virtual double  GetTheoricVolume();
713         virtual char *GetName();
714 private:
715 protected:
716 };
717
718 //------------------------------------------------------------------
719 //------------------------------------------------------------------
720 //------------------------------------------------------------------
721
722 class figureCuttingCubeModel : public figureCuttingModel
723 {
724 public:
725         figureCuttingCubeModel();
726         virtual ~figureCuttingCubeModel();
727         virtual bool    IfPointInside(double x, double y, double z);
728         virtual double  GetTheoricVolume();
729         virtual char *GetName();
730 private:
731 protected:
732 };
733
734 //------------------------------------------------------------------
735 //------------------------------------------------------------------
736 //------------------------------------------------------------------
737
738 class figureCuttingCylinderModel : public figureCuttingModel
739 {
740 public:
741         figureCuttingCylinderModel();
742         virtual ~figureCuttingCylinderModel();
743         virtual bool    IfPointInside(double x, double y, double z);
744         virtual double  GetTheoricVolume();
745         virtual char *GetName();
746 private:
747 protected:
748 };
749
750
751 //------------------------------------------------------------------
752 //------------------------------------------------------------------
753 //------------------------------------------------------------------
754
755 class wxPanelCuttingImageData : public wxPanel
756 {
757 public:
758         wxPanelCuttingImageData (wxWindow *parent);
759         ~wxPanelCuttingImageData ();
760         void OnTransform(wxScrollEvent& event);
761         void OnOpacityFig(wxScrollEvent& event);
762         void OnTypeFig(wxCommandEvent& event);
763         void OnExtract(wxCommandEvent& event);
764         void SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata );
765         void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
766         void SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview );
767
768         void SetParamsOfTransformation( );
769         void Configure();
770         void Refresh();
771         void RefreshView();
772         void RemoveActors();
773
774
775 private:
776         wxSlider                                                *_opacityFig;
777         wxSlider                                                *_scaleX;
778         wxSlider                                                *_scaleY;
779         wxSlider                                                *_scaleZ;
780         wxSlider                                                *_rotationX;
781         wxSlider                                                *_rotationY;
782         wxSlider                                                *_rotationZ;
783         
784         wxRadioButton                                   *_volIntern;
785         wxRadioButton                                   *_volExtern;
786         wxCheckBox                                              *_histogrammeAccumulated;
787         wxSlider                                                *_isoValue;
788         wxSlider                                                *_valueBeforeIsoValue;
789         wxSlider                                                *_valueAfterIsoValue;
790         wxChoice                                                *_typeFig;
791
792         wxStaticText                                    *_infoToVo;
793         wxStaticText                                    *_infoSuVo;
794         wxStaticText                                    *_infoSuVoA;
795         wxStaticText                                    *_infoPixLe;
796         wxStaticText                                    *_infoPixHi;
797
798         // Model
799         figureCuttingCylinderModel              *_modelCylinder;
800         figureCuttingCubeModel                  *_modelCube;
801         figureCuttingSphereModel                *_modelSphere;
802         figureCuttingModel                              *_actualCuttingModel;
803
804         // view
805         vtkCubeSource                                   *_vtkcube;
806         vtkSphereSource                                 *_vtksphere;
807         vtkCylinderSource                               *_vtkcylinder;
808         vtkPolyDataMapper                               *_cubeMapper;
809         vtkPolyDataMapper                               *_sphereMapper;
810         vtkPolyDataMapper                               *_cylinderMapper;
811         vtkActor                                                *_cubeActor;
812         vtkActor                                                *_sphereActor;
813         vtkActor                                                *_cylinderActor;
814         vtkActor                                                *_actualActor;
815
816
817         vtkMPRBaseData                                  *_vtkmprbasedata;
818         wxVtk3DBaseView                                 *_wxvtk3Dbaseview;
819         vtkImageData                                    *_imageData;
820         vtkClipping3DDataViewer                 *_vtkclipping3Ddataviewer;
821
822         vtkImageData                                    *_histogrammeVector;
823         vtkXYPlotActor                                  *_xyplot;
824         wxVtkBaseView                                   *_wxvtkbaseView;
825         vtkRenderer                                             *_renplotter;
826
827         void    CreateModel();
828         void    CreateInterface();
829         void    Create3DViewObjects();
830         void    RefreshOpacity();
831         wxWindow *CreatePlotHistogrammeInterface();
832         void    InitHistogramme();
833
834
835 protected:
836 };
837
838 //------------------------------------------------------------------
839 //------------------------------------------------------------------
840 //------------------------------------------------------------------
841
842 class wxWidgetMesure2D : public wxSplitterWindow
843 {
844 public: 
845         wxWidgetMesure2D( wxWindow *parent );
846         ~wxWidgetMesure2D();
847
848         void OnActiveMessureTool(wxCommandEvent& event);
849         void OnVisibleMessureTool(wxCommandEvent& event);
850         void OnCloseContour(wxCommandEvent& event);
851         void OnVisibleInformation(wxCommandEvent& event);
852
853         void SetMesureScale(double mesureScale);
854
855         manualContourModel*     GetManualContourModel();
856         virtual void ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
857
858 protected:
859         wxVtk2DBaseView                 *_wxvtk2Dbaseview;
860         virtual wxWindow                *CreateWin1a(wxWindow *parent);
861 private:
862         wxCheckBox                              *_cb_messuretool; 
863         wxCheckBox                              *_cb_mt_visible; 
864         wxCheckBox                              *_cb_closeContour; 
865         wxCheckBox                              *_cb_visibleText; 
866
867         manualContourControler  *_manContourControl_1;
868         manualContourModel              *_mContourModel_1;
869         manualViewContour               *_mViewContour_1;
870
871         void    ActiveMessureTool(bool ok);
872
873 //      DECLARE_EVENT_TABLE();
874 };
875
876 //------------------------------------------------------------------
877 //------------------------------------------------------------------
878 //------------------------------------------------------------------
879
880 class wxWidgetMesure2D_Plane : public wxWidgetMesure2D
881 {
882 public:
883          wxWidgetMesure2D_Plane(wxWindow *parent);
884          ~wxWidgetMesure2D_Plane();
885         void                    OnActiveLine(wxCommandEvent& event);
886         void                    OnActiveCirlcle(wxCommandEvent& event);
887         virtual void    ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
888         void                    ConfigureCircleLine();
889         void                    CircleLine();
890
891 protected:
892         virtual wxWindow                *CreateWin1a(wxWindow *parent);
893 private:
894         wxCheckBox                              *_cb_line; 
895         wxCheckBox                              *_cb_circle; 
896
897         // Circle 1
898         vtkPoints                                       *_ptsCircle1;
899         vtkActor                                        *_circle1Actor;
900         vtkPolyDataMapper                       *_circle1Mapper;
901     vtkPolyData                                 *_pdCircle1;
902         // Circle 2
903         vtkPoints                                       *_ptsCircle2;
904         vtkActor                                        *_circle2Actor;
905         vtkPolyDataMapper                       *_circle2Mapper;
906     vtkPolyData                                 *_pdCircle2;
907         // line reference 1
908         vtkPoints                                       *_ptsLineRef1;
909         vtkActor                                        *_lineRef1Actor;
910         vtkPolyDataMapper                       *_lineRef1Mapper;
911     vtkPolyData                                 *_pdLineRef1;
912         // line reference 2
913         vtkPoints                                       *_ptsLineRef2;
914         vtkActor                                        *_lineRef2Actor;
915         vtkPolyDataMapper                       *_lineRef2Mapper;
916     vtkPolyData                                 *_pdLineRef2;
917
918         void SetVisibleCircle( bool ok );
919
920 };
921
922 //------------------------------------------------------------------
923 //------------------------------------------------------------------
924 //------------------------------------------------------------------
925
926
927 class wxWidgetMesure2D_Plane_in_MPR : public wxWidgetMesure2D_Plane
928 {
929 public:
930          wxWidgetMesure2D_Plane_in_MPR(wxWindow *parent);
931          ~wxWidgetMesure2D_Plane_in_MPR();
932         void OnActiveLink(wxCommandEvent& event);
933         void SetVtkPlane2DView(vtkPlane2DView *vtkplane2Dview);
934         void SetActiveLink(bool ok);
935
936 protected:
937         virtual wxWindow                *CreateWin1a(wxWindow *parent);
938 private:
939         wxCheckBox                              *_cb_link; 
940         vtkPlane2DView                  *_vtkplane2Dview;
941 };
942
943
944 //------------------------------------------------------------------
945 //------------------------------------------------------------------
946 //------------------------------------------------------------------
947
948
949
950 class creaMaracasVisu_EXPORT wxMPRWidget : public wxPanel
951 {
952 public:
953     wxMPRWidget(wxWindow* parent,marImageData *marimageData = NULL,double voxelSize = -1);
954         ~wxMPRWidget( );
955         void ConfigureVTK();
956
957         virtual void OnRefreshView(wxCommandEvent & event);
958         void OnDClickLeft(wxCommandEvent & event);
959
960         void OnPageAChanged(wxNotebookEvent & event);
961         void OnPageBChanged(wxNotebookEvent & event);
962
963         vtkMPRBaseData  *GetVtkMPRBaseData();
964         vtkPlane2DView  *GetVtkPlane2DView();
965         
966         //returns the 3d view of the widget
967         wxVtkMPR3DView  *GetWxvtkmpr3Dview_BB();
968
969         void    RefreshView(bool firsttime=false);
970
971         wxVtkBaseView *GetWxVtkBaseView(int page, int id);
972
973         //returns the 2d view of the specific direction (0|1|2)
974         wxVtkMPR2DView *GetWxvtkMPR2Dview(int direction);
975
976         void setImageData(vtkImageData * img, double voxelsize);
977
978 private:
979         double                                  _voxelSize;
980         marImageData                    *_marImageData; 
981         vtkMPRBaseData                  *_vtkmprbasedata; 
982         wxVtkMPR2DView                  *_vtkmpr2Dview[3]; 
983         vtkPlane2DView                  *_vtkplane2Dview;
984         wxSphereView                    *_wxsphereview;
985         wxVtkMPR2DView                  *_vtkmpr2Dview_B[3]; 
986         vtkPlane2DView                  *_vtkplane2Dview_B;
987         wxSphereView                    *_wxsphereview_B;
988
989         wxVtk3DBaseView                 *_wxvtk3Dbaseview_MPRClipping3D;
990         wxVtkMPR3DView                  *_wxvtkmpr3Dview;
991         wxVtkClipping3DView             *_wxvtkclipping3Dview;
992
993         wxVtk3DBaseView                 *_wxvtk3Dbaseview_MPR3D_B;
994         wxVtkMPR3DView                  *_wxvtkmpr3Dview_B;
995
996         wxVtk3DBaseView                 *_wxvtk3Dbaseview_Clipping3D_BB;
997         wxVtkMPR3DView                  *_wxvtkmpr3Dview_BB;
998         wxVtkClipping3DView             *_wxvtkclipping3Dview_BB;
999
1000         int                                             _refreshAPage;
1001         int                                             _refreshBPage;
1002
1003
1004         wxFrame                                 *_framePanelCutting;
1005         wxCheckBox                              *_btnCutImageData;
1006         wxPanelCuttingImageData *_panelCutting;
1007
1008         wxWidgetMesure2D_Plane_in_MPR   *_widgetMesure;
1009         wxWidgetMesure2D_Plane_in_MPR   *_widgetMesure_B;
1010
1011         wxPanel *CreateControlPanel(wxWindow *parent);
1012         wxPanel *CreateMPRPanel(wxWindow *parent, vtkMPRBaseData *vtkmprbasedata);
1013         wxPanel *CreateMPRPanel4View(wxWindow *parent, vtkMPRBaseData *vtkmprbasedata);
1014         wxPanel *CreateView(int type,wxWindow *parent, vtkMPRBaseData *vtkmprbasedata);
1015
1016         void    OnCutImagaData( wxCommandEvent &event);
1017
1018         DECLARE_EVENT_TABLE( );
1019 };
1020
1021
1022 class creaMaracasVisu_EXPORT wxMPRWidget2 : public wxMPRWidget
1023 {
1024 public:
1025         wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize);
1026         ~wxMPRWidget2();
1027         virtual void OnRefreshView(wxCommandEvent & event);
1028 private:
1029 protected:
1030 };
1031
1032
1033
1034
1035 #endif // __WX__MPR__WIDGET__HXX__
1036
1037
1038
1039 // EOF - wxMPRWidget.h