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