]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
af7317cc5877fadcfdfe33a2bbf51de04b092ad7
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / ColorLayerImageViewPanel.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  *  \file
28  *  \brief ClassThresholdImageViewPanel .
29  */
30
31
32 #include "ColorLayerImageViewPanel.h"
33 #include "OpenImageDialog.h"
34 #include <wx/string.h>
35
36 //---------------------------------------------------------
37 //---------------------------------------------------------
38 //---------------------------------------------------------
39
40 wxDlgTransformByDimensionBySpacingByPixel::wxDlgTransformByDimensionBySpacingByPixel()
41 {
42 }
43
44 wxDlgTransformByDimensionBySpacingByPixel::~wxDlgTransformByDimensionBySpacingByPixel()
45 {
46 }
47
48
49 void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(
50                                                                         wxWindow *parent , 
51                                                                         double baseSpc[3],
52                                                                         double layerSpc[3],
53                                                                         int baseDim[3],
54                                                                         int layerDim[3],
55                                                                         wxString message,
56                                                                         int &typeOfTransformation,
57                                                                         bool &dlgWxOK)
58 {
59         wxDialog* dial                  = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(500,550),wxRESIZE_BORDER);
60         wxSizer* buttonsSizer   = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
61         wxBoxSizer *dialSizer   = new wxBoxSizer(wxVERTICAL);
62
63         wxString lstOptOperation[3];
64         lstOptOperation[0]=_T("By Dimension");
65         lstOptOperation[1]=_T("By Spacing");
66         lstOptOperation[2]=_T("By Pixel");
67         wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(250,90), 3 , lstOptOperation,  3, wxRA_SPECIFY_COLS);
68
69         wxString str;
70         wxString strBaseSpc(str);
71         wxString strLayerSpc;
72         wxString strBaseDim;
73         wxString strLayerDim;
74
75         strBaseSpc.Printf(wxT("Base spacing: %f %f %f"), baseSpc[0],baseSpc[1],baseSpc[2] );
76         strLayerSpc.Printf(wxT("Layer spacing: %f %f %f"), layerSpc[0],layerSpc[1],layerSpc[2] );
77         strBaseDim.Printf(wxT("Base dimension: %d %d %d"), baseDim[0],baseDim[1],baseDim[2] );
78         strLayerDim.Printf(wxT("Layer dimension: %d %d %d"), layerDim[0],layerDim[1],layerDim[2] );
79
80         dialSizer->Add( new wxStaticText(dial,-1,message                )       , 0, wxGROW );
81         dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
82         dialSizer->Add( new wxStaticText(dial,-1, strBaseSpc    )       , 0, wxGROW );
83         dialSizer->Add( new wxStaticText(dial,-1, strLayerSpc   )       , 0, wxGROW );
84         dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
85         dialSizer->Add( new wxStaticText(dial,-1, strBaseDim    )       , 0, wxGROW );
86         dialSizer->Add( new wxStaticText(dial,-1, strLayerDim   )       , 0, wxGROW );
87         dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
88         dialSizer->Add( new wxStaticText(dial,-1,message                )       , 0, wxGROW );
89         dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
90         dialSizer->Add(radioOpts,0,wxGROW);
91         dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
92         dialSizer->Add(buttonsSizer,0,wxGROW);
93         dial->SetSizer(dialSizer, true);
94         dial->Layout();
95         dial->ShowModal();
96
97         typeOfTransformation    = -1;
98         dlgWxOK                                 = false;
99
100         if (dial->GetReturnCode() == wxID_OK)
101         {
102                 typeOfTransformation    = radioOpts->GetSelection() + 1;
103                 dlgWxOK                                 = true;
104         }
105 }
106
107
108 //---------------------------------------------------------
109 //---------------------------------------------------------
110 //---------------------------------------------------------
111
112
113 /**
114  ** Begin of the threshold panel
115  **/
116 ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
117 //: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
118
119 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
120
121
122 {
123
124         _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
125         _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
126
127         _cb_ShowHide                    = NULL;
128         _sl_SliceImageX                 = NULL;
129         _sl_SliceImageY                 = NULL;
130         _sl_SliceImageZ                 = NULL;
131         _histogram                              = NULL;
132         _histogramMinMaxLevel   = NULL;
133
134         wxFlexGridSizer * sizer         = NULL;
135         _colorLayerImageViewManager     = new ColorLayerImageViewManager();
136
137         if (type==1)
138         {
139                 sizer                                                   = new wxFlexGridSizer(1);
140                 _btn_ReadImage                                  = new wxButton(this, wxID_ANY, _T("Read Image") );
141                 _thresholdGo                                    = true;
142                 _cb_ShowHide                                    = new wxCheckBox(this, wxID_ANY, _T("Show/Hide Layer") );
143                 _cb_ShowHide->SetValue(_thresholdGo);
144                 _cb_SliceFixDinamic                     = new wxCheckBox(this, wxID_ANY, _T("Fixed/Dynamic Slice") );
145                 _cb_SliceFixDinamic->SetValue(true);
146                 _sl_SliceImageX = new wxSlider(this, wxID_ANY, 0, 1000, 1000, 
147                                                                                         wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
148                 _sl_SliceImageY = new wxSlider(this, wxID_ANY, 0, 1000, 1000, 
149                                                                                         wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
150                 _sl_SliceImageZ = new wxSlider(this, wxID_ANY, 0, 1000, 1000, 
151                                                                                         wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
152                 _sl_SliceImageX->Enable(false);
153                 _sl_SliceImageY->Enable(false);
154                 _sl_SliceImageZ->Enable(false);
155                 _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpole") );
156                 _interpolationCheckBox->SetValue(true);
157                 _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
158
159         //      _histogram                                      = new Histogram(  this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT ); 
160         //      _histogramMinMaxLevel   = new HistogramMinMaxLevel( (HistogramBase*)_histogram );
161
162                 Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
163                 Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED  , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow );
164                 Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
165                 Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
166                 Connect( _cb_SliceFixDinamic->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceFixDinamic );
167
168                 Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_THUMBTRACK      , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
169                 Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
170                 Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEDOWN        , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
171                 Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
172                 Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEDOWN        , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
173
174                 Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_THUMBTRACK      , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
175                 Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
176                 Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEDOWN        , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
177                 Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
178                 Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEDOWN        , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
179
180                 Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_THUMBTRACK      , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
181                 Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
182                 Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEDOWN        , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
183                 Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
184                 Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEDOWN        , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
185
186                 sizer -> Add( new wxStaticText(this,-1,_T("Color Image Layer"))                 , 1, wxGROW );
187                 sizer -> Add( _btn_ReadImage                                                                                    , 1, wxGROW );
188                 sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                 , 1, wxGROW );
189                 sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))                     , 1, wxGROW );
190                 sizer -> Add( _opacity                                                                                                  , 1, wxGROW );
191                 sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                 , 1, wxGROW );
192                 sizer -> Add( _cb_ShowHide                                                                                              , 1, wxGROW );
193                 sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                 , 1, wxGROW );
194                 sizer -> Add( _interpolationCheckBox                                                                    , 1, wxGROW );
195
196                 sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                 , 1, wxGROW );
197                 sizer -> Add( new wxStaticText(this,-1,_T("Slice "))                                    , 1, wxGROW );
198                 sizer -> Add( _sl_SliceImageX                                                                                   , 1, wxGROW );
199                 sizer -> Add( _sl_SliceImageY                                                                                   , 1, wxGROW );
200                 sizer -> Add( _sl_SliceImageZ                                                                                   , 1, wxGROW );
201                 sizer -> Add( _cb_SliceFixDinamic                                                                               , 1, wxGROW );
202         //      sizer -> Add( _histogramMinMaxLevel->GetWindow()                                                , 1, wxGROW );
203
204         } // type==1
205
206
207         if (type==2)
208         {
209                 sizer                                                   = new wxFlexGridSizer(2);
210                 _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpolate") );
211                 _interpolationCheckBox->SetValue(true);
212                 _opacity = new wxSlider(this, wxID_ANY, 6, 0, 10, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
213
214                 Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
215                 Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
216 //              sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))                     , 1, wxEXPAND );
217                 sizer -> Add( _opacity                                  , 1, wxGROW );
218                 sizer -> Add( _interpolationCheckBox    , 1, wxGROW );
219                 sizer->AddGrowableCol(0);
220
221         } // type==2
222
223
224         this->SetSizer( sizer );
225 //      this->SetAutoLayout( true );
226 //      this->Layout();
227      
228         //CM Sets the default fitting mode to Pixel mode.
229         _fitting_mode = 3;
230         // EO CM  EED
231 }
232
233 //----------------------------------------------------------------------------
234 ColorLayerImageViewPanel::~ColorLayerImageViewPanel()
235 {
236 }
237
238
239 //----------------------------------------------------------------------------
240 ColorLayerImageViewManager* ColorLayerImageViewPanel::GetColorLayerImageViewManager()
241 {
242    return _colorLayerImageViewManager;
243 }
244
245
246 //----------------------------------------------------------------------------
247 // This is the new spacing of the background image  (1,1,1)
248 void ColorLayerImageViewPanel::SetBaseSpacing(double spc[3])
249 {
250         _spcBase[0] = spc[0];
251         _spcBase[1] = spc[1];
252         _spcBase[2] = spc[2];
253
254         _spcBase[0] = 1;
255         _spcBase[1] = 1;
256         _spcBase[2] = 1;
257 }
258
259 //----------------------------------------------------------------------------
260 // This is the Original spacing of the background image
261 void ColorLayerImageViewPanel::SetOriginalSpacing(double spc[3])
262 {
263         _spcOrg[0] = spc[0];
264         _spcOrg[1] = spc[1];
265         _spcOrg[2] = spc[2];
266 }
267
268 //----------------------------------------------------------------------------
269 // This is the size in pixels of the background image
270 void ColorLayerImageViewPanel::SetBaseDimension(int dim[3])
271 {
272         _dimBase[0] = dim[0];
273         _dimBase[1] = dim[1];
274         _dimBase[2] = dim[2];
275 }
276
277 //----------------------------------------------------------------------------
278 void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
279 {
280     if (img!=NULL)
281     {
282                 if (_histogramMinMaxLevel!=NULL) 
283                 {
284                         _histogramMinMaxLevel->Configure( img );
285                 }
286         _colorLayerImageViewManager->SetImage( img );
287
288         double spc[3];
289         img->GetSpacing(spc);
290
291         int dim[3];
292         int ext[6];
293         img->GetWholeExtent(ext);
294         dim[0] = ext[1]-ext[0];
295         dim[1] = ext[3]-ext[2];
296         dim[2] = ext[5]-ext[4];
297
298
299                 if (_sl_SliceImageX!=NULL)
300                 {
301                     _sl_SliceImageX->SetRange( 0 , dim[0] );
302                     _sl_SliceImageY->SetRange( 0 , dim[1] );
303                     _sl_SliceImageZ->SetRange( 0 , dim[2] );
304                 }
305
306 //printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
307 //printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
308 //printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
309 //printf("EED ColorLayerImageViewPanel::SetImage  UUPPSS----------------------\n"  );
310 //printf("  Here I have to analyse the spacing and size image to calculate new spacingvv\n"  );
311 //printf("  I need the caracteristics of the base image\n"  );
312 //                      GetColorLayerImageViewManager()->GetwxVtkBaseView(0);
313
314
315         if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
316              (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
317             )
318         {
319                         // CM
320                         int typeOfTransformation;       
321                         // In case of the option is set to create a dialog box.
322                         if (_fitting_mode == -1)
323                         {
324                                 bool transformOkDlg;
325                         wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
326                         wxDlgTransformByDimensionBySpacingByPixel dlg;
327                         dlg.GetTransformType(this,_spcBase,spc,_dimBase,dim,msg,typeOfTransformation,transformOkDlg);
328                         // CM Reset the default value (Pixel i.e. 3) if the dialog box returned an inappropriate value.
329                         if (transformOkDlg == false)
330                                 {
331                                 typeOfTransformation = 3;
332                                 } 
333                         } else {
334                         typeOfTransformation = _fitting_mode;
335                         } // _fitting_mode -1
336
337                         //EO CM
338             if (typeOfTransformation==1)  // make dimensions equals
339             {
340                 printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
341                 spc[0]=_spcBase[0]*_dimBase[0]/dim[0];
342                 spc[1]=_spcBase[1]*_dimBase[1]/dim[1];
343                 spc[2] = 1;
344             }
345
346             if (typeOfTransformation==2)  // make spacing equals
347             {
348                 spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0];
349                 spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1];
350                 spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2];
351             }
352
353             if (typeOfTransformation==3)  // make spacing = 1
354             {
355                 spc[0] = 1;
356                 spc[1] = 1;
357                 spc[2] = 1;
358             }
359
360             img->SetSpacing(spc);
361         } // spc !_spcBase   dim!__dimBase
362     } // _firsttime_mode
363
364         if (_active==true)
365         {
366             _colorLayerImageViewManager->onThreshold();
367                 RefreshView();
368         } // _ative 
369
370 }
371
372
373 void ColorLayerImageViewPanel::RefreshView()
374 {
375 //EED01         _colorLayerImageView->Refresh();
376         _colorLayerImageViewManager->Refresh();
377 }
378
379 //----------------------------------------------------------------------------
380 void ColorLayerImageViewPanel::SetFittingMode(int fitting_mode)
381 {
382   // CM Sets the fitting mode if an appropriate value is provided.
383   if (fitting_mode == -1 || fitting_mode == 1 || fitting_mode == 2 || fitting_mode == 3)
384     {
385       _fitting_mode = fitting_mode;
386     }
387   //Otherwise, an exception should be thrown (value 0 is fine, it corresponds to an empty field i.e. the default value is kept).
388   else if (fitting_mode != 0)
389     std::cout << "CM ERROR!!! The fitting mode provided has an inappropriate value. It should be an int between -1 ; 1 ; 2 ; 3, but its value is :" << fitting_mode << ". The default value will be set instead, i.e. Pixel transformation (3)." <<  std::endl;
390   //EO CM
391 }
392
393 //----------------------------------------------------------------------------
394 int ColorLayerImageViewPanel::GetFittingMode()
395 {
396   return _fitting_mode;
397 }
398
399 //----------------------------------------------------------------------------
400 void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event)
401 {
402 // EED ???
403 //      creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
404 //      w.ShowModal();
405         printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
406
407         creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
408         SetImage( diag.getImageData() );
409 }
410
411 //----------------------------------------------------------------------------
412 void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event)
413 {
414                 if (_thresholdGo)
415                 {
416                  _colorLayerImageViewManager->onThresholdChange();
417                  RefreshView();
418                 //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal  << std::endl;
419           } // _thresholdGo
420 }
421
422 //----------------------------------------------------------------------------
423 void ColorLayerImageViewPanel::onThresholdShow(wxCommandEvent& event)
424 {
425         _thresholdGo = _cb_ShowHide->GetValue();
426                         _active = _thresholdGo;
427         if (_thresholdGo)
428         {
429                     _colorLayerImageViewManager->onThreshold();
430         }else{
431                     _colorLayerImageViewManager->onThresholdRemove( );
432         }
433              RefreshView();
434 }
435
436 //----------------------------------------------------------------------------
437 void ColorLayerImageViewPanel::onThresholdStop()
438 {
439                 if (_thresholdGo)
440                 {
441                     _colorLayerImageViewManager->onThresholdRemove( );
442                     _thresholdGo=false;
443                 }
444 }
445
446 //----------------------------------------------------------------------------
447 void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
448 {
449            _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
450                 RefreshView();
451 }
452
453 //----------------------------------------------------------------------------
454 void ColorLayerImageViewPanel::onSliceFixDinamic(wxCommandEvent& event)
455 {
456         bool fixdin = _cb_SliceFixDinamic->GetValue();
457         _colorLayerImageViewManager->SetSliceFixDynamic( fixdin );
458         if (fixdin==false)
459         {
460             _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
461             _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
462             _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
463         }
464         _sl_SliceImageX->Enable(!fixdin);
465         _sl_SliceImageY->Enable(!fixdin);
466         _sl_SliceImageZ->Enable(!fixdin);
467         _colorLayerImageViewManager->onThreshold();
468         RefreshView();
469 }
470
471 //----------------------------------------------------------------------------
472 void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event)
473 {
474    _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
475    _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
476    _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
477    _colorLayerImageViewManager->onThreshold();
478         RefreshView();
479 }
480
481 //----------------------------------------------------------------------------
482 void ColorLayerImageViewPanel::onChangeOpacity(wxScrollEvent& event)
483 {
484         int opacity = _opacity->GetValue();
485         _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
486         RefreshView();
487 }
488
489
490 //----------------------------------------------------------------------------
491 bool ColorLayerImageViewPanel::IsVisible()
492 {
493         return _thresholdGo;
494 }
495
496 //----------------------------------------------------------------------------
497 void ColorLayerImageViewPanel::SetActive(bool active)
498 {
499         _active=active;
500         if (_cb_ShowHide!=NULL)
501         {
502                 _cb_ShowHide->SetValue( _active );
503         }
504 }
505
506
507 // EOF
508