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 #ifndef manualBaseModel_h
27 #define manualBaseModel_h
29 #include "vtkRenderWindow.h"
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>
45 #include "creawxVTKRenderWindowInteractor.h"
48 #include "wxVtkBaseView.h"
50 #include "manualPoint.h"
52 // --------------------------------------------------------------------------------------------
53 // Includes the functionality to manage a contour without the spline line usage
55 class creaMaracasVisu_EXPORT manualBaseModel
59 virtual ~manualBaseModel();
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
67 virtual void SetNumberOfPointsSpline(int size);
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();
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);
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);
93 // Returns the number of points of the spline line, but not the contour control points
94 // @return int - spline points size
96 virtual int GetNumberOfPointsSpline();
97 virtual void UpdateSpline();
100 // Returns a list with the actual model
101 // @return std::vector<manualBaseModel*>
103 virtual std::vector<manualBaseModel*> ExploseModel( );
104 virtual double GetPathArea(double *spc);
105 virtual void GetNearestPointAndNormal(double *p, double *rp, double *rn);
107 virtual void SetCloseContour(bool closeContour);
108 virtual bool IfCloseContour();
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,
117 // @return true if the point with the coordinates in parameters is one of the points, false otherwise
119 int IsPoint(double x, double y);
121 // CMRU 17-08-09 -----------------------------------------------------------------
124 * Assigns the parameter value to the label
125 * @param newLabel New label of the contour
127 virtual void SetLabel(std::string newLabel);
130 * Assigns the parameter value to the real size
131 * @param newRealSize New real size in milimeters of the contour
133 virtual void SetRealSize(double newRealSize);
136 * Returns the label of the contour
138 virtual std::string GetLabel();
141 * Returns the real size in milimeters of the contour
143 virtual double GetRealSize();
146 * Saves the label and the real size of the contour
147 * @param ff File where the information is stored
149 virtual void SaveData(FILE *ff);
152 * Reads and interprets the information of the label and the real size
153 * @param ff File where the information is readed
155 virtual void OpenData(FILE *ff);
158 int _sizePointsContour;
159 std::vector<manualPoint*> _lstPoints;
164 #endif // manualBaseModel_h