1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
27 #ifndef WX_STL_WIDGET_03
28 #define WX_STL_WIDGET_03
32 #include <vtkImageData.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>
43 #include "wxVTKRenderWindowInteractor.h"
44 //#include "wxSurfaceWidget.h"
45 #include "wxVtkBaseView.h"
48 #include "../wxMaracasMPR.h"
49 #include "pPlotter/mBarRange.h"//SIL//
51 //#include <marInterface.h>
52 //#include <include/axisExtractor02.h>
55 #include "vtkSTLExtractor.h"
56 #include "include/vtkJoiner.h"
63 //------------------------------------------------------------------
64 //------------------------------------------------------------------
65 //------------------------------------------------------------------
67 class creaMaracasVisu_EXPORT wxSTLWidget_03: public wxPanel{
69 wxSTLWidget_03(wxWindow *parentmar);//,marInterface *mar);
74 void OnOpacity_Vol(wxScrollEvent& event); // Result Volume
75 void OnMinSpin ( wxScrollEvent & event );
76 void OnMaxSpin ( wxScrollEvent & event );
79 void OnRangeSpin( wxScrollEvent & event );
81 //Handled events form the bar
82 void OnStartChanged_range(wxCommandEvent& event);
83 void OnEndChanged_range(wxCommandEvent& event);
84 void OnBarMoved_range(wxCommandEvent& event);
87 void OnBtnExtraction(wxCommandEvent& event);
88 void OnBtnSaveBinaryFile(wxCommandEvent& event);
91 void Reset_vtk_STLFile();
92 void OnBtnSTLFileLoad(wxCommandEvent& event);
93 void OnBtnSTLFileErase(wxCommandEvent& event);
94 void OnOpacitySTLFile(wxScrollEvent& event);
97 // --------------------------------------
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);
108 //---------------------------------------
109 // JOIN REGIONS FUNCTIONS
110 //---------------------------------------
111 void OnJoinRegions(wxCommandEvent& event);
114 void setImage(vtkImageData* img);
119 vtkImageData *_imagedata;
123 vtkImageCast *cast4; // binary segmentation result
124 vtkImageThreshold *_thresh;
125 vtkImageThreshold *_thresh2;
126 vtkImageCast * _cast;
127 vtkImageSeedConnectivity *_connect;
128 vtkImageSeedConnectivity *_connect2;
132 vtkPolyDataMapper *_2_mapfinal;
133 vtkActor *_2_stripfinal;
134 vtkPolyDataMapper *_2_isoMapperMC6;
135 vtkActor *_2_isoActorMC6;
136 vtkMarchingCubes *_2_isoMC6;
137 double _sensibility_JF;
142 vtkPolyDataMapper *_loadSTLMapper;
143 vtkActor *_loadActorSTL;
146 wxSlider *_opacity_Vol;
147 wxSlider *_sl_minSize;
148 wxSlider *_sl_maxSize;
149 wxSlider *_sl_minSizeSpin;
150 wxSlider *_sl_maxSizeSpin;
151 wxSlider *_sl_RangeSizeSpin;
155 * Represents the bar of min and max for merging the functionality of two sliders for controlling the segmentation parameters
157 mBarRange * sl_barrange_segmentation;
158 int lastResizeRef_Value;
162 wxVtk3DBaseView *_imageviewer3D;
163 wxPanel *CreateControlPanel(wxWindow *parent);
164 wxPanel *CreateViewPanel(wxWindow *parent);
167 //marInterface *_mar;
168 wxMaracasMPR *_wxMaracasMPR;
170 void ResetTree2_JF();
171 void ExtractSurface(int x, int y, int z);
173 wxWindow* CreateSelectAPointPanel(wxWindow *parent);
174 wxWindow* CreateSegmentationPanel(wxWindow *parent);
175 wxWindow* CreateSmoothingPanel(wxWindow *parent);
176 wxWindow* CreateReadSTLFilePanel(wxWindow *parent);
178 //---------------------
180 //---------------------
181 void ConfigureProcessing(vtkImageData *img, int x, int y, int z);
184 //---------------------
186 //---------------------
188 double _stlDeltaGaussLevel;
189 double _stlMarchingCubesLevel;
192 vtkPolyData *stlInterna;
193 vtkPolyData *stlExterna;
195 wxSlider *stlSliderDeltaGauss;
196 wxSlider *stlSliderMarchingCubes;
198 vtkPolyDataMapper *dsm1;
199 vtkActor *actorInternal;
200 wxSlider *stlSliderOpacityInternal;
202 vtkPolyDataMapper *dsm2;
203 vtkActor *actorExternal;
204 wxSlider *stlSliderOpacityExternal;
206 vtkSTLExtractor *stlExtractor;
208 wxSlider *_sl_opacity_STL_file;
212 //--------------------------
214 //--------------------------
216 vtkImageData *arteryImageData;
218 vtkMarchingCubes *joinMarchingCubes;
219 vtkPolyDataMapper *joinMapper;
224 #endif // WX_STL_WIDGET_03