1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "wxMaracasSuperpositionPanel.h"
32 //----------------------------------------------------------------------------------------------------------------
34 //----------------------------------------------------------------------------------------------------------------
36 //------------------------------------------------------------------------------------------------------------
37 // Constructors & Destructors
38 //------------------------------------------------------------------------------------------------------------
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)
47 createSuperpositionPanel();
49 outSizer = new wxFlexGridSizer(1, 1, gapH, gapV);
50 outSizer -> AddGrowableCol(0);
51 outSizer -> AddGrowableRow(0);
52 outSizer->Add( theViewPanel, 1, wxGROW);
54 this->SetSizer( outSizer );
55 this->SetAutoLayout( true );
60 wxMaracasSuperpositionPanel :: ~wxMaracasSuperpositionPanel()
65 //------------------------------------------------------------------------------------------------------------
66 // Creational and initialization methods
67 //------------------------------------------------------------------------------------------------------------
69 void wxMaracasSuperpositionPanel :: createSuperpositionPanel()
72 std::vector<int> * numViews = new std::vector<int> ();
73 numViews->push_back(0);
75 if (_type==1 || _type==3)
77 theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[0], numViews );
81 theViewPanel = new wxMaracas_N_ViewersWidget( this, _images[1], numViews );
84 SetVisibleAxis(false);
86 theViewPanel->SetBackgroundColour(wxColour(0,0,0));
88 theViewPanel->SetSize(800, 900);
89 theViewPanel->GetWindow(1)->SetSize(800, 900);
92 //------------------------------------------------------------------------------------------------------------
94 wxVtkBaseView* wxMaracasSuperpositionPanel :: GetWxVtkBaseView()
96 return theViewPanel->GetwxVtkBaseView(1);
100 wxVtkMPR2DView * wxMaracasSuperpositionPanel::GetwxVtkMPR2DView()
102 return (wxVtkMPR2DView *) (theViewPanel->GetwxVtkBaseView(1));
105 vtkImageData * wxMaracasSuperpositionPanel::GetshowingVID()
110 int wxMaracasSuperpositionPanel::GetImageDataSizeZ()
113 GetshowingVID()->GetExtent(ext);
114 int sizeZ = ext[5]-ext[4]+1;
119 void wxMaracasSuperpositionPanel :: RefreshInterface()
121 GetWxVtkBaseView()->Refresh();
124 void wxMaracasSuperpositionPanel :: ChangeImage(vtkImageData* img)
126 theViewPanel->SetImage(img);
129 //------------------------------------------------------------------------------------------------------------
130 // Other functional methods
131 //------------------------------------------------------------------------------------------------------------
133 void wxMaracasSuperpositionPanel::SetVisibleAxis(bool ok)
135 GetwxVtkMPR2DView()->SetVisibleAxis(ok);
138 //------------------------------------------------------------------------------------------------------------
139 int wxMaracasSuperpositionPanel::GetX()
141 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetX();
143 //------------------------------------------------------------------------------------------------------------
144 int wxMaracasSuperpositionPanel::GetY()
146 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetY();
148 //------------------------------------------------------------------------------------------------------------
149 int wxMaracasSuperpositionPanel::GetZ()
151 return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
154 //------------------------------------------------------------------------------------------------------------
155 void wxMaracasSuperpositionPanel::Refresh()
157 GetwxVtkMPR2DView()->GetRenWin()->Render();