]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h
#3323 creaMaracasVisu Feature New Normal - label2 for manal contours
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualBaseModel.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 manualBaseModel_h
27 #define manualBaseModel_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 <vtkCellPicker.h> 
40 #include <vtkCamera.h> 
41 #include <vtkPolyLine.h>
42 #include <vtkDataSetMapper.h>
43 #include <vtkUnstructuredGrid.h>
44
45 #include "creawxVTKRenderWindowInteractor.h"
46
47 #include <vector>
48 #include "wxVtkBaseView.h"
49 #include "marTypes.h"
50 #include "manualPoint.h"
51
52 // --------------------------------------------------------------------------------------------
53 // Includes the functionality to manage a contour without the spline line usage
54 // @author RaC 09-09
55 class creaMaracasVisu_EXPORT manualBaseModel
56 {
57 public:
58         manualBaseModel();
59         virtual ~manualBaseModel();
60
61         virtual manualBaseModel * Clone();
62         void CopyAttributesTo( manualBaseModel *cloneObject );
63         virtual void Open(FILE *ff);    // virtual
64         virtual void Save(FILE *ff);    // virtual
65         virtual int GetTypeModel();                     // virtual 
66         
67         virtual void                    SetNumberOfPointsSpline(int size);
68
69         virtual int                             AddPoint(double x,double y,double z);
70         virtual int                             InsertPoint(double x,double y,double z);
71         virtual void                    InsertPoint_id(int id, double x,double y,double z);
72         virtual void                    AddManualPoint( manualPoint* theManualPoint );
73         virtual void                    DeletePoint(int i);
74         virtual void                    DeleteAllPoints();
75
76         virtual void                    MovePoint(int i,double dx,double dy,double dz);
77         virtual void                    MoveLstPoints(double dx,double dy,double dz);
78         virtual void                    MoveAllPoints(double dx,double dy,double dz);
79
80         // Returns the id of the point in the coordinates and the i_range given, according to the type
81         // which corresponds to the plane where it's necessary to find the point.
82         // @param type=-1  x,y,z - type=0 y,z - type=1  x,z - type=2    x,y
83         // @return int - Returns the id of the point in the coordinates given. Returns -1 otherwise.
84         virtual int                             GetIdPoint(double x, double y, double z, int i_range,int type);
85         virtual manualPoint*    GetManualPoint(int id);
86         virtual int                             GetSizeLstPoints();
87         virtual double                  GetPathSize(double *spc);
88         virtual void                    Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By);
89         virtual void                    GetSpline_i_Point(int i, double *x, double *y, double *z);
90         virtual void                    GetSpline_t_Point(double t, double *x, double *y, double *z);
91
92         //
93         // Returns the number of points of the spline line, but not the contour control points
94         // @return int - spline points size
95         //
96         virtual int                             GetNumberOfPointsSpline();
97         virtual void                    UpdateSpline();
98
99         //
100         // Returns a list with the actual model
101         // @return std::vector<manualBaseModel*>
102         //
103         virtual std::vector<manualBaseModel*> ExploseModel(  );
104         virtual double                  GetPathArea(double *spc);
105         virtual void                    GetNearestPointAndNormal(double *p, double *rp,  double *rn);
106
107         virtual void                    SetCloseContour(bool closeContour);
108         virtual bool                    IfCloseContour();
109
110         // RaC 27-09-09 ----
111
112         //
113         // Returns true if the point with the coordinates in parameters is one of the points in
114         // the list of points of the model,
115         // @param x double
116         // @param y double
117         // @return true if the point with the coordinates in parameters is one of the points, false otherwise
118         //
119         int     IsPoint(double x, double y);
120
121         // CMRU 17-08-09 -----------------------------------------------------------------
122         
123         /*
124         * Assigns the parameter value to the label
125         * @param newLabel New label of the contour
126         */
127         void SetLabel(std::string newLabel);
128         std::string GetLabel();
129         void SetLabel2(std::string newLabel);
130         std::string GetLabel2();
131         
132         /*
133         * Assigns the parameter value to the real size
134         * @param newRealSize New real size in milimeters of the contour
135         */
136         virtual void SetRealSize(double newRealSize);
137         
138
139         /**
140         * Returns the real size in milimeters of the contour
141         */
142         virtual double GetRealSize();
143         
144         /*
145         * Saves the label and the real size of the contour
146         * @param ff File where the information is stored 
147         */
148         virtual void SaveData(FILE *ff);
149  
150         /*
151         * Reads and interprets the information of the label and the real size
152         * @param ff File where the information is readed 
153         */
154         virtual void OpenData(FILE *ff);
155
156 protected:
157         int                                                     _sizePointsContour;
158         std::vector<manualPoint*>       _lstPoints;
159
160         /**
161         * Represents the label associated with the contour
162         */
163         std::string                                     _label;
164         std::string                                     _label2;
165
166 }; 
167
168
169 #endif // manualBaseModel_h