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