]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
no 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(std::vector<vtkImageData*> imgs);
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         void getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup, int selection, int minZ, int maxZ);
156
157         void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
158
159         void ShowToolsPanel(bool show);
160
161
162 //      void setButtonsBar(  wxContour_ButtonsBar * theButtonsBar );
163 //      void setGrid(  wxContour_Grid * theGridPanel );
164 //      void setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel );
165 //      void setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theDrawToolsPanel );
166 //      void setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
167 //      void setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel );
168 //      void setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel );
169 //      void setListViewPanel(  wxContour_ListViewPanel * theListViewPanel );
170
171
172         ////------------------------------------------------------------------------------------------------------------
173         //// Methods for capturing events
174         ////------------------------------------------------------------------------------------------------------------
175         
176
177         ////------------------------------------------------------------------------------------------------------------
178         ////  Model management methods
179         ////------------------------------------------------------------------------------------------------------------
180
181         
182         //------------------------------------------------------------------------------------------------------------
183         //  Attributes getters and setters
184         //------------------------------------------------------------------------------------------------------------
185         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/");
186         static wxContourMainFrame* getInstance();
187         static void resetInstance();
188         //------------------------------------------------------------------------------------------------------------
189         //  Other functional methods
190         //------------------------------------------------------------------------------------------------------------
191
192         /*
193         ** This method returns the vector of images selected by the user 
194         **      return value std::vector<vtkImageData*>
195         */
196         std::vector<vtkImageData*> getVectImages();
197
198         /**
199         **      This methods connect the event in the class interfMainPanel with the world of the appli
200         **/
201         void onCreateContourSpline( );
202         void onCreateContourRectangle( );
203         void onCreateContourCircle( );
204         void onCreateContourLine( );
205         void onCreateContourBullEye(wxPanel* pan);
206         /////////////////////////////////
207         void onDeleteContour();
208         void deleteContours( std::vector<std::string>  keyNamesVector );
209         void deleteContour( std::string theKeyName );
210         void onDeleteContoursActSlice();
211         void onDeleteAllContours();
212         void deleteAllContours();
213         void setConceptValue( std::string name, int value );
214         ConceptDataWrap* getLastConceptData();
215         bool getIfConceptCheckedAt( std::string name, int pos );
216
217         void changeInstant();
218
219         int getNamesWrappingSize();
220
221         std::string getNameWrapping(int i);
222
223         void updateInstantOutlines();
224         void updateInstantImageData();
225         void updateInstantAxes();
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, int version, 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();
264         void onThresholdChange();
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,int grayRangeMin, int grayRangeMax);
297
298         void onSaveResults(std::string directory,std::string namefile, std::string filename, 
299                 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics);
300
301         void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
302
303         
304
305         void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
306
307         void onSnakePressed();
308
309         void saveFileWithContoursAutomatique();
310         
311         void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ );
312
313
314 private:
315         //------------------------------------------------------------------------------------------------------------
316         //  Private methods
317         //------------------------------------------------------------------------------------------------------------
318
319         
320         //------------------------------------------------------------------------------------------------------------
321         // Attributtes
322         //------------------------------------------------------------------------------------------------------------
323         
324         static wxContourMainFrame* instance;
325
326         KernelManagerContour* kernelManager;
327
328         interfMainPanel* _pannew;
329
330         PerformingOperation* _performingOperation;
331
332         std::string _datadir;
333
334         wxContourViewPanel* _theViewPanel;
335
336         wxInstantChooserPanel * _instantPanel;
337
338         //AD: 03-09: This attributes represents the reference line that is going to be used for the mirroring
339         manualLineControler     * _refLineControl;
340         manualContourModelLine  * _refLineModel;
341         manualViewLine          * _refLineView;
342
343
344
345         wxAuiManager m_mgr;
346         wxAuiNotebook * notebook;
347
348     long m_notebook_style;
349     long m_notebook_theme;
350     int _numberOfVariablesStatistics;
351         
352         vtkImageReslice * _imageReslicer;
353         vtkLookupTable * _thresholdTable;
354         vtkImageMapToColors * _thresholdMapper;
355         vtkImageActor * _thresholdActor;
356
357         std::vector<vtkImageData*> _images;
358
359         bool _actorPresent;
360
361         //OutlineModelManager * _modelManager;
362
363         
364
365         //wxContour_ButtonsBar * _buttonsBar;
366
367         //wxContour_Grid *  _gridPanel;
368
369         //wxContour_DrawToolsPanel * _drawToolsPanel;
370
371         //wxContour_OperationsToolsPanel * _operationsToolsPanel;
372
373         //wxContour_AutomaticFormsToolsPanel * _autoFormsPanel; 
374
375         //wxContour_StandardToolsPanel *_standardToolsPanel;
376
377         //wxContour_EdtionToolsPanel * _editionToolsPanel;
378
379         //wxContour_ListViewPanel * _listViewPanel;
380
381         //wxVtkBaseView_SceneManager * _sceneManager;
382
383         //Instant * _actualInstant;
384
385         
386
387         /*DECLARE_CLASS(wxContourMainFrame)
388         // any class wishing to process wxWindows events must use this macro
389         DECLARE_EVENT_TABLE()*/
390         bool _creatingContoursActive;
391 ////////JCP 21 - 11 - 08
392         void createContour( int typeContour );
393
394         //manualContourModel * factoryManualContourModel(int typeContour);
395
396         manualContourModel * factoryManualContourModel(wxPanel* panel);
397         
398         ContourExtractData      *_contourextractdata;
399
400         void GenerateContourExtractData();
401         void saveState();
402         void loadState(std::string filename);
403         void loadContours( FILE *pFile, bool staticContour );
404
405         void saveFileWithContours( std::string filename );
406
407         int inredo;
408         int inundo;
409         std::string     stundoredo;
410
411
412         static char COPY;
413
414 };
415
416 #endif