1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #ifdef _USE_WXWIDGETS_
27 #ifndef __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
28 #define __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
29 #include "bbtkWxBlackBox.h"
33 #include "vtkSphereSource.h"
34 #include "vtkImageData.h"
35 #include "vtkRenderer.h"
36 #include "vtkTextActor3D.h"
38 namespace bbcreaMaracasVisu
43 //--------------------------------------------------------------------------
44 class WidgetShowNPoints : public wxPanel
47 WidgetShowNPoints( wxWindow *parent, ShowNPoints *box);
49 void OnAddPoint(wxCommandEvent &event);
50 void OnSetPoint(wxCommandEvent& event);
51 void OnRenamePoint(wxCommandEvent& event);
52 void OnErasePoint(wxCommandEvent& event);
53 void OnEraseLastPoint(wxCommandEvent &event);
54 void OnDeleteAllPoints(wxCommandEvent &event);
55 void OnSavePoints(wxCommandEvent &event);
56 void OnLoadPoints(wxCommandEvent &event);
57 void UpdatePoints(wxCommandEvent &event);
59 void RefreshPoint(int id);
61 void SetPoint(std::vector<int> ppoint);
62 void SetColour(std::vector<double> colour);
63 void SetOpacity(double opacity);
64 void SetRadio(double radio);
65 void SetImage(vtkImageData *image);
66 void SetRenderer(vtkRenderer *renderer);
67 std::vector<int> GetLstPointsX();
68 std::vector<int> GetLstPointsY();
69 std::vector<int> GetLstPointsZ();
70 std::vector<std::string> GetLstLabels();
72 void AddPoint(int x, int y, int z, std::string label);
77 std::string CleanSpaces(std::string ss);
78 int GetNearestPoint();
80 void ErasePoint(int id);
83 ShowNPoints *mbbShowNPoints;
84 vtkRenderer *renderer;
85 std::vector<int> lstPointsX;
86 std::vector<int> lstPointsY;
87 std::vector<int> lstPointsZ;
88 std::vector<std::string> lstLabels;
89 std::vector<vtkActor*> lstActorsSphere;//NTU changed from prop3D to Actor
90 std::vector<vtkTextActor3D*> lstActorsText;
92 //NTU: For updating points
94 std::vector<vtkSphereSource*> lstSourceSphere;
96 std::vector<int> mpoint;
98 std::vector<double> mcolour;
101 wxStaticText *askPointLabel;
102 wxTextCtrl *textCtrl;
103 wxStaticText *txtNrPoints;
104 wxSlider *sdrOpacity;
109 class /*BBTK_EXPORT*/ ShowNPoints
111 public bbtk::WxBlackBox
113 BBTK_BLACK_BOX_INTERFACE(ShowNPoints,bbtk::WxBlackBox);
114 BBTK_DECLARE_INPUT(In, std::vector<int> );
115 BBTK_DECLARE_INPUT(Renderer, vtkRenderer* );
116 BBTK_DECLARE_INPUT(Image, vtkImageData* );
117 BBTK_DECLARE_INPUT(Colour, std::vector<double> );
118 BBTK_DECLARE_INPUT(Opacity, double );
119 BBTK_DECLARE_INPUT(Radio, double );
120 BBTK_DECLARE_INPUT(Type, int );
121 BBTK_DECLARE_OUTPUT( lstPointsX, std::vector<int> );
122 BBTK_DECLARE_OUTPUT( lstPointsY, std::vector<int> );
123 BBTK_DECLARE_OUTPUT( lstPointsZ, std::vector<int> );
124 BBTK_DECLARE_OUTPUT( lstLabels, std::vector<std::string> );
125 BBTK_PROCESS(Process);
127 BBTK_CREATE_WIDGET(CreateWidget);
128 void CreateWidget(wxWindow*);
131 WidgetShowNPoints *mwxwidget;
134 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
135 BBTK_NAME("ShowNPoints");
136 BBTK_AUTHOR("Eduardo DAVILA");
137 BBTK_DESCRIPTION("widget that shows N moints in 3D (vtkActors)");
138 BBTK_CATEGORY("widgetVtk");
139 BBTK_INPUT(ShowNPoints,In,"One Point",std::vector<int>,"");
140 BBTK_INPUT(ShowNPoints,Renderer,"Renderer",vtkRenderer*,"");
141 BBTK_INPUT(ShowNPoints,Image,"vktkImageData",vtkImageData*,"");
142 BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector<double>,"colour");
143 BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor 0..1 (default 1)",double,"");
144 BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres 1..50 (default 10)",double,"");
145 BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point",int,"");
146 BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
147 BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
148 BBTK_OUTPUT(ShowNPoints , lstPointsZ , " list of points Z ", std::vector<int> ,"");
149 BBTK_OUTPUT(ShowNPoints , lstLabels , " list of labels ", std::vector<std::string> ,"");
150 BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints);
152 // EO namespace bbcreaMaracasVisu
154 #endif // __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
155 #endif // _USE_WXWIDGETS_