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 <kernel/marInterface.h>
52 #include <kernel/axisExtractor02.h>
55 #include "kernel/vtkSTLExtractor.h"
56 #include "kernel/vtkJoiner.h"
61 //------------------------------------------------------------------
62 //------------------------------------------------------------------
63 //------------------------------------------------------------------
65 class wxSTLWidget_03: public wxPanel{
67 wxSTLWidget_03(wxWindow *parentmar,marInterface *mar);
72 void OnOpacity_Vol(wxScrollEvent& event); // Result Volume
73 void OnMinSpin ( wxScrollEvent & event );
74 void OnMaxSpin ( wxScrollEvent & event );
77 void OnRangeSpin( wxScrollEvent & event );
79 //Handled events form the bar
80 void OnStartChanged_range(wxCommandEvent& event);
81 void OnEndChanged_range(wxCommandEvent& event);
82 void OnBarMoved_range(wxCommandEvent& event);
85 void OnBtnExtraction(wxCommandEvent& event);
86 void OnBtnSaveBinaryFile(wxCommandEvent& event);
89 void Reset_vtk_STLFile();
90 void OnBtnSTLFileLoad(wxCommandEvent& event);
91 void OnBtnSTLFileErase(wxCommandEvent& event);
92 void OnOpacitySTLFile(wxScrollEvent& event);
95 // --------------------------------------
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);
106 //---------------------------------------
107 // JOIN REGIONS FUNCTIONS
108 //---------------------------------------
109 void OnJoinRegions(wxCommandEvent& event);
114 vtkImageData *_imagedata;
118 vtkImageCast *cast4; // binary segmentation result
119 vtkImageThreshold *_thresh;
120 vtkImageThreshold *_thresh2;
121 vtkImageSeedConnectivity *_connect;
122 vtkImageSeedConnectivity *_connect2;
126 vtkPolyDataMapper *_2_mapfinal;
127 vtkActor *_2_stripfinal;
128 vtkPolyDataMapper *_2_isoMapperMC6;
129 vtkActor *_2_isoActorMC6;
130 vtkMarchingCubes *_2_isoMC6;
131 double _sensibility_JF;
136 vtkPolyDataMapper *_loadSTLMapper;
137 vtkActor *_loadActorSTL;
140 wxSlider *_opacity_Vol;
141 wxSlider *_sl_minSize;
142 wxSlider *_sl_maxSize;
143 wxSlider *_sl_minSizeSpin;
144 wxSlider *_sl_maxSizeSpin;
145 wxSlider *_sl_RangeSizeSpin;
149 * Represents the bar of min and max for merging the functionality of two sliders for controlling the segmentation parameters
151 mBarRange * sl_barrange_segmentation;
152 int lastResizeRef_Value;
156 wxVtk3DBaseView *_imageviewer3D;
157 wxPanel *CreateControlPanel(wxWindow *parent);
158 wxPanel *CreateViewPanel(wxWindow *parent);
162 wxMaracasMPR *_wxMaracasMPR;
164 void ResetTree2_JF();
165 void ExtractSurface(int x, int y, int z);
167 wxWindow* CreateSelectAPointPanel(wxWindow *parent);
168 wxWindow* CreateSegmentationPanel(wxWindow *parent);
169 wxWindow* CreateSmoothingPanel(wxWindow *parent);
170 wxWindow* CreateReadSTLFilePanel(wxWindow *parent);
172 //---------------------
174 //---------------------
175 void ConfigureProcessing(marImageData *marimagedata, int x, int y, int z);
178 //---------------------
180 //---------------------
182 double _stlDeltaGaussLevel;
183 double _stlMarchingCubesLevel;
186 vtkPolyData *stlInterna;
187 vtkPolyData *stlExterna;
189 wxSlider *stlSliderDeltaGauss;
190 wxSlider *stlSliderMarchingCubes;
192 vtkPolyDataMapper *dsm1;
193 vtkActor *actorInternal;
194 wxSlider *stlSliderOpacityInternal;
196 vtkPolyDataMapper *dsm2;
197 vtkActor *actorExternal;
198 wxSlider *stlSliderOpacityExternal;
200 vtkSTLExtractor *stlExtractor;
202 wxSlider *_sl_opacity_STL_file;
206 //--------------------------
208 //--------------------------
210 vtkImageData *arteryImageData;
212 vtkMarchingCubes *joinMarchingCubes;
213 vtkPolyDataMapper *joinMapper;
218 #endif // WX_STL_WIDGET_03