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