]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h
#2976 creaMaracasVisu Feature New Normal - ManualContourModel_Box
[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 "wxVTKRenderWindowInteractor.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();
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();
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         virtual void SetLabel(std::string newLabel);
128         
129         /*
130         * Assigns the parameter value to the real size
131         * @param newRealSize New real size in milimeters of the contour
132         */
133         virtual void SetRealSize(double newRealSize);
134         
135         /**
136         * Returns the label of the contour
137         */
138         virtual std::string GetLabel();
139
140         /**
141         * Returns the real size in milimeters of the contour
142         */
143         virtual double GetRealSize();
144         
145         /*
146         * Saves the label and the real size of the contour
147         * @param ff File where the information is stored 
148         */
149         virtual void SaveData(FILE *ff);
150  
151         /*
152         * Reads and interprets the information of the label and the real size
153         * @param ff File where the information is readed 
154         */
155         virtual void OpenData(FILE *ff);
156
157 protected:
158         int                                                     _sizePointsContour;
159         std::vector<manualPoint*>       _lstPoints;
160
161 }; 
162
163
164 #endif // manualBaseModel_h