]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h
edee925a4775be64502286deaaedd46a9dd5861b
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualContourModel.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
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
8 #
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.
15 #
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
20 #  liability.
21 #
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 # ------------------------------------------------------------------------ */
25
26 #ifndef manualContourModel_h
27 #define manualContourModel_h
28
29 #include "vtkRenderWindow.h"
30
31 #include "vtkRenderer.h"
32 #include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove !
33 #include "vtkCommand.h"
34 #include "vtkPolyData.h"
35 #include "vtkCellArray.h"
36 #include "vtkPolyDataMapper.h"
37 #include "vtkInteractorObserver.h"
38 #include "vtkInteractorStyleImage.h"
39 #include <vtkKochanekSpline.h> 
40
41 #include <vtkCellPicker.h> 
42
43
44 #include <vtkCamera.h> 
45 #include <vtkPolyLine.h>
46 #include <vtkDataSetMapper.h>
47 #include <vtkUnstructuredGrid.h>
48
49 #include "wxVTKRenderWindowInteractor.h"
50
51
52 //--
53
54 #include <vector>
55 #include "wxVtkBaseView.h"
56 #include "marTypes.h"
57 #include "manualPoint.h"
58 #include "manualBaseModel.h"
59
60
61 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
63 // ----------------------------------------------------------------------------
64
65
66 class creaMaracasVisu_EXPORT manualContourModel : public manualBaseModel
67 {
68 public:
69         manualContourModel();
70         virtual ~manualContourModel();
71
72         virtual manualContourModel * Clone();
73         void CopyAttributesTo( manualContourModel *cloneObject );
74         void Open(FILE *ff);    // virtual
75         virtual void Save(FILE *ff);    // virtual
76         virtual int GetTypeModel();                     // virtual 
77
78         virtual int                             AddPoint(double x,double y,double z);
79         virtual int                             InsertPoint(double x,double y,double z);
80 //JSTG 25-04-08 -------------------------------------------------------
81         virtual void                    InsertPoint_id(int id, double x,double y,double z);
82 //---------------------------------------------------------------------
83         virtual void                    AddManualPoint( manualPoint* theManualPoint );
84         virtual void                    Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By);
85
86         virtual void                    DeletePoint(int i);
87         virtual void                    DeleteAllPoints();
88
89         virtual void                    MovePoint(int i,double dx,double dy,double dz);
90         virtual void                    MoveLstPoints(double dx,double dy,double dz);
91         virtual void                    MoveAllPoints(double dx,double dy,double dz);
92
93         virtual int                             GetIdPoint(double x, double y, double z, int i_range,int type);
94         virtual manualPoint*    GetManualPoint(int id);
95         virtual int                             GetSizeLstPoints();
96         int                             GetNumberOfPointsSpline();
97         virtual void                    SetNumberOfPointsSpline(int size);
98
99         virtual void    UpdateSpline();
100         void                    SetCloseContour(bool closeContour);
101         bool                    IfCloseContour();
102 //JSTG 25-02-08 -----------------------------------------------------------------
103         //void                  GetSplinePoint(double t, double &x, double &y, double &z);      //Method Original
104         //void                  GetSplineiPoint(int i, double &x, double &y, double &z);        //Method Original
105 //-------------------------------------------------------------------------------
106         virtual double                  GetPathSize();
107         virtual double                  GetPathArea();
108
109         void                    GetNearestPointAndNormal(double *p, double *rp,  double *rn);
110         
111 // JSTG 25-02-08 -----------------------------------------------------------------
112         virtual void    GetSpline_i_Point(int i, double *x, double *y, double *z);
113         void                    GetSpline_t_Point(double t, double *x, double *y, double *z);
114 //--------------------------------------------------------------------------------
115
116         virtual std::vector<manualBaseModel*> ExploseModel(  );
117
118 // CMRU 17-08-09 -----------------------------------------------------------------
119         
120         /*
121         * Assigns the parameter value to the label
122         * @param newLabel New label of the contour
123         */
124         void SetLabel(std::string newLabel);
125         
126         /*
127         * Assigns the parameter value to the real size
128         * @param newRealSize New real size in milimeters of the contour
129         */
130         void SetRealSize(double newRealSize);
131         
132         /**
133         * Returns the label of the contour
134         */
135         std::string GetLabel();
136
137         /**
138         * Returns the real size in milimeters of the contour
139         */
140         double GetRealSize();
141         
142         /*
143         * Saves the label and the real size of the contour
144         * @param ff File where the information is stored 
145         */
146         void SaveData(FILE *ff);
147
148         /*
149         * Reads and interprets the information of the label and the real size
150         * @param ff File where the information is readed 
151         */
152         void OpenData(FILE *ff);
153 //--------------------------------------------------------------------------------
154
155 //public:
156         //int                                                   _sizePointsContour;
157         //std::vector<manualPoint*>     _lstPoints;
158         bool                                            _closeContour;
159     vtkKochanekSpline                   *_cntSplineX;
160     vtkKochanekSpline                   *_cntSplineY;
161     vtkKochanekSpline                   *_cntSplineZ;
162
163 //JSTG 25-02-08 ----------------------------------------
164         double                  _delta_JSTG;
165 //------------------------------------------------------
166
167 //CMRU 17-08-09 -----------------------------------------------------------------
168         /**
169         * Represents the real size in milimeters of the contour
170         */
171         double                  _realSize;
172
173         /**
174         * Represents the label associated with the contour
175         */
176         std::string             _label;
177 //--------------------------------------------------------------------------------
178
179 }; 
180
181
182 #endif // manualContourModel_h