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