]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/include/Copie de wxSTLWidget_03.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / include / Copie de 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 <kernel/marInterface.h>
52 #include <kernel/axisExtractor02.h>
53
54
55 #include "kernel/vtkSTLExtractor.h"    
56 #include "kernel/vtkJoiner.h"
57
58
59
60
61 //------------------------------------------------------------------
62 //------------------------------------------------------------------
63 //------------------------------------------------------------------
64
65 class wxSTLWidget_03: public wxPanel{
66 public:
67         wxSTLWidget_03(wxWindow *parentmar,marInterface *mar);
68         ~wxSTLWidget_03();
69         void ConfigureVTK();
70         void Refresh();
71
72         void OnOpacity_Vol(wxScrollEvent& event);               // Result Volume 
73         void OnMinSpin ( wxScrollEvent & event );
74         void OnMaxSpin ( wxScrollEvent & event ); 
75
76         //SIL new// 
77         void OnRangeSpin( wxScrollEvent & event );
78
79         //Handled events form the bar
80         void OnStartChanged_range(wxCommandEvent& event);
81         void OnEndChanged_range(wxCommandEvent& event);
82         void OnBarMoved_range(wxCommandEvent& event);
83
84
85         void OnBtnExtraction(wxCommandEvent& event);
86         void OnBtnSaveBinaryFile(wxCommandEvent& event);
87
88         //
89         void Reset_vtk_STLFile();
90         void OnBtnSTLFileLoad(wxCommandEvent& event);
91         void OnBtnSTLFileErase(wxCommandEvent& event);
92         void OnOpacitySTLFile(wxScrollEvent& event);            
93
94
95         // --------------------------------------
96         // STL FUNCTIONS DHC
97         // --------------------------------------
98         void generateSTLSurfaces();
99         void OnBtnCreateFileSTL(wxCommandEvent& event); 
100         void OnChangeSTLGaussLevel(wxScrollEvent& event);
101         void OnChangeSTLMarchingCubesLevel(wxScrollEvent& event);
102         void OnOpacitySTLExternal(wxScrollEvent& event);
103         void OnOpacitySTLInternal(wxScrollEvent& event);
104
105         
106         //---------------------------------------
107         // JOIN REGIONS FUNCTIONS
108         //---------------------------------------
109         void OnJoinRegions(wxCommandEvent& event);
110
111 private:
112
113         //Processing
114         vtkImageData                            *_imagedata;
115         double                                          _range[2];
116         vtkImageCast                            *cast2;
117         vtkImageCast                            *cast3;
118         vtkImageCast                            *cast4; // binary segmentation result
119         vtkImageThreshold                       *_thresh;
120         vtkImageThreshold                       *_thresh2;
121         vtkImageSeedConnectivity        *_connect;
122         vtkImageSeedConnectivity        *_connect2;
123
124
125
126         vtkPolyDataMapper       *_2_mapfinal;
127         vtkActor                        *_2_stripfinal;
128         vtkPolyDataMapper       *_2_isoMapperMC6;
129         vtkActor                        *_2_isoActorMC6;
130         vtkMarchingCubes        *_2_isoMC6;
131         double                          _sensibility_JF;
132         int                                     _maxSize;
133         int                                     _minSize;
134
135         // Load STL file
136         vtkPolyDataMapper *_loadSTLMapper;
137         vtkActor                  *_loadActorSTL;
138
139
140         wxSlider                        *_opacity_Vol;
141         wxSlider                        *_sl_minSize;
142         wxSlider                        *_sl_maxSize;
143         wxSlider                        *_sl_minSizeSpin;
144         wxSlider                        *_sl_maxSizeSpin;
145         wxSlider                        *_sl_RangeSizeSpin;
146
147         
148         /*
149         * Represents the bar of min and max for merging the functionality of two sliders for controlling the segmentation parameters
150         */
151         mBarRange                       * sl_barrange_segmentation;
152         int                                     lastResizeRef_Value;
153         int                                     minRangeValue;
154         int                                     maxRangeValue;
155         
156         wxVtk3DBaseView         *_imageviewer3D;
157         wxPanel                         *CreateControlPanel(wxWindow *parent);
158         wxPanel                         *CreateViewPanel(wxWindow *parent);
159
160         //Maracas
161         marInterface            *_mar;
162         wxMaracasMPR            *_wxMaracasMPR;
163
164         void ResetTree2_JF();
165         void ExtractSurface(int x, int y, int z);
166
167         wxWindow* CreateSelectAPointPanel(wxWindow *parent);
168         wxWindow* CreateSegmentationPanel(wxWindow *parent);
169         wxWindow* CreateSmoothingPanel(wxWindow *parent);
170         wxWindow* CreateReadSTLFilePanel(wxWindow *parent);
171
172         //---------------------
173         // Processing
174         //---------------------
175         void ConfigureProcessing(marImageData *marimagedata, int x, int y, int z);
176
177
178         //---------------------
179         // STL SURFACES DHC
180         //---------------------
181         void            ConfigureSTL();
182         double          _stlDeltaGaussLevel;
183         double          _stlMarchingCubesLevel;
184
185         
186         vtkPolyData *stlInterna;
187         vtkPolyData *stlExterna;
188         
189         wxSlider        *stlSliderDeltaGauss;
190         wxSlider        *stlSliderMarchingCubes;
191         
192         vtkPolyDataMapper *dsm1;
193     vtkActor    *actorInternal;
194         wxSlider        *stlSliderOpacityInternal;
195     
196         vtkPolyDataMapper *dsm2; 
197     vtkActor    *actorExternal;
198         wxSlider        *stlSliderOpacityExternal;
199
200         vtkSTLExtractor *stlExtractor;   
201
202         wxSlider        *_sl_opacity_STL_file;
203
204
205
206         //--------------------------
207         // JOIN REGIONS
208         //--------------------------
209
210         vtkImageData            *arteryImageData;
211         vtkJoiner                       *joiner;
212         vtkMarchingCubes        *joinMarchingCubes;
213     vtkPolyDataMapper   *joinMapper; 
214         vtkActor                        *joinActor; 
215
216 };
217
218 #endif // WX_STL_WIDGET_03
219
220
221
222