]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h
#3323 creaMaracasVisu Feature New Normal - label2 for manal contours
[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 "creawxVTKRenderWindowInteractor.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(double *spc);
107         virtual double                  GetPathArea(double *spc);
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         /*
122         * Assigns the parameter value to the real size
123         * @param newRealSize New real size in milimeters of the contour
124         */
125         void SetRealSize(double newRealSize);
126         
127         /**
128         * Returns the real size in milimeters of the contour
129         */
130         double GetRealSize();
131         
132         /*
133         * Saves the label and the real size of the contour
134         * @param ff File where the information is stored 
135         */
136         void SaveData(FILE *ff);
137
138         /*
139         * Reads and interprets the information of the label and the real size
140         * @param ff File where the information is readed 
141         */
142         void OpenData(FILE *ff);
143 //--------------------------------------------------------------------------------
144
145 //public:
146         //int                                                   _sizePointsContour;
147         //std::vector<manualPoint*>     _lstPoints;
148         bool                                            _closeContour;
149     vtkKochanekSpline                   *_cntSplineX;
150     vtkKochanekSpline                   *_cntSplineY;
151     vtkKochanekSpline                   *_cntSplineZ;
152
153 //JSTG 25-02-08 ----------------------------------------
154         double                                          _delta_JSTG;
155 //------------------------------------------------------
156
157 //CMRU 17-08-09 -----------------------------------------------------------------
158         /**
159         * Represents the real size in milimeters of the contour
160         */
161         double                                          _realSize;
162
163 //--------------------------------------------------------------------------------
164
165 }; 
166
167
168 #endif // manualContourModel_h