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