]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxSTLWidget_03.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27 #ifndef WX_STL_WIDGET_03
28 #define WX_STL_WIDGET_03
29
30 #include <vector>
31
32 #include <vtkImageData.h>
33 #include <vtkActor.h>
34 #include <vtkMarchingCubes.h>
35 #include <vtkPolyDataMapper.h>
36 #include <vtkAppendFilter.h>
37 #include <vtkImageThreshold.h>
38 #include <vtkExtractVOI.h>
39 #include <vtkOutlineFilter.h>
40 #include <vtkImageSeedConnectivity.h>
41 #include <vtkImageCast.h>
42
43 #include "wxVTKRenderWindowInteractor.h"
44 //#include "wxSurfaceWidget.h"
45 #include "wxVtkBaseView.h"
46
47
48 #include "../wxMaracasMPR.h"
49 #include "pPlotter/mBarRange.h"//SIL//
50
51 //#include <marInterface.h>
52 //#include <include/axisExtractor02.h>
53
54
55 #include "vtkSTLExtractor.h"    
56 #include "include/vtkJoiner.h"
57
58 #include "marTypes.h"
59
60
61
62
63 //------------------------------------------------------------------
64 //------------------------------------------------------------------
65 //------------------------------------------------------------------
66
67 class creaMaracasVisu_EXPORT wxSTLWidget_03: public wxPanel{
68 public:
69         wxSTLWidget_03(wxWindow *parentmar);//,marInterface *mar);
70         ~wxSTLWidget_03();
71         void ConfigureVTK();
72         void Refresh();
73
74         void OnOpacity_Vol(wxScrollEvent& event);               // Result Volume 
75         void OnMinSpin ( wxScrollEvent & event );
76         void OnMaxSpin ( wxScrollEvent & event ); 
77
78         //SIL new// 
79         void OnRangeSpin( wxScrollEvent & event );
80
81         //Handled events form the bar
82         void OnStartChanged_range(wxCommandEvent& event);
83         void OnEndChanged_range(wxCommandEvent& event);
84         void OnBarMoved_range(wxCommandEvent& event);
85
86
87         void OnBtnExtraction(wxCommandEvent& event);
88         void OnBtnSaveBinaryFile(wxCommandEvent& event);
89
90         //
91         void Reset_vtk_STLFile();
92         void OnBtnSTLFileLoad(wxCommandEvent& event);
93         void OnBtnSTLFileErase(wxCommandEvent& event);
94         void OnOpacitySTLFile(wxScrollEvent& event);            
95
96
97         // --------------------------------------
98         // STL FUNCTIONS DHC
99         // --------------------------------------
100         void generateSTLSurfaces();
101         void OnBtnCreateFileSTL(wxCommandEvent& event); 
102         void OnChangeSTLGaussLevel(wxScrollEvent& event);
103         void OnChangeSTLMarchingCubesLevel(wxScrollEvent& event);
104         void OnOpacitySTLExternal(wxScrollEvent& event);
105         void OnOpacitySTLInternal(wxScrollEvent& event);
106
107         
108         //---------------------------------------
109         // JOIN REGIONS FUNCTIONS
110         //---------------------------------------
111         void OnJoinRegions(wxCommandEvent& event);
112
113         //JCP 01-03-08
114         void setImage(vtkImageData* img);
115
116 private:
117
118         //Processing
119         vtkImageData                            *_imagedata;
120         double                                          _range[2];
121         vtkImageCast                            *cast2;
122         vtkImageCast                            *cast3;
123         vtkImageCast                            *cast4; // binary segmentation result
124         vtkImageThreshold                       *_thresh;
125         vtkImageThreshold                       *_thresh2;
126         vtkImageCast * _cast;
127         vtkImageSeedConnectivity        *_connect;
128         vtkImageSeedConnectivity        *_connect2;
129
130
131
132         vtkPolyDataMapper       *_2_mapfinal;
133         vtkActor                        *_2_stripfinal;
134         vtkPolyDataMapper       *_2_isoMapperMC6;
135         vtkActor                        *_2_isoActorMC6;
136         vtkMarchingCubes        *_2_isoMC6;
137         double                          _sensibility_JF;
138         int                                     _maxSize;
139         int                                     _minSize;
140
141         // Load STL file
142         vtkPolyDataMapper *_loadSTLMapper;
143         vtkActor                  *_loadActorSTL;
144
145
146         wxSlider                        *_opacity_Vol;
147         wxSlider                        *_sl_minSize;
148         wxSlider                        *_sl_maxSize;
149         wxSlider                        *_sl_minSizeSpin;
150         wxSlider                        *_sl_maxSizeSpin;
151         wxSlider                        *_sl_RangeSizeSpin;
152
153         
154         /*
155         * Represents the bar of min and max for merging the functionality of two sliders for controlling the segmentation parameters
156         */
157         mBarRange                       * sl_barrange_segmentation;
158         int                                     lastResizeRef_Value;
159         int                                     minRangeValue;
160         int                                     maxRangeValue;
161         
162         wxVtk3DBaseView         *_imageviewer3D;
163         wxPanel                         *CreateControlPanel(wxWindow *parent);
164         wxPanel                         *CreateViewPanel(wxWindow *parent);
165
166         //Maracas
167         //marInterface          *_mar;
168         wxMaracasMPR            *_wxMaracasMPR;
169
170         void ResetTree2_JF();
171         void ExtractSurface(int x, int y, int z);
172
173         wxWindow* CreateSelectAPointPanel(wxWindow *parent);
174         wxWindow* CreateSegmentationPanel(wxWindow *parent);
175         wxWindow* CreateSmoothingPanel(wxWindow *parent);
176         wxWindow* CreateReadSTLFilePanel(wxWindow *parent);
177
178         //---------------------
179         // Processing
180         //---------------------
181         void ConfigureProcessing(vtkImageData *img, int x, int y, int z);
182
183
184         //---------------------
185         // STL SURFACES DHC
186         //---------------------
187         void            ConfigureSTL();
188         double          _stlDeltaGaussLevel;
189         double          _stlMarchingCubesLevel;
190
191         
192         vtkPolyData *stlInterna;
193         vtkPolyData *stlExterna;
194         
195         wxSlider        *stlSliderDeltaGauss;
196         wxSlider        *stlSliderMarchingCubes;
197         
198         vtkPolyDataMapper *dsm1;
199     vtkActor    *actorInternal;
200         wxSlider        *stlSliderOpacityInternal;
201     
202         vtkPolyDataMapper *dsm2; 
203     vtkActor    *actorExternal;
204         wxSlider        *stlSliderOpacityExternal;
205
206         vtkSTLExtractor *stlExtractor;   
207
208         wxSlider        *_sl_opacity_STL_file;
209
210
211
212         //--------------------------
213         // JOIN REGIONS
214         //--------------------------
215
216         vtkImageData            *arteryImageData;
217         vtkJoiner                       *joiner;
218         vtkMarchingCubes        *joinMarchingCubes;
219     vtkPolyDataMapper   *joinMapper; 
220         vtkActor                        *joinActor; 
221
222 };
223
224 #endif // WX_STL_WIDGET_03
225
226
227
228