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