]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSuperpositionPanel.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasSuperpositionPanel.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "wxMaracasSuperpositionPanel.h"
31
32 //----------------------------------------------------------------------------------------------------------------
33 // Other includes
34 //----------------------------------------------------------------------------------------------------------------
35         
36         //------------------------------------------------------------------------------------------------------------
37         // Constructors & Destructors
38         //------------------------------------------------------------------------------------------------------------
39
40         wxMaracasSuperpositionPanel :: wxMaracasSuperpositionPanel ( std::vector<vtkImageData*> imgs, int type, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )   
41         :wxPanel(parent, -1, pos, size, style)          
42         {                               
43                 _images = imgs;
44                 _type = type;
45                 int gapH = 20;
46                 int gapV = 10;
47                 createSuperpositionPanel();
48
49                 outSizer = new wxFlexGridSizer(1, 1, gapH, gapV);
50                 outSizer -> AddGrowableCol(0);
51                 outSizer -> AddGrowableRow(0);
52                 outSizer->Add( theViewPanel, 1, wxGROW);
53                                                                 
54                 this->SetSizer( outSizer );
55                 this->SetAutoLayout( true );
56                 this->Layout();
57         }
58         
59
60         wxMaracasSuperpositionPanel :: ~wxMaracasSuperpositionPanel()
61         {
62
63         }
64
65         //------------------------------------------------------------------------------------------------------------
66         // Creational and initialization methods
67         //------------------------------------------------------------------------------------------------------------
68         
69         void wxMaracasSuperpositionPanel :: createSuperpositionPanel()
70         {               
71
72                 std::vector<int> * numViews = new std::vector<int> ();
73                 numViews->push_back(0);
74                 
75                 if (_type==1 || _type==3)
76                 {
77                         theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[0], numViews );                     
78                 }
79                 else if (_type==2)
80                 {
81                         theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[1], numViews );                                             
82                 }
83                 
84                 SetVisibleAxis(false);
85
86                 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
87
88                 theViewPanel->SetSize(800, 900);
89                 theViewPanel->GetWindow(1)->SetSize(800, 900);  
90         }
91
92         //------------------------------------------------------------------------------------------------------------
93
94         wxVtkBaseView* wxMaracasSuperpositionPanel :: GetWxVtkBaseView()
95         {
96                 return theViewPanel->GetwxVtkBaseView(1);
97         }
98
99
100         wxVtkMPR2DView * wxMaracasSuperpositionPanel::GetwxVtkMPR2DView() 
101         {
102                 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
103         }
104
105         vtkImageData * wxMaracasSuperpositionPanel::GetshowingVID() 
106         {
107                 return _images[0];
108         }
109
110         int wxMaracasSuperpositionPanel::GetImageDataSizeZ()
111         {
112                 int ext[6];
113                 GetshowingVID()->GetExtent(ext);
114                 int sizeZ = ext[5]-ext[4]+1;
115
116                 return sizeZ;
117         }
118
119         void wxMaracasSuperpositionPanel :: RefreshInterface()
120         {
121                 GetWxVtkBaseView()->Refresh();
122         }
123
124         void wxMaracasSuperpositionPanel :: ChangeImage(vtkImageData* img)
125         {
126                 theViewPanel->SetImage(img);
127         }
128         
129         //------------------------------------------------------------------------------------------------------------
130         //  Other functional methods
131         //------------------------------------------------------------------------------------------------------------
132
133         void wxMaracasSuperpositionPanel::SetVisibleAxis(bool ok)
134         {
135                 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
136         }
137
138         //------------------------------------------------------------------------------------------------------------
139         int wxMaracasSuperpositionPanel::GetX()
140         {
141                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
142         }
143         //------------------------------------------------------------------------------------------------------------
144         int wxMaracasSuperpositionPanel::GetY()
145         {
146                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
147         }
148         //------------------------------------------------------------------------------------------------------------
149         int wxMaracasSuperpositionPanel::GetZ()
150         {
151                 return  GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
152         }
153
154         //------------------------------------------------------------------------------------------------------------
155         void wxMaracasSuperpositionPanel::Refresh()
156         {
157                 GetwxVtkMPR2DView()->GetRenWin()->Render();
158         }
159