]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
5733100aae36feb7e057dbb8b69bb192986886bf
[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         void ShowToolsPanel(bool show);
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         void updateActor();
226
227         void onChangeDeep(int val);
228
229 ///////////////////////////
230         void onCopy();
231         void onPaste();
232         void onUndo();
233         void onRedo();
234         void createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
235         void createMirrorContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
236 ///////////////////////7
237         void onLoad();
238         void onSave();
239         
240         void openContours( FILE *pFile, bool staticContour );
241
242         void RefreshInterface();
243
244         vtkImageData* getImageData();
245
246         void onSegmentationOneSlice(int isovalue,int sampling,int method);
247         void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
248         void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method );
249         void SegmentationOneSliceITK(int x, int y, int z, wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
250         void Mirror( int x, int y, int z, int isovalue, int sampling, int method );
251         int  GetImageDataSizeZ();
252         void GetImageDataRange(double *range);
253         void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
254
255         //AD
256         void referenceLine();
257         void refLineHide();
258         void refLineShow();
259         void refLineChangeWidth(int width);
260
261         //AD
262         void onMirror();
263         void onThreshold(int minVal, int maxVal);
264         void onThresholdChange(int minVal, int maxVal);
265         void onThresholdInterpolation(bool interpolate);
266         void onThresholdChangeOpacity (int opacity);
267         void onThresholdRemove();
268
269 //====================================================================================================  
270
271         void showAxis(bool show);
272
273         void onRigidPressed();
274
275         void onWidthOfContour(double width);
276
277         int getColorWindow();
278         int getWindowLevel();
279
280         void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
281
282         void onInterpolation(bool interpolate);
283
284         void onChangeInstant(std::string name,int actual);
285
286         void resetAppend();
287
288         void onSpreadAdd();
289
290         void onSpreadGo(int type);
291
292         void getInstantVector(std::vector<int>& tempVector);
293
294         std::vector<std::string> getOutlinesName(int slide);
295
296         void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ);
297
298         void onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup);
299
300         void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
301
302         
303
304         void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
305
306         void onSnakePressed();
307
308         void saveFileWithContoursAutomatique();
309 private:
310         //------------------------------------------------------------------------------------------------------------
311         //  Private methods
312         //------------------------------------------------------------------------------------------------------------
313
314         
315         //------------------------------------------------------------------------------------------------------------
316         // Attributtes
317         //------------------------------------------------------------------------------------------------------------
318         
319         static wxContourMainFrame* instance;
320
321         KernelManagerContour* kernelManager;
322
323         interfMainPanel* _pannew;
324
325         PerformingOperation* _performingOperation;
326
327         std::string _datadir;
328
329         wxContourViewPanel* _theViewPanel;
330
331         wxInstantChooserPanel * _instantPanel;
332
333         //AD: 03-09: This attributes represents the reference line that is going to be used for the mirroring
334         manualLineControler     * _refLineControl;
335         manualContourModelLine  * _refLineModel;
336         manualViewLine          * _refLineView;
337
338
339
340         wxAuiManager m_mgr;
341         wxAuiNotebook * notebook;
342
343     long m_notebook_style;
344     long m_notebook_theme;
345     int _numberOfVariablesStatistics;
346         
347         vtkImageActor * _thresholdActor;
348
349         bool _actorPresent;
350
351         //OutlineModelManager * _modelManager;
352
353         
354
355         //wxContour_ButtonsBar * _buttonsBar;
356
357         //wxContour_Grid *  _gridPanel;
358
359         //wxContour_DrawToolsPanel * _drawToolsPanel;
360
361         //wxContour_OperationsToolsPanel * _operationsToolsPanel;
362
363         //wxContour_AutomaticFormsToolsPanel * _autoFormsPanel; 
364
365         //wxContour_StandardToolsPanel *_standardToolsPanel;
366
367         //wxContour_EdtionToolsPanel * _editionToolsPanel;
368
369         //wxContour_ListViewPanel * _listViewPanel;
370
371         //wxVtkBaseView_SceneManager * _sceneManager;
372
373         //Instant * _actualInstant;
374
375         
376
377         /*DECLARE_CLASS(wxContourMainFrame)
378         // any class wishing to process wxWindows events must use this macro
379         DECLARE_EVENT_TABLE()*/
380         bool _creatingContoursActive;
381 ////////JCP 21 - 11 - 08
382         void createContour( int typeContour );
383
384         //manualContourModel * factoryManualContourModel(int typeContour);
385
386         manualContourModel * factoryManualContourModel(wxPanel* panel);
387
388
389
390         void saveState();
391         void loadState(std::string filename);
392
393         void saveFileWithContours( std::string filename );
394
395         int inredo;
396         int inundo;
397         std::string     stundoredo;
398
399
400         static char COPY;
401
402 };
403
404 #endif