1 #ifndef __wxContourMainFrame_h_INCLUDED_H__
2 #define __wxContourMainFrame_h_INCLUDED_H__
5 // -----------------------------------------------------------------------------------------------------------
6 // WX headers inclusion.
7 // For compilers that support precompilation, includes <wx/wx.h>.
8 // -----------------------------------------------------------------------------------------------------------
10 #include <wx/wxprec.h>
19 //------------------------------------------------------------------------------------------------------------
21 //------------------------------------------------------------------------------------------------------------
22 #include "wx/aui/aui.h"
24 #include "interfMainPanel.h"
25 #include "KernelManagerContour.h"
27 //#include "wxVtkBaseView_SceneManager.h"
28 #include "wxInstantChooserPanel.h"
29 #include "wxContourViewPanel.h"
33 //#include "ContourWorkspace.h"
34 #include "ContourExtractData.h"
35 #include "PerformingOperation.h"
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"
51 //#include "ContourThing.h"
53 //#include "OutlineModelManager.h"
55 //#include "wxContour_ButtonsBar.h"
56 //#include "wxContour_ControlPanel.h"
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"
69 #include "itkGeodesicActiveContourLevelSetImageFilter.h"
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"
80 #include "itkImageFileWriter.h"
82 #include "itkImageToVTKImageFilter.h"
83 #include "itkVTKImageToImageFilter.h"
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"
97 #include "vtkCamera.h"
98 #include "vtkImageActor.h"
99 #include <vtkImageMapToColors.h>
100 #include <vtkLookupTable.h>
101 #include <vtkCommand.h>
103 //#include "vtkMetaImageReader.h"
105 //------------------------------------------------------------------------------------------------------------
106 // Events declaration
107 //------------------------------------------------------------------------------------------------------------
109 //BEGIN_DECLARE_EVENT_TYPES()
110 //END_DECLARE_EVENT_TYPES()
112 /** file wxContourMainFrame.h */
115 //------------------------------------------------------------------------------------------------------------
117 //------------------------------------------------------------------------------------------------------------
118 class interfMainPanel;
119 class wxContourMainFrame : public wxPanel {
123 //------------------------------------------------------------------------------------------------------------
124 // Constructors & Destructors
125 //------------------------------------------------------------------------------------------------------------
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/");
131 ~wxContourMainFrame();
133 //------------------------------------------------------------------------------------------------------------
134 // Creational and initialization methods
135 //------------------------------------------------------------------------------------------------------------
137 void setVectImages( std::vector<vtkImageData*> images );
139 bool configurePanels(wxAuiNotebook * theNoteBook );
141 void setNotebook( wxAuiNotebook * theNoteBook );
143 wxAuiNotebook * createNotebook();
145 void createInstantChooserPanel(wxAuiNotebook * parent);
147 void createViewPanel(wxAuiNotebook * parent);
149 void createInstantChooserPanel(wxWindow * parent);
151 void createViewPanel(wxWindow * parent);
153 void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel );
157 // void setButtonsBar( wxContour_ButtonsBar * theButtonsBar );
158 // void setGrid( wxContour_Grid * theGridPanel );
159 // void setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel );
160 // void setOperationsToolsPanel( wxContour_OperationsToolsPanel * theDrawToolsPanel );
161 // void setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
162 // void setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel );
163 // void setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel );
164 // void setListViewPanel( wxContour_ListViewPanel * theListViewPanel );
167 ////------------------------------------------------------------------------------------------------------------
168 //// Methods for capturing events
169 ////------------------------------------------------------------------------------------------------------------
172 ////------------------------------------------------------------------------------------------------------------
173 //// Model management methods
174 ////------------------------------------------------------------------------------------------------------------
177 //------------------------------------------------------------------------------------------------------------
178 // Attributes getters and setters
179 //------------------------------------------------------------------------------------------------------------
180 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/");
181 static wxContourMainFrame* getInstance();
182 static void resetInstance();
183 //------------------------------------------------------------------------------------------------------------
184 // Other functional methods
185 //------------------------------------------------------------------------------------------------------------
188 ** This method returns the vector of images selected by the user
189 ** return value std::vector<vtkImageData*>
191 std::vector<vtkImageData*> getVectImages();
194 ** This methods connect the event in the class interfMainPanel with the world of the appli
196 void onCreateContourSpline( );
197 void onCreateContourRectangle( );
198 void onCreateContourCircle( );
199 void onCreateContourLine( );
200 void onCreateContourBullEye(wxPanel* pan);
201 /////////////////////////////////
202 void onDeleteContour();
203 void deleteContours( std::vector<std::string> keyNamesVector );
204 void deleteContour( std::string theKeyName );
205 void onDeleteContoursActSlice();
206 void onDeleteAllContours();
207 void deleteAllContours();
208 void setConceptValue( std::string name, int value );
209 ConceptDataWrap* getLastConceptData();
210 bool getIfConceptCheckedAt( std::string name, int pos );
212 void changeInstant();
214 int getNamesWrappingSize();
216 std::string getNameWrapping(int i);
218 void updateInstantOutlines();
219 void updateInstantImageData();
220 void updateInstantAxes();
222 void onChangeDeep(int val);
224 ///////////////////////////
229 void createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
230 void createMirrorContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append );
231 ///////////////////////7
235 void openContours( FILE *pFile, bool staticContour );
237 void RefreshInterface();
239 vtkImageData* getImageData();
241 void onSegmentationOneSlice(int isovalue,int sampling,int method);
242 void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
243 void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method );
244 void SegmentationOneSliceITK(int x, int y, int z, wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation);
245 void Mirror( int x, int y, int z, int isovalue, int sampling, int method );
246 int GetImageDataSizeZ();
247 void GetImageDataRange(double *range);
248 void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method);
251 void referenceLine();
254 void refLineChangeWidth(int width);
259 void onThreshold(int minVal, int maxVal);
261 void showAxis(bool show);
263 void onRigidPressed();
265 void onWidthOfContour(double width);
267 int getColorWindow();
268 int getWindowLevel();
270 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
272 void onInterpolation(bool interpolate);
274 void onChangeInstant(std::string name,int actual);
280 void onSpreadGo(int type);
282 void getInstantVector(std::vector<int>& tempVector);
284 std::vector<std::string> getOutlinesName(int slide);
286 void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ);
288 void onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup);
290 void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
292 void SaveImageResult(std::string directory,std::string namefile, int typeContourGroup);
294 void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
296 void onSnakePressed();
298 void saveFileWithContoursAutomatique();
300 //------------------------------------------------------------------------------------------------------------
302 //------------------------------------------------------------------------------------------------------------
305 //------------------------------------------------------------------------------------------------------------
307 //------------------------------------------------------------------------------------------------------------
309 static wxContourMainFrame* instance;
311 KernelManagerContour* kernelManager;
313 interfMainPanel* _pannew;
315 PerformingOperation* _performingOperation;
317 std::string _datadir;
319 wxContourViewPanel* _theViewPanel;
321 wxInstantChooserPanel * _instantPanel;
323 //AD: 03-09: This attributes represents the reference line that is going to be used for the mirroring
324 manualLineControler * _refLineControl;
325 manualContourModelLine * _refLineModel;
326 manualViewLine * _refLineView;
332 wxArrayString m_perspectives;
333 wxMenu* m_perspectives_menu;
335 long m_notebook_style;
336 long m_notebook_theme;
337 int _numberOfVariablesStatistics;
339 //OutlineModelManager * _modelManager;
343 //wxContour_ButtonsBar * _buttonsBar;
345 //wxContour_Grid * _gridPanel;
347 //wxContour_DrawToolsPanel * _drawToolsPanel;
349 //wxContour_OperationsToolsPanel * _operationsToolsPanel;
351 //wxContour_AutomaticFormsToolsPanel * _autoFormsPanel;
353 //wxContour_StandardToolsPanel *_standardToolsPanel;
355 //wxContour_EdtionToolsPanel * _editionToolsPanel;
357 //wxContour_ListViewPanel * _listViewPanel;
359 //wxVtkBaseView_SceneManager * _sceneManager;
361 //Instant * _actualInstant;
365 /*DECLARE_CLASS(wxContourMainFrame)
366 // any class wishing to process wxWindows events must use this macro
367 DECLARE_EVENT_TABLE()*/
368 bool _creatingContoursActive;
369 ////////JCP 21 - 11 - 08
370 void createContour( int typeContour );
372 //manualContourModel * factoryManualContourModel(int typeContour);
374 manualContourModel * factoryManualContourModel(wxPanel* panel);
379 void loadState(std::string filename);
381 void saveFileWithContours( std::string filename );
385 std::string stundoredo;