]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
6259baff6ae56dbe6f5fbcd6f9dddf2cda2742c0
[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="C:/Creatis/creaContoursBin/RelWithDebInfo/");
123
124         ~wxContourMainFrame();
125
126         //------------------------------------------------------------------------------------------------------------
127         // Creational and initialization methods
128         //------------------------------------------------------------------------------------------------------------
129
130         void setVectImages( std::vector<vtkImageData*> images );
131
132         bool configurePanels(wxAuiNotebook * theNoteBook );
133
134         void setNotebook( wxAuiNotebook * theNoteBook );
135
136         wxAuiNotebook * createNotebook();
137
138         void createInstantChooserPanel(wxAuiNotebook * parent);
139
140         void createViewPanel(wxAuiNotebook * parent);
141         
142         void createInstantChooserPanel(wxWindow * parent);
143
144         void createViewPanel(wxWindow * parent);
145
146         void setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel );
147
148 //      void setButtonsBar(  wxContour_ButtonsBar * theButtonsBar );
149
150 //      void setGrid(  wxContour_Grid * theGridPanel );
151
152 //      void setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel );
153
154 //      void setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theDrawToolsPanel );
155
156 //      void setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
157
158 //      void setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel );
159
160 //      void setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel );
161
162 //      void setListViewPanel(  wxContour_ListViewPanel * theListViewPanel );
163
164
165         ////------------------------------------------------------------------------------------------------------------
166         //// Methods for capturing events
167         ////------------------------------------------------------------------------------------------------------------
168         
169
170         ////------------------------------------------------------------------------------------------------------------
171         ////  Model management methods
172         ////------------------------------------------------------------------------------------------------------------
173
174         
175         //------------------------------------------------------------------------------------------------------------
176         //  Attributes getters and setters
177         //------------------------------------------------------------------------------------------------------------
178         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="C:/Creatis/creaContoursBin/RelWithDebInfo/");
179         static wxContourMainFrame* getInstance();
180         //------------------------------------------------------------------------------------------------------------
181         //  Other functional methods
182         //------------------------------------------------------------------------------------------------------------
183
184         /*
185         ** This method returns the vector of images selected by the user 
186         **      return value std::vector<vtkImageData*>
187         */
188         std::vector<vtkImageData*> getVectImages();
189
190         /**
191         **      This methods connect the event in the class interfMainPanel with the world of the appli
192         **/
193         void onCreateContourSpline( );
194         void onCreateContourRectangle( );
195         void onCreateContourCircle( );
196         void onCreateContourLine( );
197         void onCreateContourBullEye(wxPanel* pan);
198         /////////////////////////////////
199         void onDeleteContour();
200         void deleteContours( std::vector<std::string>  keyNamesVector );
201         void deleteContour( std::string theKeyName );
202         void onDeleteContoursActSlice();
203         void onDeleteAllContours();
204         void deleteAllContours();
205         void setConceptValue( std::string name, int value );
206         ConceptDataWrap* getLastConceptData();
207         bool getIfConceptCheckedAt( std::string name, int pos );
208
209         void changeInstant();
210
211         int getNamesWrappingSize();
212
213         std::string getNameWrapping(int i);
214
215
216         void updateInstantOutlines();
217         void updateInstantImageData();
218         void updateInstantAxes();
219
220         void onChangeDeep(int val);
221
222 ///////////////////////////
223         void onCopy();
224         void onPaste();
225         void onUndo();
226         void onRedo();
227         void createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
228         void createMirrorContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
229 ///////////////////////7
230         void onLoad();
231         void onSave();
232         
233         void openContours( FILE *pFile, bool staticContour );
234
235         void RefreshInterface();
236
237         vtkImageData* getImageData();
238
239         void onSegmentationOneSlice(int isovalue,int sampling,int method);
240
241         void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
242
243         void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method );
244
245         void SegmentationOneSliceITK(int x, int y, int z, wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
246
247         void Mirror( int x, int y, int z, int isovalue, int sampling, int method );
248
249         int GetImageDataSizeZ();
250
251         void GetImageDataRange(double *range);
252
253         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
254
255         //AD
256         void referenceLine();
257         void refLineHide();
258         void refLineShow();
259
260         //AD
261         void onMirror();
262
263         void showAxis(bool show);
264
265         void onRigidPressed();
266
267         void onWidthOfContour(double width);
268
269         int getColorWindow();
270         int getWindowLevel();
271
272         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
273
274         void onInterpolation(bool interpolate);
275
276         void onChangeInstant(std::string name,int actual);
277
278         void resetAppend();
279
280         void onSpreadAdd();
281
282         void onSpreadGo(int type);
283
284         void getInstantVector(std::vector<int>& tempVector);
285
286         std::vector<std::string> getOutlinesName(int slide);
287
288         void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ);
289
290         void onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup);
291
292         void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
293
294         void SaveImageResult(std::string directory,std::string namefile, int typeContourGroup);
295
296         void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
297
298         void onSnakePressed();
299
300         void saveFileWithContoursAutomatique();
301 private:
302         //------------------------------------------------------------------------------------------------------------
303         //  Private methods
304         //------------------------------------------------------------------------------------------------------------
305
306         
307         //------------------------------------------------------------------------------------------------------------
308         // Attributtes
309         //------------------------------------------------------------------------------------------------------------
310         static wxContourMainFrame* instance;
311
312         KernelManagerContour* kernelManager;
313
314         std::string _datadir;
315
316         wxContourViewPanel* _theViewPanel;
317
318         wxInstantChooserPanel * _instantPanel;
319
320         //AD: 03-09: This attributes represents the reference line that is going to be used for the mirroring
321         manualLineControler             * _refLineControl;
322         manualContourModelLine  * _refLineModel;
323         manualViewLine                  * _refLineView;
324
325
326
327         wxAuiManager m_mgr;
328     /*
329         wxArrayString m_perspectives;
330     wxMenu* m_perspectives_menu;
331         */
332     long m_notebook_style;
333     long m_notebook_theme;
334         int _numberOfVariablesStatistics;
335
336         //OutlineModelManager * _modelManager;
337
338         
339
340         //wxContour_ButtonsBar * _buttonsBar;
341
342         //wxContour_Grid *  _gridPanel;
343
344         //wxContour_DrawToolsPanel * _drawToolsPanel;
345
346         //wxContour_OperationsToolsPanel * _operationsToolsPanel;
347
348         //wxContour_AutomaticFormsToolsPanel * _autoFormsPanel; 
349
350         //wxContour_StandardToolsPanel *_standardToolsPanel;
351
352         //wxContour_EdtionToolsPanel * _editionToolsPanel;
353
354         //wxContour_ListViewPanel * _listViewPanel;
355
356         //wxVtkBaseView_SceneManager * _sceneManager;
357
358         //Instant * _actualInstant;
359
360         
361
362         /*DECLARE_CLASS(wxContourMainFrame)
363         // any class wishing to process wxWindows events must use this macro
364         DECLARE_EVENT_TABLE()*/
365         bool _creatingContoursActive;
366 ////////JCP 21 - 11 - 08
367         void createContour( int typeContour );
368
369         //manualContourModel * factoryManualContourModel(int typeContour);
370
371         manualContourModel * factoryManualContourModel(wxPanel* panel);
372
373
374
375         void saveState();
376         void loadState(std::string filename);
377
378         void saveFileWithContours( std::string filename );
379
380         int inredo;
381         int inundo;
382         std::string     stundoredo;
383
384         
385
386         //wxContourViewPanel* _viewPan;
387         PerformingOperation* _performingOperation;
388
389         static char COPY;
390
391 };
392
393 #endif