]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxSTLWidget_03.cxx
1
2 #include "vtkObjectFactory.h"
3
4 #include "vtkActor.h"
5 #include "vtkCylinderSource.h"
6 #include "vtkPolyDataMapper.h"
7 #include "vtkRenderer.h"
8 #include "vtkRenderWindow.h"
9 #include "vtkRenderWindowInteractor.h"
10 #include "vtkProperty.h"
11 #include "vtkCamera.h"
12 #include "vtkPoints.h"
13 #include "vtkCellArray.h"
14 #include "vtkPolyData.h"
15 #include "vtkPolyDataMapper.h"
16 #include "vtkPolyDataWriter.h"
17 #include "vtkPolyDataReader.h"
18 #include "vtkImageReader.h"
19 #include "vtkImageViewer.h"
20 #include "vtkImageViewer2.h"
21 #include "vtkImageToStructuredPoints.h"
22 #include <vtkImageThreshold.h> 
23 #include "vtkImageWriter.h"
24
25
26 #include "vtkExtractVOI.h"
27 #include "vtkImageClip.h"
28 #include "vtkImageResample.h"
29 #include "vtkImageThreshold.h"
30 #include "vtkImageCast.h"
31 #include "vtkImageSeedConnectivity.h"
32 #include "vtkImageData.h"
33 #include "vtkMarchingCubes.h"
34 #include "vtkImageReslice.h"
35 #include "vtkTransform.h"
36 #include "vtkSphereSource.h"
37 #include "vtkDoubleArray.h"
38 #include "vtkPointData.h"
39 #include "vtkCommand.h"
40 #include "vtkCallbackCommand.h"
41 #include "vtkImageResample.h"
42 #include "vtkMath.h"
43 #include "vtkStripper.h"
44 #include <vtkSTLReader.h> 
45 #include "vtkMetaImageWriter.h"
46
47
48 #include "vtkTriangleFilter.h"
49 #include "vtkSTLWriter.h"
50 #include "vtkPolyDataConnectivityFilter.h"
51 #include "vtkClosePolyData.h"
52 #include "vtkAppendFilter.h"
53
54 #include "wxSTLWidget_03.h"
55
56 #include <wx/splitter.h>
57
58 #include <wx/filedlg.h>
59
60
61
62 //-------------------------------------------------------------------
63 //-------------------------------------------------------------------
64 //-------------------------------------------------------------------
65 wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent)//, marInterface* mar)
66 : wxPanel( parent, -1) 
67 {
68         _wxMaracasMPR           = NULL;
69         _maxSize                = 2000;
70         _minSize                = 300;
71
72         _stlMarchingCubesLevel  = 128;
73         _stlDeltaGaussLevel             = 100;
74
75         /*_mar=new marInterface();      
76         _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
77         _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
78         _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
79         _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
80         _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
81         _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
82         int voi[6];
83         mar->_experiment->getVOI( voi );
84         _mar->_experiment->setVOI( voi );
85         _mar->SetDicom(mar->_dicom);
86         _mar->initExperiment( );*/
87          
88
89         wxBoxSizer              *sizer          = new wxBoxSizer(wxVERTICAL  );
90         wxSplitterWindow        *pnlSplitter    = new wxSplitterWindow( this , -1);
91         wxPanel                 *viewPanel      = CreateViewPanel(pnlSplitter);
92 printf("EED wxSTLWidget_03::wxSTLWidget_03 01\n");
93         wxPanel                 *controlPanel   = CreateControlPanel(pnlSplitter);
94 printf("EED wxSTLWidget_03::wxSTLWidget_03 02\n");
95
96         sizer           -> Add( pnlSplitter ,1,wxGROW  ,0);
97         pnlSplitter     -> SetMinimumPaneSize( 150 );
98         pnlSplitter     -> SplitVertically( viewPanel, controlPanel, 600 );
99
100 //      pnlSplitter     -> SplitVertically( new wxPanel(pnlSplitter,-1), new wxPanel(pnlSplitter,-1) , 600 );
101 //      pnlSplitter     -> SplitVertically( viewPanel, new wxPanel(pnlSplitter,-1) , 600 );
102
103         this            -> SetSizer(sizer);
104
105         // Result 2: Volume + Axis
106 //      _2_prgov                = NULL;
107         _2_mapfinal             = NULL;
108         _2_stripfinal           = NULL;
109         _2_isoMapperMC6         = NULL;
110         _2_isoActorMC6          = NULL;
111         _2_isoMC6               = NULL;
112
113         //DHC STL SURFACES
114         stlInterna              = NULL;
115         stlExterna              = NULL;
116
117         _loadSTLMapper          = NULL;
118         _loadActorSTL           = NULL;
119
120         
121         //JOIN REGIONS
122         arteryImageData         = NULL;
123         joinMarchingCubes       = NULL;
124     joinMapper                  = NULL; 
125         joinActor               = NULL;
126 printf("EED wxSTLWidget_03::wxSTLWidget_03 03\n");
127
128
129 }
130 //-------------------------------------------------------------------
131 wxSTLWidget_03::~wxSTLWidget_03(){
132         ResetTree2_JF();
133         Reset_vtk_STLFile();
134 }
135 //-------------------------------------------------------------------
136 wxPanel* wxSTLWidget_03::CreateViewPanel(wxWindow *parent)
137 {
138         wxPanel *panel          =       new wxPanel(parent,-1);
139     wxBoxSizer *sizer   =       new wxBoxSizer(wxVERTICAL);
140
141
142    // MPR
143         //vtkImageData *imagedata;
144         //imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
145         //imagedata->Update();  
146 printf("EED wxSTLWidget_03::CreateViewPanel  01 \n");
147         _wxMaracasMPR = new wxMaracasMPR( panel);//JCP 10-03-2009, new marImageData(imagedata), 1 );
148 printf("EED wxSTLWidget_03::CreateViewPanel  02 \n");
149         _wxMaracasMPR->ConfigureVTK();
150 printf("EED wxSTLWidget_03::CreateViewPanel  03 \n");
151         
152         sizer->Add(     _wxMaracasMPR , 1, wxEXPAND, 0);
153         panel->SetSizer(sizer);
154         panel->SetAutoLayout(true);
155         panel->SetSize(400,400);
156         panel->Layout();
157 printf("EED wxSTLWidget_03::CreateViewPanel  04 \n");
158         return panel;
159 }
160
161 void wxSTLWidget_03::setImage(vtkImageData* img){
162
163
164         _wxMaracasMPR->setMarImage(new marImageData(img), 1);
165         _wxMaracasMPR->ConfigureVTK();
166 }
167 //-------------------------------------------------------------------
168 wxWindow* wxSTLWidget_03::CreateSelectAPointPanel(wxWindow *parent)
169 {
170 printf("EED wxSTLWidget_03::CreateSelectAPointPanel  01\n");
171         wxPanel *panel          = new wxPanel(parent,-1);
172
173 printf("EED wxSTLWidget_03::CreateSelectAPointPanel  02\n");
174
175     wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
176 printf("EED wxSTLWidget_03::CreateSelectAPointPanel  03\n");
177
178         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
179         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
180 printf("EED wxSTLWidget_03::CreateSelectAPointPanel  04\n");
181
182         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
183         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
184 printf("EED wxSTLWidget_03::CreateSelectAPointPanel  05\n");
185
186         sizer->Add(new wxStaticText(panel,-1,_T(" Select a 3D Point...")));
187         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
188 printf("EED wxSTLWidget_03::CreateSelectAPointPanel  06\n");
189
190         panel->SetSizer(sizer);
191         panel->SetAutoLayout(true);
192         panel->SetSize(400,600);
193         panel->Layout();
194 printf("EED wxSTLWidget_03::CreateSelectAPointPanel  07\n");
195
196
197         return panel;
198 }
199 //-------------------------------------------------------------------
200 wxWindow* wxSTLWidget_03::CreateSegmentationPanel(wxWindow *parent)
201 {
202         wxPanel *panel          = new wxPanel(parent,-1);
203
204
205         _opacity_Vol            = new wxSlider( panel, -1, 40, 0, 100                            , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
206         _opacity_Vol    ->SetSize(250,20);  
207         /*SIL
208         _sl_maxSize                     = new wxSlider( panel, -1, 300 , 0, 2000 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL  |  wxSL_AUTOTICKS | wxSL_LABELS );
209         _sl_minSize                     = new wxSlider( panel, -1, 200 , 0, 2000 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL  |  wxSL_AUTOTICKS | wxSL_LABELS );
210         
211         _sl_minSizeSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
212         _sl_minSizeSpin->SetRange(1,8);
213         _sl_minSizeSpin->SetValue(5);
214
215         _sl_maxSizeSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
216         _sl_maxSizeSpin->SetRange(1,8);
217         _sl_maxSizeSpin->SetValue(5);
218
219         */
220
221         _sl_RangeSizeSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
222         _sl_RangeSizeSpin->SetRange(1,8);
223         _sl_RangeSizeSpin->SetValue(5);
224
225
226         //SIL//
227         sl_barrange_segmentation = new mBarRange(panel, 300,70);
228         sl_barrange_segmentation -> setVisibleLabels ( true );
229         sl_barrange_segmentation -> setIfWithActualDrawed( false );
230         sl_barrange_segmentation -> setActiveStateTo ( true );
231         sl_barrange_segmentation -> setRepresentedValues (0,  2000);
232         sl_barrange_segmentation -> setDeviceBlitStart (10,10);
233         sl_barrange_segmentation -> setDeviceEndMargin(10);
234         parent->SetBackgroundColour(wxColour(255,255,255));
235         sl_barrange_segmentation-> setBackgroundColor( wxColour(255,255,255 ));
236
237
238         wxButton *btnExtract                            = new wxButton(panel,-1,_T("Segmentation"));
239         wxButton *btnSaveBinaryFile                     = new wxButton(panel,-1,_T("Save Binary File"));
240
241 //SIL// Connect(_sl_minSizeSpin->GetId()        , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxSTLWidget_03::OnMinSpin ); 
242 //SIL// Connect(_sl_maxSizeSpin->GetId()        , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxSTLWidget_03::OnMaxSpin ); 
243         Connect(_opacity_Vol->GetId()           , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacity_Vol                                        ); 
244         Connect(btnExtract->GetId()                     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnExtraction                                      ); 
245         Connect(btnSaveBinaryFile->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnSaveBinaryFile                          ); 
246
247         //SIL//
248         Connect(_sl_RangeSizeSpin->GetId()      , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxSTLWidget_03::OnRangeSpin ); 
249         Connect(sl_barrange_segmentation->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxSTLWidget_03::OnStartChanged_range );
250         Connect(sl_barrange_segmentation->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxSTLWidget_03::OnEndChanged_range );      
251         Connect(sl_barrange_segmentation->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxSTLWidget_03::OnBarMoved_range );
252
253     wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
254
255         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
256         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
257
258
259         sizer->Add(new wxStaticText(panel,-1,_T("  - - -  Segmentation - - - ")));
260         sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
261         
262
263         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
264         sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
265
266         /*sizer->Add(new wxStaticText(panel,-1,_T(" Threshold min")));
267         sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
268         sizer->Add(_sl_minSizeSpin, 1, wxALL|wxEXPAND, 0);*/
269         //sizer->Add(_sl_minSize, 1, wxALL|wxEXPAND, 0);
270
271         sizer->Add(new wxStaticText(panel,-1,_T(" Threshold min-max")));
272         sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
273         sizer->Add(_sl_RangeSizeSpin, 1, wxALL|wxEXPAND, 0);
274         sizer->Add(sl_barrange_segmentation,3,wxALL|wxGROW,0 );
275         
276         //SIL//sizer->Add(new wxStaticText(panel,-1,_T(" Threshold max")));
277         //SIL//sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
278         //SIL// sizer->Add(_sl_maxSizeSpin, 1, wxALL|wxEXPAND, 0);
279         //SIL//sizer->Add(_sl_maxSize, 1, wxALL|wxEXPAND, 0);
280         
281         sizer->Add(btnExtract);
282         sizer->Add(new wxStaticText(panel,-1,_T(" ")));
283
284         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
285         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
286         sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Result Volume")));
287         sizer->Add(_opacity_Vol);
288
289         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
290         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
291         sizer->Add(btnSaveBinaryFile);
292         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
293         
294         panel->SetSizer(sizer);
295         panel->SetAutoLayout(true);
296         panel->SetSize(400,600);
297         panel->Layout();
298
299         return panel;
300 }
301 //-------------------------------------------------
302 wxWindow* wxSTLWidget_03::CreateSmoothingPanel(wxWindow *parent)
303 {
304         wxPanel *panel          = new wxPanel(parent,-1);
305
306         stlSliderDeltaGauss     = new wxSlider( panel, -1, (int)(_stlDeltaGaussLevel) , 0, 300 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
307         stlSliderMarchingCubes= new wxSlider( panel, -1, (int)(_stlMarchingCubesLevel) , 0, 256 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
308         stlSliderOpacityInternal = new wxSlider(panel, -1, 100,0,100, wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS);
309         stlSliderOpacityExternal = new wxSlider(panel, -1, 100,0,100, wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS);
310         wxButton *btnFileSTL = new wxButton(panel,-1,_T("Generate STL files"));
311
312         Connect(btnFileSTL->GetId()                             , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnCreateFileSTL                   );
313         Connect(stlSliderDeltaGauss->GetId()    , wxEVT_SCROLL_THUMBRELEASE             , (wxObjectEventFunction) &wxSTLWidget_03::OnChangeSTLGaussLevel                );
314         Connect(stlSliderMarchingCubes->GetId() , wxEVT_SCROLL_THUMBRELEASE             , (wxObjectEventFunction) &wxSTLWidget_03::OnChangeSTLMarchingCubesLevel);
315         Connect(stlSliderOpacityInternal->GetId(), wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacitySTLInternal                 );
316         Connect(stlSliderOpacityExternal->GetId(), wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacitySTLExternal                 );
317
318
319     wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
320
321         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
322         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
323
324         sizer->Add(new wxStaticText(panel,-1,_T("-- Smoothing --")));
325         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
326         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
327         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
328         
329         sizer->Add(new wxStaticText(panel,-1,_T(" Delta Gauss")));
330         sizer->Add(stlSliderDeltaGauss);
331
332         sizer->Add(new wxStaticText(panel,-1,_T(" Marching Cubes Level")));
333         sizer->Add(stlSliderMarchingCubes);
334
335         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
336         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
337         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
338         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
339
340         sizer->Add(new wxStaticText(panel, -1,_T(" Opacity STL Internal")));
341         sizer->Add(stlSliderOpacityInternal);
342
343         sizer->Add(new wxStaticText(panel, -1,_T(" Opacity STL External")));
344         sizer->Add(stlSliderOpacityExternal);
345
346         sizer->Add(btnFileSTL);
347         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
348
349
350         panel->SetSizer(sizer);
351         panel->SetAutoLayout(true);
352         panel->SetSize(400,600);
353         panel->Layout();
354         return panel;
355 }
356 //-------------------------------------------------
357 wxWindow* wxSTLWidget_03::CreateReadSTLFilePanel(wxWindow *parent)
358 {
359         wxPanel *panel          = new wxPanel(parent,-1);
360
361         wxButton *btnReadSTLFile                        = new wxButton(panel,-1,_T("Read STL File"));
362         wxButton *btnEraseReadSTLFile           = new wxButton(panel,-1,_T("Erase STL File"));
363         _sl_opacity_STL_file                            = new wxSlider( panel, -1, 100 , 0, 100 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
364
365         Connect(btnReadSTLFile->GetId()                 , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnSTLFileLoad                     ); 
366         Connect(btnEraseReadSTLFile->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnSTLFileErase                    ); 
367         Connect(_sl_opacity_STL_file->GetId()   , wxEVT_SCROLL_THUMBRELEASE     , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacitySTLFile                             ); 
368
369
370     wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
371
372         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
373         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
374         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
375         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
376
377         sizer->Add(new wxStaticText(panel,-1,_T("-- Read STL File --")));
378         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
379
380         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
381         sizer->Add(new wxStaticText(panel,-1,_T("  ")));
382
383         sizer->Add(btnReadSTLFile );
384         sizer->Add(btnEraseReadSTLFile );
385         sizer->Add(new wxStaticText(panel, -1,_T(" Opacity STL File")));
386         sizer->Add(_sl_opacity_STL_file);
387
388
389         panel->SetSizer(sizer);
390         panel->SetAutoLayout(true);
391         panel->SetSize(400,600);
392         panel->Layout();
393         return panel;
394 }
395 //-------------------------------------------------------------------
396 wxPanel* wxSTLWidget_03::CreateControlPanel(wxWindow *parent)
397 {
398 printf("EED wxSTLWidget_03::CreateControlPanel 01\n");
399         wxPanel *panel                  = new wxPanel(parent,-1);
400
401         wxNotebook *noteBook    = new wxNotebook(panel, -1);
402 printf("EED wxSTLWidget_03::CreateControlPanel 02\n");
403         noteBook->AddPage(CreateSelectAPointPanel(noteBook),_T("0 ->") );
404 printf("EED wxSTLWidget_03::CreateControlPanel 03\n");
405         noteBook->AddPage(CreateSegmentationPanel(noteBook),_T("1 ->") );
406 printf("EED wxSTLWidget_03::CreateControlPanel 04\n");
407         noteBook->AddPage(CreateSmoothingPanel(noteBook)   ,_T("2 ->") );
408 printf("EED wxSTLWidget_03::CreateControlPanel 05\n");
409         noteBook->AddPage(CreateReadSTLFilePanel(noteBook) ,_T("3 "  ) );
410 printf("EED wxSTLWidget_03::CreateControlPanel 06\n");
411         noteBook->SetSelection(0);
412         noteBook->SetSize(350,250);
413     wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
414         sizer->Add(noteBook);
415         panel->SetSizer(sizer);
416         panel->SetAutoLayout(true);
417         panel->SetSize(400,600);
418         panel->Layout();
419
420 printf("EED wxSTLWidget_03::CreateControlPanel 07\n");
421         return panel;
422 }
423 //------------------------------------------------------------------------
424 void wxSTLWidget_03::Refresh()
425 {
426         if (_wxMaracasMPR!=NULL){
427                 _wxMaracasMPR->RefreshView();
428         }
429 }
430
431 //------------------------------------------------------------------------
432
433
434 void wxSTLWidget_03::ConfigureProcessing(marImageData *marimagedata, int x, int y, int z)
435 {
436     wxBusyCursor wait;
437
438         _imagedata=marimagedata->GetImageData(); // image t=0
439         _imagedata->UpdateInformation();
440         _imagedata->SetUpdateExtent(_imagedata->GetWholeExtent());
441         _imagedata->Update();
442
443
444         double puntoactualprov[3];
445         puntoactualprov[0] = x;
446         puntoactualprov[1] = y;
447         puntoactualprov[2] = z;
448
449         double espprin[3];
450         int extprin[6];                         
451         
452         _imagedata->GetSpacing(espprin);
453         _imagedata->GetExtent(extprin);
454
455
456 // MAZV 27 sep 2006
457 //      puntoactualprov[0]=puntoactualprov[0]*espprin[0];
458 //      puntoactualprov[1]=puntoactualprov[1]*espprin[1];
459 //      puntoactualprov[2]=puntoactualprov[2]*espprin[2];
460         
461     _imagedata->GetScalarRange( _range );
462
463         // Update Controls
464         //SIL//
465         /*_sl_minSize->SetRange( (int)(_range[0]), (int)( _range[1]) );
466         _sl_minSize->SetValue( (int)(_range[1]/4) );
467
468         _sl_maxSize->SetRange( (int)(_range[0]) , (int)(_range[1]));
469         _sl_maxSize->SetValue( (int)(_range[1]/2) );*/
470
471         //SIL//
472         minRangeValue = _range[0];
473         maxRangeValue = _range[1];
474
475         sl_barrange_segmentation ->setRepresentedValues(minRangeValue, maxRangeValue);
476         sl_barrange_segmentation ->SetStart((int)(maxRangeValue/4));
477         sl_barrange_segmentation ->SetEnd((int)(maxRangeValue/2));
478         sl_barrange_segmentation -> RefreshForce();     
479         lastResizeRef_Value = ( maxRangeValue - minRangeValue)/2;       
480
481 // MAZV 27 sep 2006
482 //      _highthreshold->SetRange(_range[0], _range[1]);
483 //      _highthreshold->SetValue( _range[1] );
484
485 //      _zslice->SetRange(extprin[4], extprin[5]);
486 //      _zslice->SetValue(extprin[5]/2);
487         
488         _thresh = vtkImageThreshold::New();
489         _thresh->SetInput(_imagedata);
490         //_thresh->ReleaseDataFlagOff();
491         _thresh->SetInValue(255);
492         _thresh->SetOutputScalarTypeToUnsignedShort();
493         _thresh->SetOutValue(0);
494         //_thresh->ThresholdBetween(_sl_minSize->GetValue(), _range[1]);
495         //SIL//
496         _thresh->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd()); 
497
498         vtkImageCast *cast = vtkImageCast::New();
499         cast->SetInput(_thresh->GetOutput());
500         cast->SetOutputScalarTypeToUnsignedChar();
501         cast->Update();
502
503   
504         _connect = vtkImageSeedConnectivity::New();
505         _connect->SetInput(cast->GetOutput());
506         _connect->SetInputConnectValue(255);
507         _connect->SetOutputConnectedValue(255);
508         _connect->SetOutputUnconnectedValue(0);
509         _connect->AddSeed((int)(puntoactualprov[0]), (int)(puntoactualprov[1]), (int)(puntoactualprov[2]));
510 //      _connect->Update();
511
512         cast3 = vtkImageCast::New();
513         cast3->SetInput(_connect->GetOutput());
514         cast3->SetOutputScalarTypeToUnsignedShort();
515         cast3->Update();
516 //SIL//
517         
518         _thresh2 = vtkImageThreshold::New();
519         _thresh2->SetInput(_imagedata);
520         //_thresh2->ReleaseDataFlagOff();
521         _thresh2->SetInValue(255);
522         _thresh2->SetOutputScalarTypeToUnsignedShort();
523         _thresh2->SetOutValue(0);
524         //SIL//_thresh2->ThresholdBetween(_sl_minSize->GetValue(), _sl_maxSize->GetValue());
525         _thresh2->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd());
526         
527         cast2 = vtkImageCast::New();
528         cast2->SetInput(_thresh2->GetOutput());
529         cast2->SetOutputScalarTypeToUnsignedChar();
530         cast2->Update();
531
532         _connect2 = vtkImageSeedConnectivity::New();
533         _connect2->SetInput(cast2->GetOutput());
534         _connect2->SetInputConnectValue(255);
535         _connect2->SetOutputConnectedValue(255);
536         _connect2->SetOutputUnconnectedValue(0);
537         _connect2->AddSeed( (int)(puntoactualprov[0]), (int)(puntoactualprov[1]), (int)(puntoactualprov[2]));
538         _connect2->Update();
539
540         cast4 = vtkImageCast::New();
541         cast4->SetInput(_connect2->GetOutput());
542         cast4->SetOutputScalarTypeToUnsignedShort();
543         cast4->Update();
544 }
545
546 //------------------------------------------------------------------------
547
548
549
550 void wxSTLWidget_03::ConfigureVTK()
551 {
552         wxBusyCursor wait;
553 //      vtkImageData    *imagedata              = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
554         marImageData    *marimagedata;//                = _mar->_experiment->getDynData( )->GetMarImageData();
555         
556         //CONFIGURACION ADICIONAL
557         this->ConfigureSTL();
558         this->ConfigureProcessing(marimagedata,0,0,0);
559         
560 }
561
562 //------------------------------------------------------------------------
563
564 void wxSTLWidget_03::ResetTree2_JF()
565 {
566         // Remove 
567         vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
568
569     if (_2_isoActorMC6){
570                 ren->RemoveActor(_2_isoActorMC6);
571         }
572     if (_2_stripfinal){
573                 ren->RemoveActor(_2_stripfinal);
574         }
575
576         // Delete 
577 //      if (_2_prgov            ) {     _2_prgov                -> Delete(); }
578         if (_2_mapfinal         ) {     _2_mapfinal             -> Delete(); }
579         if (_2_stripfinal       ) {     _2_stripfinal   -> Delete(); }
580         if (_2_isoMapperMC6     ) {     _2_isoMapperMC6 -> Delete(); }
581         if (_2_isoActorMC6      ) {     _2_isoActorMC6  -> Delete(); }
582         if (_2_isoMC6           ) {     _2_isoMC6               -> Delete(); }
583
584         // Init
585 //      _2_prgov                = NULL;
586         _2_mapfinal             = NULL;
587         _2_stripfinal   = NULL;
588         _2_isoMapperMC6 = NULL;
589         _2_isoActorMC6  = NULL;
590         _2_isoMC6               = NULL;
591 }
592
593
594
595
596
597
598 //------------------------------------------------------------------------
599 void wxSTLWidget_03::ExtractSurface(int x, int y, int z)
600 {
601         
602         double opacityvol               = ((double)_opacity_Vol->GetValue())/100;
603 //      vtkImageData *imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
604
605         double  puntoactualprov[3];
606         double  espprin[3];
607         int             extprin[6];                             
608
609
610         puntoactualprov[0]      =       x;
611         puntoactualprov[1]      =       y;
612         puntoactualprov[2]      =       z;
613         
614         _imagedata->UpdateInformation();
615         _imagedata->SetUpdateExtent(_imagedata->GetWholeExtent());
616         _imagedata->Update();
617
618         _imagedata->GetSpacing(espprin);
619         _imagedata->GetExtent(extprin);
620
621
622
623
624         _connect->RemoveAllSeeds ();
625         _connect->AddSeed( (int)(puntoactualprov[0] ), (int)(puntoactualprov[1]) ,(int)( puntoactualprov[2]) );
626         _connect->Update();
627         cast3->Update();
628
629
630
631         _thresh->ThresholdBetween(3000, 3002 );
632         _thresh2->ThresholdBetween(3000, 3001);
633 //      _thresh->Update();
634 //      _thresh2->Update();
635
636         _thresh->ThresholdBetween(_minSize, _range[1] );
637         _thresh->Update();
638
639         _thresh2->ThresholdBetween(_minSize, _maxSize);
640         _thresh2->Update();
641
642         cast2->Update();
643         _connect2->RemoveAllSeeds ();
644         _connect2->AddSeed( (int)(puntoactualprov[0]) , (int)(puntoactualprov[1]) , (int)(puntoactualprov[2]) );
645         _connect2->Update();
646         cast4->Update();
647
648
649
650
651         // Visualisation - result volume
652    
653     _2_isoMC6 = vtkMarchingCubes::New();
654         _2_isoMC6->SetInput(cast4->GetOutput());
655
656     _2_isoMC6->SetValue(0, 128);
657         _2_isoMC6->Update();
658
659         _2_isoMapperMC6 = vtkPolyDataMapper::New();
660     _2_isoMapperMC6->SetInput(_2_isoMC6->GetOutput());
661     _2_isoMapperMC6->ScalarVisibilityOff();
662     _2_isoMapperMC6->ImmediateModeRenderingOn();
663
664         vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
665
666         if (_2_isoActorMC6!=NULL)
667         {
668                 ren->RemoveActor(_2_isoActorMC6);
669         }
670
671
672         _2_isoActorMC6 = vtkActor::New();
673     _2_isoActorMC6->SetMapper(_2_isoMapperMC6);
674     _2_isoActorMC6->GetProperty()->SetColor(1.0, 1.0, 0.5);
675     _2_isoActorMC6->GetProperty()->SetOpacity( opacityvol );
676     
677         // Interface Update
678
679         ren->AddActor(_2_isoActorMC6);
680
681 }
682
683 //------------------------------------------------------------------------
684 void wxSTLWidget_03::OnOpacity_Vol(wxScrollEvent& event)
685 {
686         if (_2_isoActorMC6!=NULL){
687                 double value = ((double)_opacity_Vol->GetValue())/100;
688                 _2_isoActorMC6->GetProperty( )->SetOpacity( value );
689                 Refresh();
690         }
691 }
692 //------------------------------------------------------------------------
693
694 void wxSTLWidget_03::OnMinSpin          (       wxScrollEvent &          event           )      
695 {
696         /*wxSlider *sl_A=_sl_minSize;
697         wxSlider *sl_B=_sl_minSizeSpin;
698         int value = sl_A->GetValue();
699         int delta=(int)pow( 4 , sl_B->GetValue() );
700         int min=value - delta/2;
701         int max=value + delta/2;
702         if (min<0)
703         {
704                 min=0;
705                 max=delta;
706         }
707         sl_A->SetRange(min,max);
708
709
710         */
711 }
712
713 //------------------------------------------------------------------------
714
715 void wxSTLWidget_03::OnMaxSpin          (       wxScrollEvent &          event           )      
716 {
717         /*wxSlider *sl_A=_sl_maxSize;
718         wxSlider *sl_B=_sl_maxSizeSpin;
719         int value = sl_A->GetValue();
720         int delta = (int)pow( 4 , sl_B->GetValue() );
721         int min=value - delta/2;
722         int max=value + delta/2;
723         if (min<0)
724         {
725                 min=0;
726                 max=delta;
727         }
728         sl_A->SetRange(min,max);*/      
729 }
730
731 //------------------------------------------------------------------------
732
733 void wxSTLWidget_03::OnRangeSpin        (       wxScrollEvent &          event           )      
734 {
735         wxSlider *sl_B=_sl_RangeSizeSpin;
736
737         int value = lastResizeRef_Value;
738         int delta = (int)pow( 4 , sl_B->GetValue() );
739         int startResized = value - delta/2;
740         int endResized = value + delta/2;
741
742         if( startResized < minRangeValue )
743                 startResized = minRangeValue;
744
745         if( endResized > maxRangeValue )
746                 endResized = maxRangeValue;
747
748         sl_barrange_segmentation->setRepresentedValues(startResized,endResized);
749         sl_barrange_segmentation -> RefreshForce();     
750 }
751
752 //------------------------------------------------------------------------
753 void wxSTLWidget_03:: OnStartChanged_range(wxCommandEvent& event)
754 {
755         lastResizeRef_Value = sl_barrange_segmentation->GetStart();
756 }
757 //------------------------------------------------------------------------
758 void wxSTLWidget_03:: OnEndChanged_range(wxCommandEvent& event)
759 {
760         lastResizeRef_Value = sl_barrange_segmentation->GetEnd();   
761 }
762 //------------------------------------------------------------------------
763 void wxSTLWidget_03:: OnBarMoved_range(wxCommandEvent& event)
764 {
765         lastResizeRef_Value = (sl_barrange_segmentation->GetEnd() - sl_barrange_segmentation->GetStart())/2 ;
766 }
767 //------------------------------------------------------------------------
768
769 void wxSTLWidget_03::OnBtnSaveBinaryFile(wxCommandEvent& event)
770 {
771         wxString dirSTL;// = _mar->_parameters->getStringParam( 
772     //marParameters::e_installation_directory ); 
773         dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
774         wxFileDialog dialog( this, _T("Choose a directory..."), ( !dirSTL.IsEmpty( ) )?
775         dirSTL: wxGetHomeDir( ) );
776
777         if( dialog.ShowModal( ) == wxID_OK ) 
778         {
779                 vtkMetaImageWriter  *writer= vtkMetaImageWriter::New();
780                 writer->SetFileName( dialog.GetPath().mb_str(wxConvUTF8) );     
781                 writer->SetInput(cast4->GetOutput());
782                 writer->Write();
783                 writer->Delete();
784         }
785 }
786
787 //------------------------------------------------------------------------
788 void wxSTLWidget_03::OnBtnExtraction(wxCommandEvent& event)
789 {
790         /*wxBusyCursor wait;
791         _minSize = _sl_minSize->GetValue();
792         _maxSize = _sl_maxSize->GetValue();
793
794         double px=_wxMaracasMPR->GetVtkMPRBaseData()->GetX();
795         double py=_wxMaracasMPR->GetVtkMPRBaseData()->GetY();
796         double pz=_wxMaracasMPR->GetVtkMPRBaseData()->GetZ();
797         ExtractSurface((int)(px),(int)(py),(int)(pz));
798         generateSTLSurfaces(); //DHC: AFTER SEGMENTATION THE TREE, THE STL SURFACES ARE CALCULATED.
799
800         Refresh();
801 */
802         //SIL//
803         wxBusyCursor wait;
804         _minSize = sl_barrange_segmentation->GetStart();
805         _maxSize = sl_barrange_segmentation->GetEnd();
806
807         double px=_wxMaracasMPR->GetVtkMPRBaseData()->GetX();
808         double py=_wxMaracasMPR->GetVtkMPRBaseData()->GetY();
809         double pz=_wxMaracasMPR->GetVtkMPRBaseData()->GetZ();
810         ExtractSurface((int)(px),(int)(py),(int)(pz));
811         generateSTLSurfaces(); //DHC: AFTER SEGMENTATION THE TREE, THE STL SURFACES ARE CALCULATED.
812
813         Refresh();
814 }
815
816 //------------------------------------------------------------------------
817 void wxSTLWidget_03::OnOpacitySTLFile(wxScrollEvent& event)
818 {
819         if (_loadActorSTL!=NULL)
820         {
821                 double value = ((double)_sl_opacity_STL_file->GetValue())/100;
822                 _loadActorSTL->GetProperty( )->SetOpacity( value );
823                 Refresh();
824         }
825 }
826 //------------------------------------------------------------------------
827 void wxSTLWidget_03::Reset_vtk_STLFile()
828 {
829         // Remove
830         vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
831     if (_loadActorSTL){
832                 ren->RemoveActor(_loadActorSTL);
833         }
834
835         // Delete 
836         if (_loadSTLMapper              ) {     _loadSTLMapper          -> Delete(); }
837         if (_loadActorSTL               ) {     _loadActorSTL           -> Delete(); }
838
839         // Init
840         _loadSTLMapper          = NULL;
841         _loadActorSTL           = NULL;
842
843 }
844 //------------------------------------------------------------------------
845 void wxSTLWidget_03::OnBtnSTLFileErase(wxCommandEvent& event)
846 {
847         Reset_vtk_STLFile();
848         Refresh();
849 }
850 //------------------------------------------------------------------------
851 void wxSTLWidget_03::OnBtnSTLFileLoad(wxCommandEvent& event)
852 {
853         wxString dirSTL;// = _mar->_parameters->getStringParam( 
854     //marParameters::e_installation_directory ); 
855         dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
856         wxFileDialog dialog( this, _T("Choose a directory..."), ( !dirSTL.IsEmpty( ) )?
857         dirSTL: wxGetHomeDir( ) );
858
859         if( dialog.ShowModal( ) == wxID_OK ) 
860         {
861                 Reset_vtk_STLFile();
862                 vtkSTLReader *imgReader= vtkSTLReader::New();
863                 imgReader->SetFileName( dialog.GetPath().mb_str(wxConvUTF8) );  
864                 _loadSTLMapper = vtkPolyDataMapper::New();
865                 _loadSTLMapper->SetInput(imgReader->GetOutput());
866                 _loadActorSTL = vtkActor::New();
867                 _loadActorSTL->SetMapper(_loadSTLMapper);
868                 _loadActorSTL->GetProperty()->SetColor( 1, 0, 0);
869                 _loadActorSTL->GetProperty()->SetOpacity( 0.5 );
870                 vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
871                 ren->AddActor(_loadActorSTL);
872                 imgReader->Delete();
873         }
874         //By default *always* update e_installation_directory:
875         //_mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
876         //_mar->saveParameters( );
877 }
878
879
880
881 // ------------------------------------------------------------------------
882 // END JOIN FUNCTIONS - DHC
883 // ------------------------------------------------------------------------
884
885 // ------------------------------------------------------------------------
886 // START STL FUNCTIONS - DHC
887 // ------------------------------------------------------------------------
888
889 void wxSTLWidget_03::ConfigureSTL()
890 {
891         stlExterna = vtkPolyData::New();
892         stlInterna = vtkPolyData::New();
893
894         dsm1 = vtkPolyDataMapper ::New();
895     dsm1->SetInput (stlInterna); 
896     dsm1->ScalarVisibilityOff();
897
898     actorInternal = vtkActor::New();
899     actorInternal->SetMapper (dsm1);
900     actorInternal->GetProperty()->SetColor (0,1,0);
901
902     dsm2 = vtkPolyDataMapper ::New();
903     dsm2->SetInput (stlExterna);
904     dsm2->ScalarVisibilityOff();
905
906     actorExternal= vtkActor::New();
907     actorExternal->SetMapper (dsm2);
908     actorExternal->GetProperty()->SetRepresentationToWireframe();
909
910 //    vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer();
911         vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
912     ren->AddActor(actorInternal);
913     ren->AddActor(actorExternal);
914
915         stlExtractor = new vtkSTLExtractor();  
916 }
917
918 void wxSTLWidget_03::generateSTLSurfaces()
919 {
920 // EED 09Janvier2007
921 //      stlExtractor->setVolume(_2_prgov->GetVolumen());
922
923         stlExtractor->setVolume(cast4->GetOutput());
924
925         stlExtractor->setSigmaLevel(_stlDeltaGaussLevel);
926         stlExtractor->setMarchingCubesLevel(_stlMarchingCubesLevel);
927         stlExtractor->calculate();
928         stlInterna->DeepCopy(stlExtractor->getInnerSurface());
929         stlExterna->DeepCopy(stlExtractor->getOuterSurface());
930 }
931
932
933 void wxSTLWidget_03::OnOpacitySTLExternal(wxScrollEvent& event){
934         double value = ((double)stlSliderOpacityExternal->GetValue())/100;
935     actorExternal->GetProperty( )->SetOpacity( value );
936         Refresh();
937 }
938
939
940 void wxSTLWidget_03::OnOpacitySTLInternal(wxScrollEvent& event){
941         double value = ((double)stlSliderOpacityInternal->GetValue())/100;
942     actorInternal->GetProperty( )->SetOpacity( value );
943         Refresh();
944 }
945
946 void wxSTLWidget_03::OnBtnCreateFileSTL(wxCommandEvent& event)
947 {
948
949         wxString dirSTL;// = _mar->_parameters->getStringParam( 
950     //marParameters::e_installation_directory ); 
951         dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
952
953         
954 //      wxDirDialog dialog( this, "Choose a directory...", ( !dirSTL.IsEmpty( ) )?dirSTL: wxGetHomeDir( ) );
955         wxFileDialog dialog( this, _T("Choose a directory..."), dirSTL , _T(""), _T("*.*"), wxSAVE );
956
957
958         if( dialog.ShowModal( ) == wxID_OK ) 
959         {
960            
961         
962                 // ------------------------------------------------------------------------
963                 //  1.  GENERATE STL FILES
964                 // ------------------------------------------------------------------------
965 //              const char* fileprefix = "c:\\Creatis\\";
966                 std::string prefix ( dialog.GetPath().mb_str(wxConvUTF8) );
967                 std::string filename;
968
969                 // 1.1. Se hace un filtro triangular puesto que el stl writer solo recibe poligonos triangulares.
970
971         vtkTriangleFilter *filtro = vtkTriangleFilter::New();
972                 filtro->SetInput(stlInterna);
973                 vtkPolyDataConnectivityFilter *pdcf = vtkPolyDataConnectivityFilter::New();
974         pdcf->SetInput( filtro->GetOutput() );
975         vtkClosePolyData *cpd = vtkClosePolyData::New();
976         cpd->SetInput( pdcf->GetOutput() );
977
978                 // 1.2 se escribe a disco el archivo stl de la superficie interna
979         cpd->Update();
980         vtkSTLWriter *writerI = vtkSTLWriter::New();
981         writerI->SetInput( cpd->GetOutput() );
982 //        prefix = fileprefix;
983                 filename=prefix+"_internal.stl";
984         writerI->SetFileName(filename.c_str());
985         writerI->SetFileTypeToASCII();
986         writerI->Write();
987         writerI->Delete();
988
989                 // 1.3 se escribe a disco el archivo stl de la superficie externa
990                 filtro->SetInput(stlExterna);
991         cpd->Update();
992         vtkSTLWriter *writerE = vtkSTLWriter::New();
993         writerE->SetInput( cpd->GetOutput() );
994 //        prefix = fileprefix;
995                 filename=prefix+"_external.stl";
996         writerE->SetFileName( filename.c_str() );
997         writerE->SetFileTypeToASCII();
998         writerE->Write();
999         writerE->Delete();
1000    
1001         filtro->Delete();
1002         cpd->Delete();
1003         pdcf->Delete();
1004         }
1005
1006         //By default *always* update e_installation_directory:
1007         //_mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
1008         //_mar->saveParameters( );
1009 }
1010
1011
1012 void wxSTLWidget_03::OnChangeSTLGaussLevel(wxScrollEvent& event)
1013 {
1014         wxBusyCursor wait;
1015         _stlDeltaGaussLevel  = ((double)stlSliderDeltaGauss->GetValue())/100;
1016         generateSTLSurfaces();
1017         Refresh();
1018 }
1019
1020
1021 void wxSTLWidget_03::OnChangeSTLMarchingCubesLevel(wxScrollEvent& event)
1022 {
1023         wxBusyCursor wait;
1024         _stlMarchingCubesLevel = ((double)stlSliderMarchingCubes->GetValue());
1025         generateSTLSurfaces();
1026         Refresh();
1027         
1028 }
1029
1030
1031 // ------------------------------------------------------------------------
1032 // END STL FUNCTIONS - DHC
1033 // ------------------------------------------------------------------------
1034
1035
1036
1037
1038
1039
1040