]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
Added ITK Segmentation Algorithm
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.h
1 #ifndef __wxContourMainFrame_h_INCLUDED_H__
2 #define __wxContourMainFrame_h_INCLUDED_H__
3
4
5 // -----------------------------------------------------------------------------------------------------------
6 // WX headers inclusion.
7 // For compilers that support precompilation, includes <wx/wx.h>.
8 // -----------------------------------------------------------------------------------------------------------
9
10 #include <wx/wxprec.h>
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14 #ifndef WX_PRECOMP
15 #include <wx/wx.h>
16 #endif
17
18
19 //------------------------------------------------------------------------------------------------------------
20 // Includes
21 //------------------------------------------------------------------------------------------------------------
22 #include "wx/aui/aui.h"
23
24 #include "interfMainPanel.h"
25 #include "KernelManagerContour.h"
26
27 //#include "wxVtkBaseView_SceneManager.h"
28 #include "wxInstantChooserPanel.h"
29 #include "wxContourViewPanel.h"
30
31
32
33 //#include "ContourWorkspace.h"
34 #include "ContourExtractData.h"
35 #include "PerformingOperation.h"
36
37
38
39 //#include "ContourThing.h"
40 //#include "AxeThing.h"
41 //#include "ImageSourceThing.h"
42 //#include "ImageSectionThing.h"
43 //#include "InstantMembersNameList.h"
44 //#include "OutlineGroup.h"
45 //#include "SomeEnvironment.h"
46 //#include "ContourWorkspace.h"
47 //#include "ContourWrap_ViewControl.h"
48 //#include "Instant.h"
49 //#include "PerformingOperation.h"
50
51 //#include "ContourThing.h"
52
53 //#include "OutlineModelManager.h"
54
55 //#include "wxContour_ButtonsBar.h"
56 //#include "wxContour_ControlPanel.h"
57
58 //#include "wxContour_Grid.h"
59 //#include "wxContour_DrawToolsPanel.h"
60 //#include "wxContour_OperationsToolsPanel.h"
61 //#include "wxContour_AutomaticFormsToolsPanel.h"
62 //#include "wxContour_StandardToolsPanel.h"
63 //#include "wxContour_EdtionToolsPanel.h"
64 //#include "wxContour_ListViewPanel.h"
65
66
67 //ITK
68 #include "itkImage.h"
69 #include "itkGeodesicActiveContourLevelSetImageFilter.h"
70
71 #include "itkCurvatureAnisotropicDiffusionImageFilter.h"
72 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
73 #include "itkSigmoidImageFilter.h"
74 #include "itkFastMarchingImageFilter.h"
75 #include "itkRescaleIntensityImageFilter.h"
76 #include "itkBinaryThresholdImageFilter.h"
77 #include "itkZeroCrossingImageFilter.h"
78 #include "itkCastImageFilter.h"
79
80 #include "itkImageFileWriter.h"
81
82 #include "itkImageToVTKImageFilter.h"
83 #include "itkVTKImageToImageFilter.h"
84
85 //VTK
86 #include <vtkImageSeedConnectivity.h>
87 #include <vtkImageMarchingCubes.h>
88 #include "vtkContourFilter.h"
89 #include "vtkMarchingContourFilter.h"
90 #include "vtkPolyDataConnectivityFilter.h"
91 #include "vtkCleanPolyData.h"
92 #include "vtkImageReslice.h"
93 #include "vtkMetaImageWriter.h"
94 #include "vtkImageData.h"
95 #include "vtkTransform.h"
96 //#include "vtkMetaImageReader.h"
97
98 //------------------------------------------------------------------------------------------------------------
99 // Events declaration
100 //------------------------------------------------------------------------------------------------------------
101
102 //BEGIN_DECLARE_EVENT_TYPES()
103 //END_DECLARE_EVENT_TYPES()
104
105 /** file wxContourMainFrame.h */
106
107
108 //------------------------------------------------------------------------------------------------------------
109 // Class definition
110 //------------------------------------------------------------------------------------------------------------
111
112 class wxContourMainFrame : public wxPanel {
113
114         public:
115
116         //------------------------------------------------------------------------------------------------------------
117         // Constructors & Destructors
118         //------------------------------------------------------------------------------------------------------------
119         
120
121         wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style  = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER);
122         wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style  = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,std::string datadir="<void>");
123
124         ~wxContourMainFrame();
125
126         //------------------------------------------------------------------------------------------------------------
127         // Creational and initialization methods
128         //------------------------------------------------------------------------------------------------------------
129         bool configurePanels(wxAuiNotebook * theNoteBook );
130
131         void setNotebook( wxAuiNotebook * theNoteBook );
132
133         wxAuiNotebook * createNotebook();
134
135         void createInstantChooserPanel(wxAuiNotebook * parent);
136
137         void createViewPanel(wxAuiNotebook * parent);
138         
139         void createInstantChooserPanel(wxWindow * parent);
140
141         void createViewPanel(wxWindow * parent);
142
143         void setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel );
144
145 //      void setButtonsBar(  wxContour_ButtonsBar * theButtonsBar );
146
147 //      void setGrid(  wxContour_Grid * theGridPanel );
148
149 //      void setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel );
150
151 //      void setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theDrawToolsPanel );
152
153 //      void setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
154
155 //      void setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel );
156
157 //      void setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel );
158
159 //      void setListViewPanel(  wxContour_ListViewPanel * theListViewPanel );
160
161
162         ////------------------------------------------------------------------------------------------------------------
163         //// Methods for capturing events
164         ////------------------------------------------------------------------------------------------------------------
165         
166
167         ////------------------------------------------------------------------------------------------------------------
168         ////  Model management methods
169         ////------------------------------------------------------------------------------------------------------------
170
171         
172         //------------------------------------------------------------------------------------------------------------
173         //  Attributes getters and setters
174         //------------------------------------------------------------------------------------------------------------
175         static wxContourMainFrame* getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style  = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, std::string datadir="<void>");
176         static wxContourMainFrame* getInstance();
177         //------------------------------------------------------------------------------------------------------------
178         //  Other functional methods
179         //------------------------------------------------------------------------------------------------------------
180
181         /*
182         ** This method returns the vector of images selected by the user 
183         **      return value std::vector<vtkImageData*>
184         */
185         std::vector<vtkImageData*> getVectImages();
186
187         /**
188         **      This methods connect the event in the class interfMainPanel with the world of the appli
189         **/
190         void onCreateContourSpline( );
191         void onCreateContourRectangle( );
192         void onCreateContourCircle( );
193         void onCreateContourLine( );
194         void onCreateContourBullEye(wxPanel* pan);
195         /////////////////////////////////
196         void onDeleteContour();
197         void deleteContours( std::vector<std::string>  keyNamesVector );
198         void deleteContour( std::string theKeyName );
199         void onDeleteContoursActSlice();
200         void onDeleteAllContours();
201         void deleteAllContours();
202         void setConceptValue( std::string name, int value );
203         ConceptDataWrap* getLastConceptData();
204         bool getIfConceptCheckedAt( std::string name, int pos );
205
206         void changeInstant();
207
208         int getNamesWrappingSize();
209
210         std::string getNameWrapping(int i);
211
212
213         void updateInstantOutlines();
214         void updateInstantImageData();
215         void updateInstantAxes();
216
217         void onChangeDeep(int val);
218
219 ///////////////////////////
220         void onCopy();
221         void onPaste();
222         void onUndo();
223         void onRedo();
224         void createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
225         void createMirrorContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
226 ///////////////////////7
227         void onLoad();
228         void onSave();
229         
230         void openContours( FILE *pFile, bool staticContour );
231
232         void RefreshInterface();
233
234         vtkImageData* getImageData();
235
236         void onSegmentationOneSlice(int isovalue,int sampling,int method);
237
238         void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
239
240         void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method );
241
242         void SegmentationOneSliceITK(int x, int y, int z, wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
243
244         void Mirror( int x, int y, int z, int isovalue, int sampling, int method );
245
246         int GetImageDataSizeZ();
247
248         void GetImageDataRange(double *range);
249
250         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
251
252         //AD
253         void referenceLine();
254         void refLineHide();
255         void refLineShow();
256
257         //AD
258         void onMirror();
259
260         void showAxis(bool show);
261
262         void onRigidPressed();
263
264         void onWidthOfContour(double width);
265
266         int getColorWindow();
267         int getWindowLevel();
268
269         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
270
271         void onInterpolation(bool interpolate);
272
273         void onChangeInstant(std::string name,int actual);
274
275         void resetAppend();
276
277         void onSpreadAdd();
278
279         void onSpreadGo(int type);
280
281         void getInstantVector(std::vector<int>& tempVector);
282
283         std::vector<std::string> getOutlinesName(int slide);
284
285         void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ);
286
287         void onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup);
288
289         void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
290
291         void SaveImageResult(std::string directory,std::string namefile, int typeContourGroup);
292
293         void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
294
295         void onSnakePressed();
296
297         void saveFileWithContoursAutomatique();
298 private:
299         //------------------------------------------------------------------------------------------------------------
300         //  Private methods
301         //------------------------------------------------------------------------------------------------------------
302
303         
304         //------------------------------------------------------------------------------------------------------------
305         // Attributtes
306         //------------------------------------------------------------------------------------------------------------
307         static wxContourMainFrame* instance;
308
309         KernelManagerContour* kernelManager;
310
311         wxContourViewPanel* _theViewPanel;
312
313         wxInstantChooserPanel * _instantPanel;
314
315         //AD: 03-09: This attributes represents the reference line that is going to be used for the mirroring
316         manualLineControler             * _refLineControl;
317         manualContourModelLine  * _refLineModel;
318         manualViewLine                  * _refLineView;
319
320
321
322         wxAuiManager m_mgr;
323     /*
324         wxArrayString m_perspectives;
325     wxMenu* m_perspectives_menu;
326         */
327     long m_notebook_style;
328     long m_notebook_theme;
329         int _numberOfVariablesStatistics;
330
331         //OutlineModelManager * _modelManager;
332
333         
334
335         //wxContour_ButtonsBar * _buttonsBar;
336
337         //wxContour_Grid *  _gridPanel;
338
339         //wxContour_DrawToolsPanel * _drawToolsPanel;
340
341         //wxContour_OperationsToolsPanel * _operationsToolsPanel;
342
343         //wxContour_AutomaticFormsToolsPanel * _autoFormsPanel; 
344
345         //wxContour_StandardToolsPanel *_standardToolsPanel;
346
347         //wxContour_EdtionToolsPanel * _editionToolsPanel;
348
349         //wxContour_ListViewPanel * _listViewPanel;
350
351         //wxVtkBaseView_SceneManager * _sceneManager;
352
353         //Instant * _actualInstant;
354
355         
356
357         /*DECLARE_CLASS(wxContourMainFrame)
358         // any class wishing to process wxWindows events must use this macro
359         DECLARE_EVENT_TABLE()*/
360         bool _creatingContoursActive;
361 ////////JCP 21 - 11 - 08
362         void createContour( int typeContour );
363
364         //manualContourModel * factoryManualContourModel(int typeContour);
365
366         manualContourModel * factoryManualContourModel(wxPanel* panel);
367
368
369
370         void saveState();
371         void loadState(std::string filename);
372
373         void saveFileWithContours( std::string filename );
374
375         int inredo;
376         int inundo;
377         std::string     stundoredo;
378
379         
380
381         //wxContourViewPanel* _viewPan;
382         PerformingOperation* _performingOperation;
383
384         static char COPY;
385
386 };
387
388 #endif