]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/include/wxMaracasParametersDialog.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / include / wxMaracasParametersDialog.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  Program:   wxMaracas
29  Module:    $RCSfile: wxMaracasParametersDialog.cxx,v $
30  Language:  C++
31  Date:      $Date: 2012/11/15 14:14:56 $
32  Version:   $Revision: 1.2 $
33  
34   Copyright: (c) 2002, 2003
35   License:
36   
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.
40    
41 =========================================================================*/
42
43 #include "wxMaracasParametersDialog.h"
44 #include "marDictionary.h"
45
46 // ----------------------------------------------------------------------------
47 BEGIN_EVENT_TABLE( wxMaracasParametersDialog, wxDialog )
48         EVT_BUTTON( wxID_OK, wxMaracasParametersDialog::OnOk )
49         EVT_BUTTON( wxID_CANCEL, wxMaracasParametersDialog::OnCancel )
50         EVT_BUTTON( ID_BTN_DEFAULT, wxMaracasParametersDialog::OnDefault )
51         EVT_BUTTON( ID_BTN_RESET, wxMaracasParametersDialog::OnReset )
52         EVT_BUTTON( ID_BTN_APPLY, wxMaracasParametersDialog::OnApply )
53         // PS ->        EVT_BUTTON( ID_BTN_BROWSE_WORK_DIR, wxMaracasParametersDialog::OnBrowseWorkDir )
54         // PS ->        EVT_BUTTON( ID_BTN_BROWSE_DICOM_DIR, wxMaracasParametersDialog::OnBrowseDICOMDir )
55         // PS ->        EVT_BUTTON( ID_BTN_3D_BACK_COLOR, wxMaracasParametersDialog::OnChoose3DColor )
56         // PS ->        EVT_BUTTON( ID_BTN_AXIS_COLOR, wxMaracasParametersDialog::OnChooseAxisColor )
57 END_EVENT_TABLE( );
58
59 // ----------------------------------------------------------------------------
60 wxMaracasParametersDialog::wxMaracasParametersDialog( wxWindow* parent, marInterface* mar )
61 : wxParametersDialog( parent, -1, _T(""))
62 {
63         _parent=parent;
64     _mar = mar;
65     Reset( );
66
67         SetBakEdit();
68 }
69
70 // ----------------------------------------------------------------------------
71 void wxMaracasParametersDialog::Reset( )
72 {
73         // PS -> //    wxColour col, col2;
74     int qt, st;
75         
76     // General parameters
77         // PS -> //    edtWorkDir->SetValue( _mar->_parameters->getStringParam( marParameters::e_installation_directory ) );
78         // PS ->     edtDICOMDir->SetValue( _mar->_parameters->getStringParam( marParameters::e_dicom_images_directory ) );
79         // PS ->     chkMIP->SetValue( _mar->_parameters->getBoolParam( marParameters::e_calculate_mip_default ) );
80         // PS ->     chkSlices->SetValue( _mar->_parameters->getBoolParam( marParameters::e_choose_all_slices_default ) );
81         // PS ->     chkDebugWindow->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_window_visible ) );
82         // PS ->     chkConsole->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_console_visible ) );
83         // PS -> //    col.Set(
84         // PS -> //        _mar->_parameters->getDoubleParam( marParameters::e_back_color_3D_r ),
85         // PS -> //        _mar->_parameters->getDoubleParam( marParameters::e_back_color_3D_g ),
86         // PS -> //        _mar->_parameters->getDoubleParam( marParameters::e_back_color_3D_b )
87         // PS -> //        );
88         // PS -> //    btn3DBackColor->SetBackgroundColour( col );
89     
90     // Contour parameters
91     edtThresholdIsoContours->SetValue( wxString::Format( _T("%.2f"), 
92                 _mar->_parameters->getDoubleParam( marParameters::e_threshold_isocontour ) ) );
93         // PS -> //    edtThresholdSnake->SetValue( wxString::Format( "%.4f", 
94         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_threshold_snake_isocontour ) ) );
95         // PS -> //    edtIterationsSnake->SetValue( wxString::Format( "%d", 
96         // PS -> //             _mar->_parameters->getIntParam( marParameters::e_number_of_iterations_snake_isocontour ) ) );
97         // PS -> //    edtExternCoefSnake->SetValue( wxString::Format( "%.4f", 
98         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_extern_coeficient ) ) );
99         // PS -> //    edtIterationsDeriche->SetValue( wxString::Format( "%d", 
100         // PS -> //             _mar->_parameters->getIntParam( marParameters::e_number_of_iterations_snake_deriche ) ) );
101         // PS -> //    edtBallonCoefDeriche->SetValue( wxString::Format( "%.4f",
102         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_ballon_coeficient ) ) );
103         // PS -> //    edtGradientCoefDeriche->SetValue( wxString::Format( "%.4f",
104         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_gradient_coeficient ) ) );
105         // PS -> //    edtSigmaDeriche->SetValue( wxString::Format( "%.4f", 
106         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_sigma ) ) );
107         // PS -> //    edtScale->SetValue( wxString::Format( "%.4f", 
108         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_scale ) ) );
109         // PS -> //    edtSample->SetValue( wxString::Format( "%.4f",
110         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_sampling ) ) );
111 //EED    chkIsoContoursVis->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_isocontour ) );
112 //EED    chkDiametersVis->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_diameters ) );
113 //EED    chkInvertSliceOrder->SetValue( _mar->_parameters->getBoolParam( marParameters::e_invest_slice_order ) );
114         // PS -> //    chkFillContours->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_fill_area ) );
115         // PS -> //    radIsoContours->SetValue( _mar->_parameters->getIntParam( marParameters::e_algorithm_type ) == marParameters::ISOCONTOURS );
116         // PS -> //    radSnake->SetValue( _mar->_parameters->getIntParam( marParameters::e_algorithm_type ) == marParameters::SNAKE );
117         // PS -> //    radDeriche->SetValue( _mar->_parameters->getIntParam( marParameters::e_algorithm_type ) == marParameters::DERICHE );
118         
119         
120     // Axis parameters
121         // PS -> //    edtDistanceCdg->SetValue( wxString::Format( "%.4f",
122         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_gravity_distance ) ) );
123     edtFlexionCoef->SetValue( wxString::Format( _T("%g"), 
124                 _mar->_parameters->getDoubleParam( marParameters::e_flexion_coeficient ) ) );
125    edtTensionCoef->SetValue( wxString::Format( _T("%g"), 
126                 _mar->_parameters->getDoubleParam( marParameters::e_tension_coeficient ) ) );
127     int sizemask = _mar->_parameters->getIntParam( marParameters::e_mask_size );
128         sizemask=(sizemask-1)/2;
129     edtMaskSize->SetValue( wxString::Format( _T("%d"), sizemask ) );
130     edtDiscreetStep->SetValue( wxString::Format( _T("%#.2f"), 
131                 _mar->_parameters->getDoubleParam( marParameters::e_axis_discret_step ) ) );
132         // PS -> //    edtVoxelX->SetValue( wxString::Format( "%.4f",
133         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_voxel_x_dimension ) ) );
134         // PS -> //    edtVoxelY->SetValue( wxString::Format( "%.4f",
135         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_voxel_y_dimension ) ) );
136         // PS -> //    edtVoxelZ->SetValue( wxString::Format( "%.4f",
137         // PS -> //             _mar->_parameters->getDoubleParam( marParameters::e_voxel_z_dimension ) ) );
138         // PS ->     edtDistanceInt->SetValue( wxString::Format( "%.4f",
139         // PS ->                _mar->_parameters->getDoubleParam( marParameters::e_distance_to_maximum_intensity ) ) );
140         // PS ->     edtCellMaxIntCoef->SetValue( wxString::Format( "%d",
141         // PS ->                _mar->_parameters->getIntParam( marParameters::e_coef_cell_max_int ) ) );
142         // PS ->     edtCellCoef->SetValue( wxString::Format( "%.4f",
143         // PS ->                _mar->_parameters->getDoubleParam( marParameters::e_cell_coeficient ) ) );
144         // PS ->     edtStepCoef->SetValue( wxString::Format( "%d",
145         // PS ->                _mar->_parameters->getIntParam( marParameters::e_step_coeficient ) ) );
146         // PS ->     edtMassPower->SetValue( wxString::Format( "%d", 
147         // PS ->                _mar->_parameters->getIntParam( marParameters::e_mass_power ) ) );
148         // PS ->     edtROIDimension->SetValue( wxString::Format( "%d", 
149         // PS ->                _mar->_parameters->getIntParam( marParameters::e_roi_dimension ) ) );
150         // PS ->     edtStep->SetValue( wxString::Format( "%d", 
151         // PS ->                _mar->_parameters->getIntParam( marParameters::e_step ) ) );
152         // PS -> //    chkShowCell->SetValue( _mar->_parameters->getBoolParam( marParameters::e_show_cell ) );
153         // PS -> //    chkShowIntCell->SetValue( _mar->_parameters->getBoolParam( marParameters::e_show_int_cell ) );
154         // PS -> //    radMinimum->SetValue( _mar->_parameters->getIntParam( marParameters::e_voxel_type ) == marParameters::VOX_TYPE_MINIMUM );
155         // PS -> //    radNormal->SetValue( _mar->_parameters->getIntParam( marParameters::e_voxel_type ) == marParameters::VOX_TYPE_NORMAL );
156         // PS -> //    col2.Set(
157         // PS -> //        _mar->_parameters->getDoubleParam( marParameters::e_axis_color_r ),
158         // PS -> //        _mar->_parameters->getDoubleParam( marParameters::e_axis_color_g ),
159         // PS -> //        _mar->_parameters->getDoubleParam( marParameters::e_axis_color_b )
160         // PS -> //        );
161         // PS -> //    btnAxisColor->SetBackgroundColour( col2 );
162         
163         
164     // Quantification parameters
165     qt = _mar->_parameters->getIntParam( marParameters::e_quantification_type );
166     st = _mar->_parameters->getIntParam( marParameters::e_stenosis_type );
167
168 /* // EED borrame
169     chkArea->SetValue( ( qt & marParameters::TYPE_AREA ) == marParameters::TYPE_AREA );
170     chkPerimeter->SetValue( ( qt & marParameters::TYPE_PERIMETER ) == marParameters::TYPE_PERIMETER );
171     chkDiameterFromArea->SetValue( ( qt & marParameters::TYPE_DIAMETER_FROM_AREA ) == marParameters::TYPE_DIAMETER_FROM_AREA );
172     chkDiameterFromPerimeter->SetValue( ( qt & marParameters::TYPE_DIAMETER_FROM_PERIMETER ) == marParameters::TYPE_DIAMETER_FROM_PERIMETER );
173     chkMinimumDiameter->SetValue( ( qt & marParameters::TYPE_MINIMUM_DIAMETER ) == marParameters::TYPE_MINIMUM_DIAMETER );
174     chkMaximumDiameter->SetValue( ( qt & marParameters::TYPE_MAXIMUM_DIAMETER ) == marParameters::TYPE_MAXIMUM_DIAMETER );
175     chkAverageDiameter->SetValue( ( qt & marParameters::TYPE_AVERAGE_DIAMETER ) == marParameters::TYPE_AVERAGE_DIAMETER );
176     radArea->SetValue( st == marParameters::TYPE_AREA );
177     radPerimeter->SetValue( st == marParameters::TYPE_PERIMETER );
178     radDiameterFromArea->SetValue( st == marParameters::TYPE_DIAMETER_FROM_AREA );
179     radDiameterFromPerimeter->SetValue( st == marParameters::TYPE_DIAMETER_FROM_PERIMETER );
180     radMinimumDiameter->SetValue( st == marParameters::TYPE_MINIMUM_DIAMETER );
181     radMaximumDiameter->SetValue( st == marParameters::TYPE_MAXIMUM_DIAMETER );
182     radAverageDiameter->SetValue( st == marParameters::TYPE_AVERAGE_DIAMETER );
183 */      
184 }
185 // ----------------------------------------------------------------------------
186 bool wxMaracasParametersDialog::Apply( )
187 {
188         marDictionary marDict;
189         char tmp[256];
190
191         bool alertRegenerateAll         = false;
192         bool alertRegenerateSignal      = false;
193         bool alertClearContours         = false;
194         bool alertRegenerateSplineAxe   = false;
195
196         wxMessageDialog *wxdiag;
197         wxString wxtext;
198
199         if ( _bak_edtMaskSize_String.CompareTo( edtMaskSize->GetValue().GetData() )!=0  ) {
200                 alertRegenerateSignal=true;
201                 strcpy(tmp , marDict.GetString(605) ); strcat(tmp,"\n");
202                 wxtext=wxString(tmp, wxConvUTF8); //"The mask size was modified. \n"
203         }
204         if ( _bak_edtThresholdIsoContours_String.CompareTo( edtThresholdIsoContours->GetValue().GetData() )!=0  ) {
205                 alertClearContours=true;
206                 strcpy(tmp , marDict.GetString(610) ); strcat(tmp,"\n");
207                 wxtext=wxString(tmp, wxConvUTF8); //"The threshold was modified. \n"
208         }
209         if ( _bak_edtFlexionCoef_String.CompareTo( edtFlexionCoef->GetValue().GetData() )!=0  ) {
210                 alertRegenerateAll=true;
211                 strcpy(tmp , marDict.GetString(615) ); strcat(tmp,"\n");
212                 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"The flexion coeficient was modified.\n"
213         }
214         if ( _bak_edtTensionCoef_String.CompareTo( edtTensionCoef->GetValue().GetData() )!=0  ) {
215                 alertRegenerateAll=true;
216                 strcpy(tmp , marDict.GetString(620) ); strcat(tmp,"\n");
217                 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"The tension coeficient was modified.\n"
218         }       
219         if ( _bak_edtDiscreetStep_String.CompareTo( edtDiscreetStep->GetValue().GetData() )!=0  ) {
220                 alertRegenerateSplineAxe=true;
221                 strcpy(tmp , marDict.GetString(625) ); strcat(tmp,"\n");
222                 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"The discret step of the axis was modified.\n"
223         }       
224
225         if ((alertRegenerateAll==true) ||(alertRegenerateSplineAxe==true) ) {           
226                 strcpy(tmp,"\n"); strcat(tmp , marDict.GetString(630) ); strcat(tmp,"\n");
227                 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"\n The axe will be regenereted and the contours will be eresed. \n"
228         } else {
229                 if ((alertRegenerateAll==true) ||(alertRegenerateSplineAxe==true) ) {   
230                         strcpy(tmp,"\n"); strcat(tmp , marDict.GetString(635) ); strcat(tmp,"\n");
231                         wxtext=wxtext+wxString(tmp, wxConvUTF8); //"\n All contours will be erase. \n"
232                 }
233         }
234
235         if ( (alertRegenerateAll==true) || 
236                  (alertClearContours==true) || 
237                  (alertRegenerateSignal==true) || 
238                  (alertRegenerateSplineAxe==true) ) {
239                 strcpy(tmp,"\n"); strcat(tmp , marDict.GetString(640) ); 
240                 wxdiag= new wxMessageDialog(this, wxtext + wxString(tmp, wxConvUTF8), wxString(marDict.GetString(645), wxConvUTF8), wxOK | wxCANCEL);//"\n Do you want to continue?"   "Alert" 
241                 if ( wxdiag->ShowModal() != wxID_OK ) {
242                         return true; 
243                 }
244                 wxdiag->Destroy();
245         }
246
247
248         // PS -> //    wxColour col;
249     double td;
250         long tl;
251     int ti;
252         
253     // General parameters
254         
255         // PS -> //    _mar->_parameters->setStringParam( marParameters::e_installation_directory, edtWorkDir->GetValue( ) );
256         // PS ->     _mar->_parameters->setStringParam( marParameters::e_dicom_images_directory, edtDICOMDir->GetValue( ) );
257                 
258         // PS ->     _mar->_parameters->setBoolParam( marParameters::e_calculate_mip_default, chkMIP->GetValue( ) );
259         // PS ->     _mar->_parameters->setBoolParam( marParameters::e_choose_all_slices_default, chkSlices->GetValue( ) );
260         // PS ->     _mar->_parameters->setBoolParam( marParameters::e_debug_window_visible, chkDebugWindow->GetValue( ) );
261         // PS ->     _mar->_parameters->setBoolParam( marParameters::e_debug_console_visible, chkConsole->GetValue( ) );
262         
263         // PS -> //     col = btn3DBackColor->GetBackgroundColour( );
264         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_back_color_3D_r, col.Red( ) );
265         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_back_color_3D_g, col.Green( ) );
266         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_back_color_3D_b, col.Blue( ) );
267         // PS ->        
268         // PS ->     // Axis parameters
269         // PS -> //     if (!edtDistanceCdg->GetValue( ).ToDouble( &td ))
270         // PS -> //             return false;
271         // PS -> //     _mar->_parameters->setDoubleParam( marParameters::e_gravity_distance, td );
272         
273     if (!edtFlexionCoef->GetValue( ).ToDouble( &td ))
274                 return false;
275     _mar->_parameters->setDoubleParam( marParameters::e_flexion_coeficient, td );
276         
277     if (!edtTensionCoef->GetValue( ).ToDouble( &td ))
278                 return false;
279     _mar->_parameters->setDoubleParam( marParameters::e_tension_coeficient, td );
280         
281     if (!edtDiscreetStep->GetValue( ).ToDouble( &td ))
282                 return false;
283     _mar->_parameters->setDoubleParam( marParameters::e_axis_discret_step, td );
284         
285         // PS -> //    if (!edtVoxelX->GetValue( ).ToDouble( &td ))
286         // PS -> //             return false;
287         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, td );
288         // PS -> 
289         // PS -> //    if (!edtVoxelY->GetValue( ).ToDouble( &td ))
290         // PS -> //             return false;
291         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, td );
292         // PS -> 
293         // PS -> //    if (!edtVoxelZ->GetValue( ).ToDouble( &td ))
294         // PS -> //             return false;
295         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, td );
296         // PS -> 
297         // PS ->     if (!edtDistanceInt->GetValue( ).ToDouble( &td ))
298         // PS ->                return false;
299         // PS ->     _mar->_parameters->setDoubleParam( marParameters::e_distance_to_maximum_intensity, td );
300         // PS -> 
301         // PS ->     if (!edtCellCoef->GetValue( ).ToDouble( &td ))
302         // PS ->                return false;
303         // PS ->     _mar->_parameters->setDoubleParam( marParameters::e_cell_coeficient, td );
304         // PS -> 
305         if (!edtMaskSize->GetValue( ).ToLong( &tl ))
306           return false;
307         _mar->_parameters->setIntParam( marParameters::e_mask_size, ( int )tl * 2 +1);
308          
309         // PS ->     if (!edtCellMaxIntCoef->GetValue( ).ToLong( &tl ))
310         // PS ->                return false;
311         // PS ->     _mar->_parameters->setIntParam( marParameters::e_coef_cell_max_int, ( int )tl );
312         // PS -> 
313         // PS ->     if (!edtStepCoef->GetValue( ).ToLong( &tl ))
314         // PS ->                return false;
315         // PS ->     _mar->_parameters->setIntParam( marParameters::e_step_coeficient, ( int )tl );
316         // PS -> 
317         // PS ->     if (!edtMassPower->GetValue( ).ToLong( &tl ))
318         // PS ->                return false;
319         // PS ->     _mar->_parameters->setIntParam( marParameters::e_mass_power, ( int )tl );
320         // PS -> 
321         // PS ->     if (!edtROIDimension->GetValue( ).ToLong( &tl ))
322         // PS ->                return false;
323         // PS ->     _mar->_parameters->setIntParam( marParameters::e_roi_dimension, ( int )tl );
324         // PS -> 
325         // PS ->     if (!edtStep->GetValue( ).ToLong( &tl ))
326         // PS ->                return false;
327         // PS ->     _mar->_parameters->setIntParam( marParameters::e_step, ( int )tl );
328         // PS -> 
329         // PS -> //    _mar->_parameters->setBoolParam( marParameters::e_show_cell, chkShowCell->GetValue( ) );
330         // PS -> //    _mar->_parameters->setBoolParam( marParameters::e_show_int_cell, chkShowIntCell->GetValue( ) );
331         // PS -> 
332         // PS -> //    _mar->_parameters->setIntParam( marParameters::e_voxel_type, radNormal->GetValue( ) ? marParameters::VOX_TYPE_NORMAL: marParameters::VOX_TYPE_MINIMUM );
333         // PS ->     
334         // PS -> //     wxColour col2 = btnAxisColor->GetBackgroundColour( );
335         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_axis_color_r, col2.Red( ) );
336         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_axis_color_g, col2.Green( ) );
337         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_axis_color_b, col2.Blue( ) );
338         
339     // Contour parameters
340     if (!edtThresholdIsoContours->GetValue( ).ToDouble( &td ))
341                 return false;
342     _mar->_parameters->setDoubleParam( marParameters::e_threshold_isocontour, td );
343         
344         // PS -> //    if (!edtThresholdSnake->GetValue( ).ToDouble( &td ))
345         // PS -> //             return false;
346         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_threshold_snake_isocontour, td );
347         // PS -> 
348         // PS -> //    if (!edtExternCoefSnake->GetValue( ).ToDouble( &td ))
349         // PS -> //             return false;
350         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_extern_coeficient, td );
351         // PS -> 
352         // PS -> //    if (!edtBallonCoefDeriche->GetValue( ).ToDouble( &td ))
353         // PS -> //             return false;
354         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_ballon_coeficient, td );
355         // PS -> 
356         // PS -> //    if (!edtGradientCoefDeriche->GetValue( ).ToDouble( &td ))
357         // PS -> //             return false;
358         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_gradient_coeficient, td );
359         // PS -> 
360         // PS -> //    if (!edtSigmaDeriche->GetValue( ).ToDouble( &td ))
361         // PS -> //             return false;
362         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_sigma, td );
363         // PS -> 
364         // PS -> //    if (!edtScale->GetValue( ).ToDouble( &td ))
365         // PS -> //             return false;
366         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_scale, td );
367         // PS -> 
368         // PS -> //   if (!edtSample->GetValue( ).ToDouble( &td ))
369         // PS -> //             return false;
370         // PS -> //    _mar->_parameters->setDoubleParam( marParameters::e_sampling, td );
371         // PS -> 
372         // PS -> //    if (!edtIterationsSnake->GetValue( ).ToLong( &tl ))
373         // PS -> //             return false;
374         // PS -> //    _mar->_parameters->setIntParam( marParameters::e_number_of_iterations_snake_isocontour, ( int )tl );
375         // PS -> 
376         // PS -> //    if (!edtIterationsDeriche->GetValue( ).ToLong( &tl ))
377         // PS -> //             return false;
378         // PS -> //    _mar->_parameters->setIntParam( marParameters::e_number_of_iterations_snake_deriche, ( int )tl );
379         
380 //EED    _mar->_parameters->setBoolParam( marParameters::e_debug_isocontour, chkIsoContoursVis->GetValue( ) );
381 //EED    _mar->_parameters->setBoolParam( marParameters::e_debug_diameters, chkDiametersVis->GetValue( ) );
382 //EED    _mar->_parameters->setBoolParam( marParameters::e_invest_slice_order, chkInvertSliceOrder->GetValue( ) );
383         // PS -> //    _mar->_parameters->setBoolParam( marParameters::e_debug_fill_area, chkFillContours->GetValue( ) );
384         // PS -> //    ti = 0;
385         // PS -> //    ti = radIsoContours->GetValue( ) ? marParameters::ISOCONTOURS: ti;
386         // PS -> //    ti = radSnake->GetValue( ) ? marParameters::SNAKE: ti;
387         // PS -> //    ti = radDeriche->GetValue( ) ? marParameters::DERICHE: ti;
388     ti = marParameters::ISOCONTOURS;
389         _mar->_parameters->setIntParam( marParameters::e_algorithm_type, ti );
390         
391 /* // EED borrame
392     // Quantification parameters
393     ti = 0;
394     ti |= chkArea->GetValue( ) ? marParameters::TYPE_AREA: 0;
395     ti |= chkPerimeter->GetValue( ) ? marParameters::TYPE_PERIMETER: 0;
396     ti |= chkDiameterFromArea->GetValue( ) ? marParameters::TYPE_DIAMETER_FROM_AREA: 0;
397     ti |= chkDiameterFromPerimeter->GetValue( ) ? marParameters::TYPE_DIAMETER_FROM_PERIMETER: 0;
398     ti |= chkMinimumDiameter->GetValue( ) ? marParameters::TYPE_MINIMUM_DIAMETER: 0;
399     ti |= chkMaximumDiameter->GetValue( ) ? marParameters::TYPE_MAXIMUM_DIAMETER: 0;
400     ti |= chkAverageDiameter->GetValue( ) ? marParameters::TYPE_AVERAGE_DIAMETER: 0;
401     _mar->_parameters->setIntParam( marParameters::e_quantification_type, ti );
402     ti = 0;
403     ti = radArea->GetValue( ) ? marParameters::TYPE_AREA: ti;
404     ti = radPerimeter->GetValue( ) ? marParameters::TYPE_PERIMETER: ti;
405     ti = radDiameterFromArea->GetValue( ) ? marParameters::TYPE_DIAMETER_FROM_AREA: ti;
406     ti = radDiameterFromPerimeter->GetValue( )? marParameters::TYPE_DIAMETER_FROM_PERIMETER: ti;
407     ti = radMinimumDiameter->GetValue( ) ? marParameters::TYPE_MINIMUM_DIAMETER: ti;
408     ti = radMaximumDiameter->GetValue( ) ? marParameters::TYPE_MAXIMUM_DIAMETER: ti;
409     ti = radAverageDiameter->GetValue( ) ? marParameters::TYPE_AVERAGE_DIAMETER: ti;
410     _mar->_parameters->setIntParam( marParameters::e_stenosis_type, ti );
411 */
412
413         SetBakEdit();
414
415         if (alertRegenerateAll==true){
416                 wxCommandEvent ev19999(wxEVT_COMMAND_MENU_SELECTED,19999);
417                 _parent->ProcessEvent( ev19999 );
418
419 /* EED Borrame
420                 // Clear Interface
421                 if ( wxwinquan!=NULL            ) { wxwinquan->Clean3D(true);   }
422                 if ( wxwin3DBrowser!=NULL   ) { wxwin3DBrowser->Clean3D();      }
423                 // Model Regeneration
424                 _mar->_experiment->RegenerateAxis();
425                 // Refresh Interface
426                 if ( wxwinquan!=NULL            ) { 
427                         wxwinquan->AddAxisActors();
428                         wxwinquan->RefreshAxis();                               
429                 }
430                 if ( wxwin3DBrowser!=NULL       ) { 
431                         wxwin3DBrowser->AddAxisActors();
432                         wxwin3DBrowser->RefreshAxis();
433                 }
434 */
435         }
436
437         if (alertRegenerateSplineAxe==true){
438                 wxCommandEvent ev19998(wxEVT_COMMAND_MENU_SELECTED,19998);
439                 _parent->ProcessEvent( ev19998 );
440 /* EED Borrame
441                 // Clear Interface
442                 if ( wxwinquan!=NULL            ) { wxwinquan->Clean3D(true);   }
443                 if ( wxwin3DBrowser!=NULL   ) { wxwin3DBrowser->Clean3D();      }
444                 // Model Regeneration
445                 _mar->_experiment->RecalculateAxis();
446                 // Refresh Interface
447                 if ( wxwinquan!=NULL            ) { 
448                         wxwinquan->AddAxisActors();
449                         wxwinquan->RefreshAxis();                               
450                 }
451                 if ( wxwin3DBrowser!=NULL       ) { 
452                         wxwin3DBrowser->AddAxisActors();
453                         wxwin3DBrowser->RefreshAxis();
454                 }
455 */
456         }
457
458
459         if (alertClearContours==true) {
460                 wxCommandEvent ev19997(wxEVT_COMMAND_MENU_SELECTED,19997);
461                 _parent->ProcessEvent( ev19997 );
462 /* EED Borrame
463                 // Update Interface
464                 if ( wxwinquan!=NULL   ) { wxwinquan->Clean3D(false);           }
465                 // Model Regeneration
466                 _mar->_experiment->ClearContours();
467                 // Refresh Interface
468                 if ( wxwinquan!=NULL   ) { wxwinquan->RefreshAxis();    }
469 */
470         }
471
472         if (alertRegenerateSignal==true) {
473                 wxCommandEvent ev19996(wxEVT_COMMAND_MENU_SELECTED,19996);
474                 _parent->ProcessEvent( ev19996 );
475 /* EED Borrame
476                 // Update Interface
477                 if ( wxwinquan!=NULL   ) { wxwinquan->Clean3D(false);           }
478                 // Model Regeneration
479                 _mar->_experiment->RegenerateSignal();
480                 // Refresh Interface
481                 if ( wxwinquan!=NULL   ) { wxwinquan->RefreshAxis();    }
482 */
483         }
484
485         
486
487
488     
489         if (!_mar->saveParameters( ))
490                 return false;
491
492
493         return true;
494         
495 }
496 // ----------------------------------------------------------------------------
497 void wxMaracasParametersDialog::SetBakEdit(){
498         _bak_edtThresholdIsoContours_String = edtThresholdIsoContours->GetValue(); 
499         _bak_edtFlexionCoef_String                      = edtFlexionCoef->GetValue(); 
500         _bak_edtTensionCoef_String                      = edtTensionCoef->GetValue(); 
501         _bak_edtMaskSize_String                         = edtMaskSize->GetValue(); 
502         _bak_edtDiscreetStep_String                     = edtDiscreetStep->GetValue(); 
503 }
504 // ----------------------------------------------------------------------------
505 void wxMaracasParametersDialog::OnOk( wxCommandEvent& WXUNUSED( event ) )
506 {
507     if (Apply( )) {
508                 EndModal( wxID_OK );
509         } else {
510                 wxMessageDialog(this,_T("Error : Bad Parameters"),_T("Error"),wxOK|wxICON_ERROR).ShowModal();
511         }
512 }
513 // ----------------------------------------------------------------------------
514 void wxMaracasParametersDialog::OnCancel( wxCommandEvent& WXUNUSED( event ) )
515 {
516     EndModal( wxID_CANCEL );
517 }
518 // ----------------------------------------------------------------------------
519 void wxMaracasParametersDialog::OnReset( wxCommandEvent& WXUNUSED( event ) )
520 {
521     Reset( );
522         
523 }
524 // ----------------------------------------------------------------------------
525 void wxMaracasParametersDialog::OnDefault( wxCommandEvent& WXUNUSED( event ) )
526 {
527         _mar->_parameters->reset();
528     Reset( );
529         
530 }
531 // ----------------------------------------------------------------------------
532 void wxMaracasParametersDialog::OnApply( wxCommandEvent& WXUNUSED( event ) )
533 {
534     if (!Apply( ))
535         {
536                 wxMessageDialog(this,_T("Error : Bad Parameters"),_T("Error"),wxOK|wxICON_ERROR).ShowModal();
537         }
538         
539 }
540 // ----------------------------------------------------------------------------
541 // PS -> void wxMaracasParametersDialog::OnBrowseWorkDir( wxCommandEvent& WXUNUSED( event ) )
542 // PS -> {
543 // PS -> //    wxString dirHome = edtWorkDir->GetValue( );
544 // PS -> //    wxDirDialog dialog( this, "Choose a work directory...", ( !dirHome.IsEmpty( ) )? dirHome: wxGetHomeDir( ) );
545 // PS ->        
546 // PS -> //    if( dialog.ShowModal( ) == wxID_OK ) {
547 // PS -> //        edtWorkDir->SetValue( dialog.GetPath( ) );
548 // PS ->         //! \todo if dir has change ... should update marGdcm
549 // PS -> //    }
550 // PS ->        
551 // PS -> }
552 // ----------------------------------------------------------------------------
553 // PS -> void wxMaracasParametersDialog::OnBrowseDICOMDir( wxCommandEvent& WXUNUSED( event ) )
554 // PS -> {
555 // PS ->     wxString dirHome = edtDICOMDir->GetValue( );
556 // PS ->     wxDirDialog dialog( this, "Choose a DICOM directory...", ( !dirHome.IsEmpty( ) )? dirHome: wxGetHomeDir( ) );
557 // PS ->        
558 // PS ->     if( dialog.ShowModal( ) == wxID_OK ) 
559 // PS ->         edtDICOMDir->SetValue( dialog.GetPath( ) );
560 // PS -> }
561 // ----------------------------------------------------------------------------
562 // PS -> void wxMaracasParametersDialog::OnChoose3DColor( wxCommandEvent& WXUNUSED( event ) )
563 // PS -> {
564 // PS -> //    wxColourData data;
565 // PS -> //    data.SetChooseFull( true );
566 // PS -> //    for( int i = 0; i < 16; i++ )
567 // PS -> //    {
568 // PS -> //        wxColour colour( i * 16, i * 16, i * 16 );
569 // PS -> //        data.SetCustomColour( i, colour );
570 // PS -> //    } // rof
571 // PS -> //     
572 // PS -> //    wxColourDialog dialog ( this, &data );
573 // PS -> //    dialog.SetTitle( "Choose a 3D background color" );
574 // PS -> //    if( dialog.ShowModal( ) == wxID_OK )
575 // PS -> //    {
576 // PS -> //        wxColourData retData = dialog.GetColourData( );
577 // PS -> //        wxColour col = retData.GetColour( );
578 // PS -> //        btn3DBackColor->SetBackgroundColour( col );
579 // PS -> //    } // fi
580 // PS ->        
581 // PS -> }
582 // ----------------------------------------------------------------------------
583 // PS -> void wxMaracasParametersDialog::OnChooseAxisColor( wxCommandEvent& WXUNUSED( event ) )
584 // PS -> {
585 // PS -> //    wxColourData data;
586 // PS -> //    data.SetChooseFull( true );
587 // PS -> //    for( int i = 0; i < 16; i++ )
588 // PS -> //   {
589 // PS -> //        wxColour colour( i * 16, i * 16, i * 16 );
590 // PS -> //        data.SetCustomColour( i, colour );
591 // PS -> //    } // rof
592 // PS ->        
593 // PS -> //    wxColourDialog dialog ( this, &data );
594 // PS -> //    dialog.SetTitle( "Choose an axis color" );
595 // PS -> //    if( dialog.ShowModal( ) == wxID_OK )
596 // PS -> //    {
597 // PS -> //             wxColourData retData = dialog.GetColourData( );
598 // PS -> //             wxColour col = retData.GetColour( );
599 // PS -> //             btnAxisColor->SetBackgroundColour( col );
600 // PS -> //    } // fi
601 // PS -> }
602
603 // EOF - wxGeneralParametersDialog.cxx