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"
31 //#include "ContourWorkspace.h"
32 #include "ContourExtractData.h"
33 #include "PerformingOperation.h"
35 #include "manualLineControler.h"
36 #include "manualContourModelLine.h"
37 #include "manualViewLine.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*> imgs);
139 bool configurePanels( );
141 bool addNewPanel(wxPanel* panel);
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 );
156 void getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup);
158 void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
160 void ShowToolsPanel(bool show);
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 );
173 ////------------------------------------------------------------------------------------------------------------
174 //// Methods for capturing events
175 ////------------------------------------------------------------------------------------------------------------
178 ////------------------------------------------------------------------------------------------------------------
179 //// Model management methods
180 ////------------------------------------------------------------------------------------------------------------
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 //------------------------------------------------------------------------------------------------------------
194 ** This method returns the vector of images selected by the user
195 ** return value std::vector<vtkImageData*>
197 std::vector<vtkImageData*> getVectImages();
200 ** This methods connect the event in the class interfMainPanel with the world of the appli
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 );
218 void changeInstant();
220 int getNamesWrappingSize();
222 std::string getNameWrapping(int i);
224 void updateInstantOutlines();
225 void updateInstantImageData();
226 void updateInstantAxes();
228 void onChangeDeep(int val);
230 ///////////////////////////
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
241 void openContours( FILE *pFile, int version, bool staticContour );
243 void RefreshInterface();
245 vtkImageData* getImageData();
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);
257 void referenceLine();
260 void refLineChangeWidth(int width);
265 void onThresholdChange();
266 void onThresholdInterpolation(bool interpolate);
267 void onThresholdChangeOpacity (int opacity);
268 void onThresholdRemove();
270 //====================================================================================================
272 void showAxis(bool show);
274 void onRigidPressed();
276 void onWidthOfContour(double width);
278 int getColorWindow();
279 int getWindowLevel();
281 void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
283 void onInterpolation(bool interpolate);
285 void onChangeInstant(std::string name,int actual);
291 void onSpreadGo(int type);
293 void getInstantVector(std::vector<int>& tempVector);
295 std::vector<std::string> getOutlinesName(int slide);
297 void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ);
299 void onSaveResults(std::string directory,std::string namefile, std::string filename,
300 int typeContourGroup, bool XYZValues, bool contourImage, bool statistics);
302 void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);
306 void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
308 void onSnakePressed();
310 void saveFileWithContoursAutomatique();
312 //------------------------------------------------------------------------------------------------------------
314 //------------------------------------------------------------------------------------------------------------
317 //------------------------------------------------------------------------------------------------------------
319 //------------------------------------------------------------------------------------------------------------
321 static wxContourMainFrame* instance;
323 KernelManagerContour* kernelManager;
325 interfMainPanel* _pannew;
327 PerformingOperation* _performingOperation;
329 std::string _datadir;
331 wxContourViewPanel* _theViewPanel;
333 wxInstantChooserPanel * _instantPanel;
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;
343 wxAuiNotebook * notebook;
345 long m_notebook_style;
346 long m_notebook_theme;
347 int _numberOfVariablesStatistics;
349 vtkImageReslice * _imageReslicer;
350 vtkLookupTable * _thresholdTable;
351 vtkImageMapToColors * _thresholdMapper;
352 vtkImageActor * _thresholdActor;
354 std::vector<vtkImageData*> _images;
358 //OutlineModelManager * _modelManager;
362 //wxContour_ButtonsBar * _buttonsBar;
364 //wxContour_Grid * _gridPanel;
366 //wxContour_DrawToolsPanel * _drawToolsPanel;
368 //wxContour_OperationsToolsPanel * _operationsToolsPanel;
370 //wxContour_AutomaticFormsToolsPanel * _autoFormsPanel;
372 //wxContour_StandardToolsPanel *_standardToolsPanel;
374 //wxContour_EdtionToolsPanel * _editionToolsPanel;
376 //wxContour_ListViewPanel * _listViewPanel;
378 //wxVtkBaseView_SceneManager * _sceneManager;
380 //Instant * _actualInstant;
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 );
391 //manualContourModel * factoryManualContourModel(int typeContour);
393 manualContourModel * factoryManualContourModel(wxPanel* panel);
398 void loadState(std::string filename);
399 void loadContours( FILE *pFile, bool staticContour );
401 void saveFileWithContours( std::string filename );
405 std::string stundoredo;