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