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 # ------------------------------------------------------------------------ */
26 /*=========================================================================
29 Module: $RCSfile: wxMaracas_ManualContour_Panel.cxx,v $
31 Date: $Date: 2012/11/15 14:14:56 $
32 Version: $Revision: 1.2 $
34 Copyright: (c) 2002, 2003
37 This software is distributed WITHOUT ANY WARRANTY; without even
38 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39 PURPOSE. See the above copyright notice for more information.
41 =========================================================================*/
44 #include <wx/splitter.h>
45 #include "widgets/pPlotter/mBarRange.h"
46 #include "wxMaracas_ManualContour_Panel.h"
49 BEGIN_EVENT_TABLE( wxMaracas_ManualContour_Panel, wxPanel )
50 EVT_MENU( 12121, wxMaracas_ManualContour_Panel::OnRefreshView )
54 wxMaracas_ManualContour_Panel::wxMaracas_ManualContour_Panel( wxWindow* parent )
55 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
57 // Create the main frame window
59 wxWindow *wxwindow = CreateViewerPanel(this);
60 wxBoxSizer* szTop = new wxBoxSizer( wxVERTICAL );
61 szTop->Add( wxwindow, 1 , wxEXPAND | wxALL , 0 );
63 szTop->SetSizeHints( this );
64 this->SetAutoLayout( true );
65 this->SetSizer( szTop );
68 //----------------------------------------------------------------------------
69 wxMaracas_ManualContour_Panel::~wxMaracas_ManualContour_Panel( )
73 //----------------------------------------------------------------------------
74 void wxMaracas_ManualContour_Panel::ConfigureVTK( marImageData *marimagedata )
76 vtkMPRBaseData *vtkmprbasedata = new vtkMPRBaseData();
77 vtkmprbasedata->SetMarImageData(marimagedata);
78 vtkmprbasedata->SetX(5);
79 vtkmprbasedata->SetY(5);
80 vtkmprbasedata->SetZ(5);
81 // _vtkplane2Dview->SetVtkBaseData( vtkmprbasedata );
82 // _vtkplane2Dview->Configure();
85 //----------------------------------------------------------------------------
86 void wxMaracas_ManualContour_Panel::OnRefreshView( wxCommandEvent & event)
88 _vtkplane2Dview->Refresh();
89 _vtkplane2Dview->RefreshView();
92 //----------------------------------------------------------------------------
94 void wxMaracas_ManualContour_Panel::OnActualChange(wxCommandEvent& event)
96 // wxMessageDialog(this, _T("EED: OnActualChange")).ShowModal();
100 //----------------------------------------------------------------------------
101 wxWindow* wxMaracas_ManualContour_Panel::CreateViewerPanel(wxWindow* parent)
103 wxPanel *panel = new wxPanel(parent,-1);
106 wxPanel *panelUpBar = new wxPanel(panel,-1);
109 mBarRange *time_barrange = new mBarRange(panelUpBar,400,10);
110 time_barrange -> setVisibleLabels(true);
111 time_barrange -> setRepresentedValues (Tmin,Tmax);
112 time_barrange -> setDeviceBlitStart (0,0);
113 time_barrange -> SetActual((Tmin+Tmax)/2);
114 time_barrange -> setActiveStateTo(true);
115 time_barrange -> SetInRangeProperty(false);
116 Connect(time_barrange->GetId(),wxEVT_TSBAR_ACTUAL , (wxObjectEventFunction) &wxMaracas_ManualContour_Panel::OnActualChange,NULL,this);
118 wxBoxSizer *sizerUpBar= new wxBoxSizer(wxHORIZONTAL);
119 wxPanel *tmpPanel = new wxPanel(panel,-1, wxDefaultPosition , wxSize(50,50) );
120 sizerUpBar->Add( tmpPanel);
121 sizerUpBar->Add( time_barrange , 1, wxEXPAND, 10 );
122 sizerUpBar->SetSizeHints( panelUpBar ); // set size hints to honour minimum size
123 panelUpBar->SetSizer(sizerUpBar);
124 panelUpBar->SetAutoLayout(true);
125 panelUpBar->Layout();
130 wxPanel *panelDownBar = new wxPanel(panel,-1);
133 int Zmin = 0 , Zmax = 34;
134 mBarRange *z_barrange = new mBarRange(panelDownBar,50,400);
135 z_barrange -> SetBackgroundColour( wxColour(100,100,0) );
136 z_barrange -> SetOrientation(false);
137 z_barrange -> setVisibleLabels(true);
138 z_barrange -> setRepresentedValues (Zmin,Zmax);
139 // z_barrange -> SetActual((min+max)/2);
140 z_barrange -> setDeviceBlitStart (0,0);
141 z_barrange -> setActiveStateTo(true);
142 z_barrange -> SetInRangeProperty(false);
143 Connect(z_barrange->GetId(),wxEVT_TSBAR_ACTUAL , (wxObjectEventFunction) &wxMaracas_ManualContour_Panel::OnActualChange,NULL,this);
146 wxFlexGridSizer *sizerDownBar = new wxFlexGridSizer(5);
147 sizerDownBar->AddGrowableCol(2);
148 sizerDownBar->AddGrowableRow(0);
151 wxSlider *tmpSlider = new wxSlider(panelDownBar,-1,0,0,100,wxDefaultPosition,wxSize(50,50),wxSL_VERTICAL);
152 sizerDownBar->Add( tmpSlider , 1 , wxEXPAND|wxALIGN_BOTTOM , 10 );
154 sizerDownBar->Add( z_barrange , 1 , wxEXPAND| wxALIGN_BOTTOM, 10 );
156 sizerDownBar->Add( CreateSplitePanel(panelDownBar) , 1 , wxGROW , 10 );
157 sizerDownBar->SetSizeHints( panelDownBar ); // set size hints to honour minimum size
158 panelDownBar->SetSizer(sizerDownBar);
159 panelDownBar->SetAutoLayout(true);
160 panelDownBar->Layout();
162 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
163 sizer->Add( panelUpBar , 0 , wxEXPAND , 10);
164 sizer->Add( panelDownBar , 1 , wxEXPAND, 10 );
166 sizer->SetSizeHints( panel ); // set size hints to honour minimum size
167 panel->SetSizer(sizer);
168 panel->SetAutoLayout(true);
174 //----------------------------------------------------------------------------
175 wxWindow* wxMaracas_ManualContour_Panel::CreateSplitePanel(wxWindow *parent)
178 wxSplitterWindow *splitter = new wxSplitterWindow(parent,-1);
181 _vtkplane2Dview = new vtkPlane2DView( splitter );
182 _vtkplane2Dview->SetImgSize( 350 );
183 wxWindow *pA = _vtkplane2Dview->GetWxVTKRenderWindowInteractor ();
185 wxPanel *pB = new wxPanel(splitter,-1);
186 pA->SetBackgroundColour( wxColour(255,0,0) );
187 pB->SetBackgroundColour( wxColour(0,0,255) );
188 splitter->SplitVertically( pA , pB );
192 //----------------------------------------------------------------------------
193 //----------------------------------------------------------------------------
194 //----------------------------------------------------------------------------
200 // EOF - wxMaracas_ManualContour_Panel.cxx