]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfSegmentationMenu.cxx
8ec2fa73f27784b86d1e244ca4a9994f3de1383b
[creaContours.git] / lib / Interface_Icons_NDimensions / interfSegmentationMenu.cxx
1 #include "interfSegmentationMenu.h"
2 #include "interfMainPanel.h"
3
4 interfSegmentationMenu::interfSegmentationMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
5         : interfMenuBar(parent, sizex, sizey)
6 {
7         this->datadir = datdir;
8         //contourevent = (wxContourEventHandler*)evtHandler;
9         infoWin = NULL;
10         configPanel = NULL;
11         spreadPanel = NULL;
12         segmentPanelITK = NULL;
13         
14         //eventHandler = evtHandler;
15
16         initButtons(this);
17 }
18
19 void interfSegmentationMenu::initButtons(wxEvtHandler* evtHandler) {
20
21         std::vector<std::string> path, nom;
22         std::vector<wxObjectEventFunction> funct;
23
24         path.push_back(datadir + "/Segmentation.png");
25         nom.push_back("Find shapes by automatic segmentation");
26         funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSegmentationPressed);
27
28         path.push_back(datadir + "/ITK.png");
29         nom.push_back("Find shapes by automatic segmentation with ITK");
30         funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSegmentationPressedITK);
31
32         path.push_back(datadir + "/snake.png");
33         nom.push_back("Find shapes using border snake interaction");
34         funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSnakePressed);
35
36         path.push_back(datadir + "/Mirror.png");
37         nom.push_back("Create an Axis and select a contour to mirror it accordingly");
38         funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onMirrorPressed);
39
40         path.push_back(datadir + "/Threshold.png");
41         nom.push_back("Superpose a 'Red Image' to the selected Image Threshold");
42         funct.push_back((wxObjectEventFunction)&interfSegmentationMenu::onThreshold);
43
44         this->addButtons(path, nom);    
45         this->setVectorFunction(funct);
46
47         this->connectEvents(evtHandler);
48            
49
50 }
51
52 interfSegmentationMenu::~interfSegmentationMenu()
53 {
54 }
55
56 /**
57         **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
58         **      of the button corresponding to the method that has to be executed,
59         **      it uses attribute eventHandler to call the methods define by the application.
60         **      see setEventHandler(wxEventHandler*)
61         **/
62
63
64 void  interfSegmentationMenu::onSegmentationPressed(wxCommandEvent& event){
65
66         interfMainPanel::getInstance()->onSegmentationPressed();
67 }
68
69
70
71 void  interfSegmentationMenu::onSegmentationPressedITK(wxCommandEvent& event){
72
73         interfMainPanel::getInstance()->onSegmentationPressedITK();
74
75     
76 }
77
78 void  interfSegmentationMenu::onSnakePressed(wxCommandEvent& event){
79     
80         interfMainPanel::getInstance()->onSnakePressed();
81
82 }
83
84 void interfSegmentationMenu::onMirrorPressed(wxCommandEvent& event){
85
86   interfMainPanel::getInstance()->onMirrorPressed();
87
88 }
89
90 void interfSegmentationMenu::onThreshold(wxCommandEvent& event){
91         
92         interfMainPanel::getInstance()->onThresholdPressed();
93
94 }
95
96 //------------------------------------------------------------------------------------------------------------
97