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 OnInsertPoint (wxCommandEvent& event);//CFT
51 void OnSetPoint(wxCommandEvent& event);
52 void OnRenamePoint(wxCommandEvent& event);
53 void OnErasePoint(wxCommandEvent& event);
54 void OnEraseLastPoint(wxCommandEvent &event);
55 void OnDeleteAllPoints(wxCommandEvent &event);
56 void OnSavePoints(wxCommandEvent &event);
57 void OnLoadPoints(wxCommandEvent &event);
58 void UpdatePoints(wxCommandEvent &event);
60 void RefreshPoint(int id);
62 void SetPoint(std::vector<int> ppoint);
63 void SetColour(std::vector<double> colour);
64 void SetOpacity(double opacity);
65 void SetRadio(double radio);
66 void SetImage(vtkImageData *image);
67 void SetRenderer(vtkRenderer *renderer);
68 std::vector<int> GetLstPointsX();
69 std::vector<int> GetLstPointsY();
70 std::vector<int> GetLstPointsZ();
71 std::vector<std::string> GetLstLabels();
73 void AddPoint(int x, int y, int z, std::string label);
74 void InsertPoint(int x, int y, int z, std::string label);//CFT
75 double Distance(double dX0, double dY0, double dZ0, double dX1, double dY1, double dZ1);//CFT
79 std::string CleanSpaces(std::string ss);
80 int GetNearestPoint();
82 void ErasePoint(int id);
85 ShowNPoints *mbbShowNPoints;
86 vtkRenderer *renderer;
87 std::vector<int> lstPointsX;
88 std::vector<int> lstPointsY;
89 std::vector<int> lstPointsZ;
90 std::vector<std::string> lstLabels;
91 std::vector<vtkActor*> lstActorsSphere;//NTU changed from prop3D to Actor
92 std::vector<vtkTextActor3D*> lstActorsText;
94 //NTU: For updating points
96 std::vector<vtkSphereSource*> lstSourceSphere;
98 std::vector<int> mpoint;
100 std::vector<double> mcolour;
103 wxStaticText *askPointLabel;
104 wxTextCtrl *textCtrl;
105 wxStaticText *txtNrPoints;
106 wxSlider *sdrOpacity;
111 class /*BBTK_EXPORT*/ ShowNPoints
113 public bbtk::WxBlackBox
115 BBTK_BLACK_BOX_INTERFACE(ShowNPoints,bbtk::WxBlackBox);
116 BBTK_DECLARE_INPUT(In, std::vector<int> );
117 BBTK_DECLARE_INPUT(Renderer, vtkRenderer* );
118 BBTK_DECLARE_INPUT(Image, vtkImageData* );
119 BBTK_DECLARE_INPUT(Colour, std::vector<double> );
120 BBTK_DECLARE_INPUT(Opacity, double );
121 BBTK_DECLARE_INPUT(Radio, double );
122 BBTK_DECLARE_INPUT(Type, int );
123 BBTK_DECLARE_OUTPUT( lstPointsX, std::vector<int> );
124 BBTK_DECLARE_OUTPUT( lstPointsY, std::vector<int> );
125 BBTK_DECLARE_OUTPUT( lstPointsZ, std::vector<int> );
126 BBTK_DECLARE_OUTPUT( lstLabels, std::vector<std::string> );
127 BBTK_PROCESS(Process);
129 BBTK_CREATE_WIDGET(CreateWidget);
130 void CreateWidget(wxWindow*);
133 WidgetShowNPoints *mwxwidget;
136 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
137 BBTK_NAME("ShowNPoints");
138 BBTK_AUTHOR("Eduardo DAVILA");
139 BBTK_DESCRIPTION("widget that shows N moints in 3D (vtkActors)");
140 BBTK_CATEGORY("widgetVtk");
141 BBTK_INPUT(ShowNPoints,In,"One Point",std::vector<int>,"");
142 BBTK_INPUT(ShowNPoints,Renderer,"Renderer",vtkRenderer*,"");
143 BBTK_INPUT(ShowNPoints,Image,"vktkImageData",vtkImageData*,"");
144 BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector<double>,"colour");
145 BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor 0..1 (default 1)",double,"");
146 BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres 1..50 (default 10)",double,"");
147 BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point",int,"");
148 BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
149 BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
150 BBTK_OUTPUT(ShowNPoints , lstPointsZ , " list of points Z ", std::vector<int> ,"");
151 BBTK_OUTPUT(ShowNPoints , lstLabels , " list of labels ", std::vector<std::string> ,"");
152 BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints);
154 // EO namespace bbcreaMaracasVisu
156 #endif // __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
157 #endif // _USE_WXWIDGETS_