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 manualContourModel_h
27 #define manualContourModel_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 <vtkKochanekSpline.h>
41 #include <vtkCellPicker.h>
44 #include <vtkCamera.h>
45 #include <vtkPolyLine.h>
46 #include <vtkDataSetMapper.h>
47 #include <vtkUnstructuredGrid.h>
49 #include "creawxVTKRenderWindowInteractor.h"
55 #include "wxVtkBaseView.h"
57 #include "manualPoint.h"
58 #include "manualBaseModel.h"
61 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
63 // ----------------------------------------------------------------------------
66 class creaMaracasVisu_EXPORT manualContourModel : public manualBaseModel
70 virtual ~manualContourModel();
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
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);
86 virtual void DeletePoint(int i);
87 virtual void DeleteAllPoints();
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);
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);
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);
109 void GetNearestPointAndNormal(double *p, double *rp, double *rn);
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 //--------------------------------------------------------------------------------
116 virtual std::vector<manualBaseModel*> ExploseModel( );
118 // CMRU 17-08-09 -----------------------------------------------------------------
121 * Assigns the parameter value to the label
122 * @param newLabel New label of the contour
124 void SetLabel(std::string newLabel);
127 * Assigns the parameter value to the real size
128 * @param newRealSize New real size in milimeters of the contour
130 void SetRealSize(double newRealSize);
133 * Returns the label of the contour
135 std::string GetLabel();
138 * Returns the real size in milimeters of the contour
140 double GetRealSize();
143 * Saves the label and the real size of the contour
144 * @param ff File where the information is stored
146 void SaveData(FILE *ff);
149 * Reads and interprets the information of the label and the real size
150 * @param ff File where the information is readed
152 void OpenData(FILE *ff);
153 //--------------------------------------------------------------------------------
156 //int _sizePointsContour;
157 //std::vector<manualPoint*> _lstPoints;
159 vtkKochanekSpline *_cntSplineX;
160 vtkKochanekSpline *_cntSplineY;
161 vtkKochanekSpline *_cntSplineZ;
163 //JSTG 25-02-08 ----------------------------------------
165 //------------------------------------------------------
167 //CMRU 17-08-09 -----------------------------------------------------------------
169 * Represents the real size in milimeters of the contour
174 * Represents the label associated with the contour
177 //--------------------------------------------------------------------------------
182 #endif // manualContourModel_h