00001 /*========================================================================= 00002 00003 Program: wxMaracas 00004 Module: $RCSfile: wxMaracasParametersDialog.cxx,v $ 00005 Language: C++ 00006 Date: $Date: 2009/05/14 13:54:54 $ 00007 Version: $Revision: 1.1 $ 00008 00009 Copyright: (c) 2002, 2003 00010 License: 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notice for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "wxMaracasParametersDialog.h" 00019 #include "marDictionary.h" 00020 00021 // ---------------------------------------------------------------------------- 00022 BEGIN_EVENT_TABLE( wxMaracasParametersDialog, wxDialog ) 00023 EVT_BUTTON( wxID_OK, wxMaracasParametersDialog::OnOk ) 00024 EVT_BUTTON( wxID_CANCEL, wxMaracasParametersDialog::OnCancel ) 00025 EVT_BUTTON( ID_BTN_DEFAULT, wxMaracasParametersDialog::OnDefault ) 00026 EVT_BUTTON( ID_BTN_RESET, wxMaracasParametersDialog::OnReset ) 00027 EVT_BUTTON( ID_BTN_APPLY, wxMaracasParametersDialog::OnApply ) 00028 // PS -> EVT_BUTTON( ID_BTN_BROWSE_WORK_DIR, wxMaracasParametersDialog::OnBrowseWorkDir ) 00029 // PS -> EVT_BUTTON( ID_BTN_BROWSE_DICOM_DIR, wxMaracasParametersDialog::OnBrowseDICOMDir ) 00030 // PS -> EVT_BUTTON( ID_BTN_3D_BACK_COLOR, wxMaracasParametersDialog::OnChoose3DColor ) 00031 // PS -> EVT_BUTTON( ID_BTN_AXIS_COLOR, wxMaracasParametersDialog::OnChooseAxisColor ) 00032 END_EVENT_TABLE( ); 00033 00034 // ---------------------------------------------------------------------------- 00035 wxMaracasParametersDialog::wxMaracasParametersDialog( wxWindow* parent, marInterface* mar ) 00036 : wxParametersDialog( parent, -1, _T("")) 00037 { 00038 _parent=parent; 00039 _mar = mar; 00040 Reset( ); 00041 00042 SetBakEdit(); 00043 } 00044 00045 // ---------------------------------------------------------------------------- 00046 void wxMaracasParametersDialog::Reset( ) 00047 { 00048 // PS -> // wxColour col, col2; 00049 int qt, st; 00050 00051 // General parameters 00052 // PS -> // edtWorkDir->SetValue( _mar->_parameters->getStringParam( marParameters::e_installation_directory ) ); 00053 // PS -> edtDICOMDir->SetValue( _mar->_parameters->getStringParam( marParameters::e_dicom_images_directory ) ); 00054 // PS -> chkMIP->SetValue( _mar->_parameters->getBoolParam( marParameters::e_calculate_mip_default ) ); 00055 // PS -> chkSlices->SetValue( _mar->_parameters->getBoolParam( marParameters::e_choose_all_slices_default ) ); 00056 // PS -> chkDebugWindow->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_window_visible ) ); 00057 // PS -> chkConsole->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_console_visible ) ); 00058 // PS -> // col.Set( 00059 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_back_color_3D_r ), 00060 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_back_color_3D_g ), 00061 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_back_color_3D_b ) 00062 // PS -> // ); 00063 // PS -> // btn3DBackColor->SetBackgroundColour( col ); 00064 00065 // Contour parameters 00066 edtThresholdIsoContours->SetValue( wxString::Format( _T("%.2f"), 00067 _mar->_parameters->getDoubleParam( marParameters::e_threshold_isocontour ) ) ); 00068 // PS -> // edtThresholdSnake->SetValue( wxString::Format( "%.4f", 00069 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_threshold_snake_isocontour ) ) ); 00070 // PS -> // edtIterationsSnake->SetValue( wxString::Format( "%d", 00071 // PS -> // _mar->_parameters->getIntParam( marParameters::e_number_of_iterations_snake_isocontour ) ) ); 00072 // PS -> // edtExternCoefSnake->SetValue( wxString::Format( "%.4f", 00073 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_extern_coeficient ) ) ); 00074 // PS -> // edtIterationsDeriche->SetValue( wxString::Format( "%d", 00075 // PS -> // _mar->_parameters->getIntParam( marParameters::e_number_of_iterations_snake_deriche ) ) ); 00076 // PS -> // edtBallonCoefDeriche->SetValue( wxString::Format( "%.4f", 00077 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_ballon_coeficient ) ) ); 00078 // PS -> // edtGradientCoefDeriche->SetValue( wxString::Format( "%.4f", 00079 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_gradient_coeficient ) ) ); 00080 // PS -> // edtSigmaDeriche->SetValue( wxString::Format( "%.4f", 00081 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_sigma ) ) ); 00082 // PS -> // edtScale->SetValue( wxString::Format( "%.4f", 00083 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_scale ) ) ); 00084 // PS -> // edtSample->SetValue( wxString::Format( "%.4f", 00085 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_sampling ) ) ); 00086 //EED chkIsoContoursVis->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_isocontour ) ); 00087 //EED chkDiametersVis->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_diameters ) ); 00088 //EED chkInvertSliceOrder->SetValue( _mar->_parameters->getBoolParam( marParameters::e_invest_slice_order ) ); 00089 // PS -> // chkFillContours->SetValue( _mar->_parameters->getBoolParam( marParameters::e_debug_fill_area ) ); 00090 // PS -> // radIsoContours->SetValue( _mar->_parameters->getIntParam( marParameters::e_algorithm_type ) == marParameters::ISOCONTOURS ); 00091 // PS -> // radSnake->SetValue( _mar->_parameters->getIntParam( marParameters::e_algorithm_type ) == marParameters::SNAKE ); 00092 // PS -> // radDeriche->SetValue( _mar->_parameters->getIntParam( marParameters::e_algorithm_type ) == marParameters::DERICHE ); 00093 00094 00095 // Axis parameters 00096 // PS -> // edtDistanceCdg->SetValue( wxString::Format( "%.4f", 00097 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_gravity_distance ) ) ); 00098 edtFlexionCoef->SetValue( wxString::Format( _T("%g"), 00099 _mar->_parameters->getDoubleParam( marParameters::e_flexion_coeficient ) ) ); 00100 edtTensionCoef->SetValue( wxString::Format( _T("%g"), 00101 _mar->_parameters->getDoubleParam( marParameters::e_tension_coeficient ) ) ); 00102 int sizemask = _mar->_parameters->getIntParam( marParameters::e_mask_size ); 00103 sizemask=(sizemask-1)/2; 00104 edtMaskSize->SetValue( wxString::Format( _T("%d"), sizemask ) ); 00105 edtDiscreetStep->SetValue( wxString::Format( _T("%#.2f"), 00106 _mar->_parameters->getDoubleParam( marParameters::e_axis_discret_step ) ) ); 00107 // PS -> // edtVoxelX->SetValue( wxString::Format( "%.4f", 00108 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_voxel_x_dimension ) ) ); 00109 // PS -> // edtVoxelY->SetValue( wxString::Format( "%.4f", 00110 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_voxel_y_dimension ) ) ); 00111 // PS -> // edtVoxelZ->SetValue( wxString::Format( "%.4f", 00112 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_voxel_z_dimension ) ) ); 00113 // PS -> edtDistanceInt->SetValue( wxString::Format( "%.4f", 00114 // PS -> _mar->_parameters->getDoubleParam( marParameters::e_distance_to_maximum_intensity ) ) ); 00115 // PS -> edtCellMaxIntCoef->SetValue( wxString::Format( "%d", 00116 // PS -> _mar->_parameters->getIntParam( marParameters::e_coef_cell_max_int ) ) ); 00117 // PS -> edtCellCoef->SetValue( wxString::Format( "%.4f", 00118 // PS -> _mar->_parameters->getDoubleParam( marParameters::e_cell_coeficient ) ) ); 00119 // PS -> edtStepCoef->SetValue( wxString::Format( "%d", 00120 // PS -> _mar->_parameters->getIntParam( marParameters::e_step_coeficient ) ) ); 00121 // PS -> edtMassPower->SetValue( wxString::Format( "%d", 00122 // PS -> _mar->_parameters->getIntParam( marParameters::e_mass_power ) ) ); 00123 // PS -> edtROIDimension->SetValue( wxString::Format( "%d", 00124 // PS -> _mar->_parameters->getIntParam( marParameters::e_roi_dimension ) ) ); 00125 // PS -> edtStep->SetValue( wxString::Format( "%d", 00126 // PS -> _mar->_parameters->getIntParam( marParameters::e_step ) ) ); 00127 // PS -> // chkShowCell->SetValue( _mar->_parameters->getBoolParam( marParameters::e_show_cell ) ); 00128 // PS -> // chkShowIntCell->SetValue( _mar->_parameters->getBoolParam( marParameters::e_show_int_cell ) ); 00129 // PS -> // radMinimum->SetValue( _mar->_parameters->getIntParam( marParameters::e_voxel_type ) == marParameters::VOX_TYPE_MINIMUM ); 00130 // PS -> // radNormal->SetValue( _mar->_parameters->getIntParam( marParameters::e_voxel_type ) == marParameters::VOX_TYPE_NORMAL ); 00131 // PS -> // col2.Set( 00132 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_axis_color_r ), 00133 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_axis_color_g ), 00134 // PS -> // _mar->_parameters->getDoubleParam( marParameters::e_axis_color_b ) 00135 // PS -> // ); 00136 // PS -> // btnAxisColor->SetBackgroundColour( col2 ); 00137 00138 00139 // Quantification parameters 00140 qt = _mar->_parameters->getIntParam( marParameters::e_quantification_type ); 00141 st = _mar->_parameters->getIntParam( marParameters::e_stenosis_type ); 00142 00143 /* // EED borrame 00144 chkArea->SetValue( ( qt & marParameters::TYPE_AREA ) == marParameters::TYPE_AREA ); 00145 chkPerimeter->SetValue( ( qt & marParameters::TYPE_PERIMETER ) == marParameters::TYPE_PERIMETER ); 00146 chkDiameterFromArea->SetValue( ( qt & marParameters::TYPE_DIAMETER_FROM_AREA ) == marParameters::TYPE_DIAMETER_FROM_AREA ); 00147 chkDiameterFromPerimeter->SetValue( ( qt & marParameters::TYPE_DIAMETER_FROM_PERIMETER ) == marParameters::TYPE_DIAMETER_FROM_PERIMETER ); 00148 chkMinimumDiameter->SetValue( ( qt & marParameters::TYPE_MINIMUM_DIAMETER ) == marParameters::TYPE_MINIMUM_DIAMETER ); 00149 chkMaximumDiameter->SetValue( ( qt & marParameters::TYPE_MAXIMUM_DIAMETER ) == marParameters::TYPE_MAXIMUM_DIAMETER ); 00150 chkAverageDiameter->SetValue( ( qt & marParameters::TYPE_AVERAGE_DIAMETER ) == marParameters::TYPE_AVERAGE_DIAMETER ); 00151 radArea->SetValue( st == marParameters::TYPE_AREA ); 00152 radPerimeter->SetValue( st == marParameters::TYPE_PERIMETER ); 00153 radDiameterFromArea->SetValue( st == marParameters::TYPE_DIAMETER_FROM_AREA ); 00154 radDiameterFromPerimeter->SetValue( st == marParameters::TYPE_DIAMETER_FROM_PERIMETER ); 00155 radMinimumDiameter->SetValue( st == marParameters::TYPE_MINIMUM_DIAMETER ); 00156 radMaximumDiameter->SetValue( st == marParameters::TYPE_MAXIMUM_DIAMETER ); 00157 radAverageDiameter->SetValue( st == marParameters::TYPE_AVERAGE_DIAMETER ); 00158 */ 00159 } 00160 // ---------------------------------------------------------------------------- 00161 bool wxMaracasParametersDialog::Apply( ) 00162 { 00163 marDictionary marDict; 00164 char tmp[256]; 00165 00166 bool alertRegenerateAll = false; 00167 bool alertRegenerateSignal = false; 00168 bool alertClearContours = false; 00169 bool alertRegenerateSplineAxe = false; 00170 00171 wxMessageDialog *wxdiag; 00172 wxString wxtext; 00173 00174 if ( _bak_edtMaskSize_String.CompareTo( edtMaskSize->GetValue().GetData() )!=0 ) { 00175 alertRegenerateSignal=true; 00176 strcpy(tmp , marDict.GetString(605) ); strcat(tmp,"\n"); 00177 wxtext=wxString(tmp, wxConvUTF8); //"The mask size was modified. \n" 00178 } 00179 if ( _bak_edtThresholdIsoContours_String.CompareTo( edtThresholdIsoContours->GetValue().GetData() )!=0 ) { 00180 alertClearContours=true; 00181 strcpy(tmp , marDict.GetString(610) ); strcat(tmp,"\n"); 00182 wxtext=wxString(tmp, wxConvUTF8); //"The threshold was modified. \n" 00183 } 00184 if ( _bak_edtFlexionCoef_String.CompareTo( edtFlexionCoef->GetValue().GetData() )!=0 ) { 00185 alertRegenerateAll=true; 00186 strcpy(tmp , marDict.GetString(615) ); strcat(tmp,"\n"); 00187 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"The flexion coeficient was modified.\n" 00188 } 00189 if ( _bak_edtTensionCoef_String.CompareTo( edtTensionCoef->GetValue().GetData() )!=0 ) { 00190 alertRegenerateAll=true; 00191 strcpy(tmp , marDict.GetString(620) ); strcat(tmp,"\n"); 00192 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"The tension coeficient was modified.\n" 00193 } 00194 if ( _bak_edtDiscreetStep_String.CompareTo( edtDiscreetStep->GetValue().GetData() )!=0 ) { 00195 alertRegenerateSplineAxe=true; 00196 strcpy(tmp , marDict.GetString(625) ); strcat(tmp,"\n"); 00197 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"The discret step of the axis was modified.\n" 00198 } 00199 00200 if ((alertRegenerateAll==true) ||(alertRegenerateSplineAxe==true) ) { 00201 strcpy(tmp,"\n"); strcat(tmp , marDict.GetString(630) ); strcat(tmp,"\n"); 00202 wxtext=wxtext+wxString(tmp, wxConvUTF8);//"\n The axe will be regenereted and the contours will be eresed. \n" 00203 } else { 00204 if ((alertRegenerateAll==true) ||(alertRegenerateSplineAxe==true) ) { 00205 strcpy(tmp,"\n"); strcat(tmp , marDict.GetString(635) ); strcat(tmp,"\n"); 00206 wxtext=wxtext+wxString(tmp, wxConvUTF8); //"\n All contours will be erase. \n" 00207 } 00208 } 00209 00210 if ( (alertRegenerateAll==true) || 00211 (alertClearContours==true) || 00212 (alertRegenerateSignal==true) || 00213 (alertRegenerateSplineAxe==true) ) { 00214 strcpy(tmp,"\n"); strcat(tmp , marDict.GetString(640) ); 00215 wxdiag= new wxMessageDialog(this, wxtext + wxString(tmp, wxConvUTF8), wxString(marDict.GetString(645), wxConvUTF8), wxOK | wxCANCEL);//"\n Do you want to continue?" "Alert" 00216 if ( wxdiag->ShowModal() != wxID_OK ) { 00217 return true; 00218 } 00219 wxdiag->Destroy(); 00220 } 00221 00222 00223 // PS -> // wxColour col; 00224 double td; 00225 long tl; 00226 int ti; 00227 00228 // General parameters 00229 00230 // PS -> // _mar->_parameters->setStringParam( marParameters::e_installation_directory, edtWorkDir->GetValue( ) ); 00231 // PS -> _mar->_parameters->setStringParam( marParameters::e_dicom_images_directory, edtDICOMDir->GetValue( ) ); 00232 00233 // PS -> _mar->_parameters->setBoolParam( marParameters::e_calculate_mip_default, chkMIP->GetValue( ) ); 00234 // PS -> _mar->_parameters->setBoolParam( marParameters::e_choose_all_slices_default, chkSlices->GetValue( ) ); 00235 // PS -> _mar->_parameters->setBoolParam( marParameters::e_debug_window_visible, chkDebugWindow->GetValue( ) ); 00236 // PS -> _mar->_parameters->setBoolParam( marParameters::e_debug_console_visible, chkConsole->GetValue( ) ); 00237 00238 // PS -> // col = btn3DBackColor->GetBackgroundColour( ); 00239 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_back_color_3D_r, col.Red( ) ); 00240 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_back_color_3D_g, col.Green( ) ); 00241 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_back_color_3D_b, col.Blue( ) ); 00242 // PS -> 00243 // PS -> // Axis parameters 00244 // PS -> // if (!edtDistanceCdg->GetValue( ).ToDouble( &td )) 00245 // PS -> // return false; 00246 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_gravity_distance, td ); 00247 00248 if (!edtFlexionCoef->GetValue( ).ToDouble( &td )) 00249 return false; 00250 _mar->_parameters->setDoubleParam( marParameters::e_flexion_coeficient, td ); 00251 00252 if (!edtTensionCoef->GetValue( ).ToDouble( &td )) 00253 return false; 00254 _mar->_parameters->setDoubleParam( marParameters::e_tension_coeficient, td ); 00255 00256 if (!edtDiscreetStep->GetValue( ).ToDouble( &td )) 00257 return false; 00258 _mar->_parameters->setDoubleParam( marParameters::e_axis_discret_step, td ); 00259 00260 // PS -> // if (!edtVoxelX->GetValue( ).ToDouble( &td )) 00261 // PS -> // return false; 00262 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, td ); 00263 // PS -> 00264 // PS -> // if (!edtVoxelY->GetValue( ).ToDouble( &td )) 00265 // PS -> // return false; 00266 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, td ); 00267 // PS -> 00268 // PS -> // if (!edtVoxelZ->GetValue( ).ToDouble( &td )) 00269 // PS -> // return false; 00270 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, td ); 00271 // PS -> 00272 // PS -> if (!edtDistanceInt->GetValue( ).ToDouble( &td )) 00273 // PS -> return false; 00274 // PS -> _mar->_parameters->setDoubleParam( marParameters::e_distance_to_maximum_intensity, td ); 00275 // PS -> 00276 // PS -> if (!edtCellCoef->GetValue( ).ToDouble( &td )) 00277 // PS -> return false; 00278 // PS -> _mar->_parameters->setDoubleParam( marParameters::e_cell_coeficient, td ); 00279 // PS -> 00280 if (!edtMaskSize->GetValue( ).ToLong( &tl )) 00281 return false; 00282 _mar->_parameters->setIntParam( marParameters::e_mask_size, ( int )tl * 2 +1); 00283 00284 // PS -> if (!edtCellMaxIntCoef->GetValue( ).ToLong( &tl )) 00285 // PS -> return false; 00286 // PS -> _mar->_parameters->setIntParam( marParameters::e_coef_cell_max_int, ( int )tl ); 00287 // PS -> 00288 // PS -> if (!edtStepCoef->GetValue( ).ToLong( &tl )) 00289 // PS -> return false; 00290 // PS -> _mar->_parameters->setIntParam( marParameters::e_step_coeficient, ( int )tl ); 00291 // PS -> 00292 // PS -> if (!edtMassPower->GetValue( ).ToLong( &tl )) 00293 // PS -> return false; 00294 // PS -> _mar->_parameters->setIntParam( marParameters::e_mass_power, ( int )tl ); 00295 // PS -> 00296 // PS -> if (!edtROIDimension->GetValue( ).ToLong( &tl )) 00297 // PS -> return false; 00298 // PS -> _mar->_parameters->setIntParam( marParameters::e_roi_dimension, ( int )tl ); 00299 // PS -> 00300 // PS -> if (!edtStep->GetValue( ).ToLong( &tl )) 00301 // PS -> return false; 00302 // PS -> _mar->_parameters->setIntParam( marParameters::e_step, ( int )tl ); 00303 // PS -> 00304 // PS -> // _mar->_parameters->setBoolParam( marParameters::e_show_cell, chkShowCell->GetValue( ) ); 00305 // PS -> // _mar->_parameters->setBoolParam( marParameters::e_show_int_cell, chkShowIntCell->GetValue( ) ); 00306 // PS -> 00307 // PS -> // _mar->_parameters->setIntParam( marParameters::e_voxel_type, radNormal->GetValue( ) ? marParameters::VOX_TYPE_NORMAL: marParameters::VOX_TYPE_MINIMUM ); 00308 // PS -> 00309 // PS -> // wxColour col2 = btnAxisColor->GetBackgroundColour( ); 00310 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_axis_color_r, col2.Red( ) ); 00311 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_axis_color_g, col2.Green( ) ); 00312 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_axis_color_b, col2.Blue( ) ); 00313 00314 // Contour parameters 00315 if (!edtThresholdIsoContours->GetValue( ).ToDouble( &td )) 00316 return false; 00317 _mar->_parameters->setDoubleParam( marParameters::e_threshold_isocontour, td ); 00318 00319 // PS -> // if (!edtThresholdSnake->GetValue( ).ToDouble( &td )) 00320 // PS -> // return false; 00321 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_threshold_snake_isocontour, td ); 00322 // PS -> 00323 // PS -> // if (!edtExternCoefSnake->GetValue( ).ToDouble( &td )) 00324 // PS -> // return false; 00325 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_extern_coeficient, td ); 00326 // PS -> 00327 // PS -> // if (!edtBallonCoefDeriche->GetValue( ).ToDouble( &td )) 00328 // PS -> // return false; 00329 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_ballon_coeficient, td ); 00330 // PS -> 00331 // PS -> // if (!edtGradientCoefDeriche->GetValue( ).ToDouble( &td )) 00332 // PS -> // return false; 00333 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_gradient_coeficient, td ); 00334 // PS -> 00335 // PS -> // if (!edtSigmaDeriche->GetValue( ).ToDouble( &td )) 00336 // PS -> // return false; 00337 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_sigma, td ); 00338 // PS -> 00339 // PS -> // if (!edtScale->GetValue( ).ToDouble( &td )) 00340 // PS -> // return false; 00341 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_scale, td ); 00342 // PS -> 00343 // PS -> // if (!edtSample->GetValue( ).ToDouble( &td )) 00344 // PS -> // return false; 00345 // PS -> // _mar->_parameters->setDoubleParam( marParameters::e_sampling, td ); 00346 // PS -> 00347 // PS -> // if (!edtIterationsSnake->GetValue( ).ToLong( &tl )) 00348 // PS -> // return false; 00349 // PS -> // _mar->_parameters->setIntParam( marParameters::e_number_of_iterations_snake_isocontour, ( int )tl ); 00350 // PS -> 00351 // PS -> // if (!edtIterationsDeriche->GetValue( ).ToLong( &tl )) 00352 // PS -> // return false; 00353 // PS -> // _mar->_parameters->setIntParam( marParameters::e_number_of_iterations_snake_deriche, ( int )tl ); 00354 00355 //EED _mar->_parameters->setBoolParam( marParameters::e_debug_isocontour, chkIsoContoursVis->GetValue( ) ); 00356 //EED _mar->_parameters->setBoolParam( marParameters::e_debug_diameters, chkDiametersVis->GetValue( ) ); 00357 //EED _mar->_parameters->setBoolParam( marParameters::e_invest_slice_order, chkInvertSliceOrder->GetValue( ) ); 00358 // PS -> // _mar->_parameters->setBoolParam( marParameters::e_debug_fill_area, chkFillContours->GetValue( ) ); 00359 // PS -> // ti = 0; 00360 // PS -> // ti = radIsoContours->GetValue( ) ? marParameters::ISOCONTOURS: ti; 00361 // PS -> // ti = radSnake->GetValue( ) ? marParameters::SNAKE: ti; 00362 // PS -> // ti = radDeriche->GetValue( ) ? marParameters::DERICHE: ti; 00363 ti = marParameters::ISOCONTOURS; 00364 _mar->_parameters->setIntParam( marParameters::e_algorithm_type, ti ); 00365 00366 /* // EED borrame 00367 // Quantification parameters 00368 ti = 0; 00369 ti |= chkArea->GetValue( ) ? marParameters::TYPE_AREA: 0; 00370 ti |= chkPerimeter->GetValue( ) ? marParameters::TYPE_PERIMETER: 0; 00371 ti |= chkDiameterFromArea->GetValue( ) ? marParameters::TYPE_DIAMETER_FROM_AREA: 0; 00372 ti |= chkDiameterFromPerimeter->GetValue( ) ? marParameters::TYPE_DIAMETER_FROM_PERIMETER: 0; 00373 ti |= chkMinimumDiameter->GetValue( ) ? marParameters::TYPE_MINIMUM_DIAMETER: 0; 00374 ti |= chkMaximumDiameter->GetValue( ) ? marParameters::TYPE_MAXIMUM_DIAMETER: 0; 00375 ti |= chkAverageDiameter->GetValue( ) ? marParameters::TYPE_AVERAGE_DIAMETER: 0; 00376 _mar->_parameters->setIntParam( marParameters::e_quantification_type, ti ); 00377 ti = 0; 00378 ti = radArea->GetValue( ) ? marParameters::TYPE_AREA: ti; 00379 ti = radPerimeter->GetValue( ) ? marParameters::TYPE_PERIMETER: ti; 00380 ti = radDiameterFromArea->GetValue( ) ? marParameters::TYPE_DIAMETER_FROM_AREA: ti; 00381 ti = radDiameterFromPerimeter->GetValue( )? marParameters::TYPE_DIAMETER_FROM_PERIMETER: ti; 00382 ti = radMinimumDiameter->GetValue( ) ? marParameters::TYPE_MINIMUM_DIAMETER: ti; 00383 ti = radMaximumDiameter->GetValue( ) ? marParameters::TYPE_MAXIMUM_DIAMETER: ti; 00384 ti = radAverageDiameter->GetValue( ) ? marParameters::TYPE_AVERAGE_DIAMETER: ti; 00385 _mar->_parameters->setIntParam( marParameters::e_stenosis_type, ti ); 00386 */ 00387 00388 SetBakEdit(); 00389 00390 if (alertRegenerateAll==true){ 00391 wxCommandEvent ev19999(wxEVT_COMMAND_MENU_SELECTED,19999); 00392 _parent->ProcessEvent( ev19999 ); 00393 00394 /* EED Borrame 00395 // Clear Interface 00396 if ( wxwinquan!=NULL ) { wxwinquan->Clean3D(true); } 00397 if ( wxwin3DBrowser!=NULL ) { wxwin3DBrowser->Clean3D(); } 00398 // Model Regeneration 00399 _mar->_experiment->RegenerateAxis(); 00400 // Refresh Interface 00401 if ( wxwinquan!=NULL ) { 00402 wxwinquan->AddAxisActors(); 00403 wxwinquan->RefreshAxis(); 00404 } 00405 if ( wxwin3DBrowser!=NULL ) { 00406 wxwin3DBrowser->AddAxisActors(); 00407 wxwin3DBrowser->RefreshAxis(); 00408 } 00409 */ 00410 } 00411 00412 if (alertRegenerateSplineAxe==true){ 00413 wxCommandEvent ev19998(wxEVT_COMMAND_MENU_SELECTED,19998); 00414 _parent->ProcessEvent( ev19998 ); 00415 /* EED Borrame 00416 // Clear Interface 00417 if ( wxwinquan!=NULL ) { wxwinquan->Clean3D(true); } 00418 if ( wxwin3DBrowser!=NULL ) { wxwin3DBrowser->Clean3D(); } 00419 // Model Regeneration 00420 _mar->_experiment->RecalculateAxis(); 00421 // Refresh Interface 00422 if ( wxwinquan!=NULL ) { 00423 wxwinquan->AddAxisActors(); 00424 wxwinquan->RefreshAxis(); 00425 } 00426 if ( wxwin3DBrowser!=NULL ) { 00427 wxwin3DBrowser->AddAxisActors(); 00428 wxwin3DBrowser->RefreshAxis(); 00429 } 00430 */ 00431 } 00432 00433 00434 if (alertClearContours==true) { 00435 wxCommandEvent ev19997(wxEVT_COMMAND_MENU_SELECTED,19997); 00436 _parent->ProcessEvent( ev19997 ); 00437 /* EED Borrame 00438 // Update Interface 00439 if ( wxwinquan!=NULL ) { wxwinquan->Clean3D(false); } 00440 // Model Regeneration 00441 _mar->_experiment->ClearContours(); 00442 // Refresh Interface 00443 if ( wxwinquan!=NULL ) { wxwinquan->RefreshAxis(); } 00444 */ 00445 } 00446 00447 if (alertRegenerateSignal==true) { 00448 wxCommandEvent ev19996(wxEVT_COMMAND_MENU_SELECTED,19996); 00449 _parent->ProcessEvent( ev19996 ); 00450 /* EED Borrame 00451 // Update Interface 00452 if ( wxwinquan!=NULL ) { wxwinquan->Clean3D(false); } 00453 // Model Regeneration 00454 _mar->_experiment->RegenerateSignal(); 00455 // Refresh Interface 00456 if ( wxwinquan!=NULL ) { wxwinquan->RefreshAxis(); } 00457 */ 00458 } 00459 00460 00461 00462 00463 00464 if (!_mar->saveParameters( )) 00465 return false; 00466 00467 00468 return true; 00469 00470 } 00471 // ---------------------------------------------------------------------------- 00472 void wxMaracasParametersDialog::SetBakEdit(){ 00473 _bak_edtThresholdIsoContours_String = edtThresholdIsoContours->GetValue(); 00474 _bak_edtFlexionCoef_String = edtFlexionCoef->GetValue(); 00475 _bak_edtTensionCoef_String = edtTensionCoef->GetValue(); 00476 _bak_edtMaskSize_String = edtMaskSize->GetValue(); 00477 _bak_edtDiscreetStep_String = edtDiscreetStep->GetValue(); 00478 } 00479 // ---------------------------------------------------------------------------- 00480 void wxMaracasParametersDialog::OnOk( wxCommandEvent& WXUNUSED( event ) ) 00481 { 00482 if (Apply( )) { 00483 EndModal( wxID_OK ); 00484 } else { 00485 wxMessageDialog(this,_T("Error : Bad Parameters"),_T("Error"),wxOK|wxICON_ERROR).ShowModal(); 00486 } 00487 } 00488 // ---------------------------------------------------------------------------- 00489 void wxMaracasParametersDialog::OnCancel( wxCommandEvent& WXUNUSED( event ) ) 00490 { 00491 EndModal( wxID_CANCEL ); 00492 } 00493 // ---------------------------------------------------------------------------- 00494 void wxMaracasParametersDialog::OnReset( wxCommandEvent& WXUNUSED( event ) ) 00495 { 00496 Reset( ); 00497 00498 } 00499 // ---------------------------------------------------------------------------- 00500 void wxMaracasParametersDialog::OnDefault( wxCommandEvent& WXUNUSED( event ) ) 00501 { 00502 _mar->_parameters->reset(); 00503 Reset( ); 00504 00505 } 00506 // ---------------------------------------------------------------------------- 00507 void wxMaracasParametersDialog::OnApply( wxCommandEvent& WXUNUSED( event ) ) 00508 { 00509 if (!Apply( )) 00510 { 00511 wxMessageDialog(this,_T("Error : Bad Parameters"),_T("Error"),wxOK|wxICON_ERROR).ShowModal(); 00512 } 00513 00514 } 00515 // ---------------------------------------------------------------------------- 00516 // PS -> void wxMaracasParametersDialog::OnBrowseWorkDir( wxCommandEvent& WXUNUSED( event ) ) 00517 // PS -> { 00518 // PS -> // wxString dirHome = edtWorkDir->GetValue( ); 00519 // PS -> // wxDirDialog dialog( this, "Choose a work directory...", ( !dirHome.IsEmpty( ) )? dirHome: wxGetHomeDir( ) ); 00520 // PS -> 00521 // PS -> // if( dialog.ShowModal( ) == wxID_OK ) { 00522 // PS -> // edtWorkDir->SetValue( dialog.GetPath( ) ); 00523 // PS -> //! \todo if dir has change ... should update marGdcm 00524 // PS -> // } 00525 // PS -> 00526 // PS -> } 00527 // ---------------------------------------------------------------------------- 00528 // PS -> void wxMaracasParametersDialog::OnBrowseDICOMDir( wxCommandEvent& WXUNUSED( event ) ) 00529 // PS -> { 00530 // PS -> wxString dirHome = edtDICOMDir->GetValue( ); 00531 // PS -> wxDirDialog dialog( this, "Choose a DICOM directory...", ( !dirHome.IsEmpty( ) )? dirHome: wxGetHomeDir( ) ); 00532 // PS -> 00533 // PS -> if( dialog.ShowModal( ) == wxID_OK ) 00534 // PS -> edtDICOMDir->SetValue( dialog.GetPath( ) ); 00535 // PS -> } 00536 // ---------------------------------------------------------------------------- 00537 // PS -> void wxMaracasParametersDialog::OnChoose3DColor( wxCommandEvent& WXUNUSED( event ) ) 00538 // PS -> { 00539 // PS -> // wxColourData data; 00540 // PS -> // data.SetChooseFull( true ); 00541 // PS -> // for( int i = 0; i < 16; i++ ) 00542 // PS -> // { 00543 // PS -> // wxColour colour( i * 16, i * 16, i * 16 ); 00544 // PS -> // data.SetCustomColour( i, colour ); 00545 // PS -> // } // rof 00546 // PS -> // 00547 // PS -> // wxColourDialog dialog ( this, &data ); 00548 // PS -> // dialog.SetTitle( "Choose a 3D background color" ); 00549 // PS -> // if( dialog.ShowModal( ) == wxID_OK ) 00550 // PS -> // { 00551 // PS -> // wxColourData retData = dialog.GetColourData( ); 00552 // PS -> // wxColour col = retData.GetColour( ); 00553 // PS -> // btn3DBackColor->SetBackgroundColour( col ); 00554 // PS -> // } // fi 00555 // PS -> 00556 // PS -> } 00557 // ---------------------------------------------------------------------------- 00558 // PS -> void wxMaracasParametersDialog::OnChooseAxisColor( wxCommandEvent& WXUNUSED( event ) ) 00559 // PS -> { 00560 // PS -> // wxColourData data; 00561 // PS -> // data.SetChooseFull( true ); 00562 // PS -> // for( int i = 0; i < 16; i++ ) 00563 // PS -> // { 00564 // PS -> // wxColour colour( i * 16, i * 16, i * 16 ); 00565 // PS -> // data.SetCustomColour( i, colour ); 00566 // PS -> // } // rof 00567 // PS -> 00568 // PS -> // wxColourDialog dialog ( this, &data ); 00569 // PS -> // dialog.SetTitle( "Choose an axis color" ); 00570 // PS -> // if( dialog.ShowModal( ) == wxID_OK ) 00571 // PS -> // { 00572 // PS -> // wxColourData retData = dialog.GetColourData( ); 00573 // PS -> // wxColour col = retData.GetColour( ); 00574 // PS -> // btnAxisColor->SetBackgroundColour( col ); 00575 // PS -> // } // fi 00576 // PS -> } 00577 00578 // EOF - wxGeneralParametersDialog.cxx