]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/kernel/CutModelPolygon.h
fb44ea1bbd6d6c1de8e641bca2ede6b21c473654
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / kernel / CutModelPolygon.h
1
2 #ifndef __CutModelPolygonH__
3 #define __CutModelPolygonH__
4
5 #include "vtkImageData.h"
6 #include "vtkPoints.h"
7 #include "vtkTransform.h"
8 #include "manualBaseModel.h"
9 #include "manualContourModelPolygon.h"
10 #include "ContourExtractData.h"
11 #include <vector>
12
13 class CutModelPolygon{
14 public:
15         //Constructor method
16         CutModelPolygon();
17     ~CutModelPolygon();
18
19         // Principal method wich process the input imageData
20         void processOutImage(int cutInsideOutside);
21
22         //Initialize the characteristics of the output ImageData with dimensions 
23         //and type of the input one.
24         void initializeOutputImage();
25
26         //Calculate three orthogonal and normalized vectors which are saved in parameters
27         //v1 and v2. v1 is the resultant vector between point 0 and point 1 of the contour.
28         //v2 is an orthogonal vector to v1 and the direction vector.
29         //@param double v1 - Vector 1
30         //@param double v2 - Vector 2, perpendicular to v1 and direction vector
31         void calculateOrthogonalVectors(double* v1, double* v2);
32
33         //Constructs the matrix transformation with the vectors given.
34         //@param double v1 - Vector 1
35         //@param double v2 - Vector 2
36         //@param double v3 - Vector 3
37         void updateTransform(double* v1, double* v2, double* v3);
38
39         //Transforms all contour points with the transformation created with the correspondent vectors.
40         //The transformed points are saved in the vectors given by parameter.
41         //@param std::vector<double> *vectorOutX
42         //@param std::vector<double> *vectorOutY
43         //@param std::vector<double> *vectorOutZ
44         void transformContourPoints(std::vector<double> *vectorOutX,std::vector<double> *vectorOutY,std::vector<double> *vectorOutZ);
45
46         //Creates a Polygonal contour and put all the points which are included into it in the "direction vector" direction in value zero, 
47         //and all the rest remains as they are in the original input image. It is the final step of the process.
48         //This algorithm creates a hole in the whole image.
49         //@param std::vector<double> *vectorOutX - X-coordinate of all contour points
50         //@param std::vector<double> *vectorOutY - Y-coordinate of all contour points
51         //@param std::vector<double> *vectorOutZ - Z-coordinate of all contour points
52         void cutInputImage(std::vector<double> vectorOutX,std::vector<double> vectorOutY,std::vector<double> vectorOutZ);
53
54         //Creates a Polygonal contour with the points given by parameter. This parameter exists in creaMaracasVisu
55         //@param std::vector<double> *pointsX - X-coordinate of all contour points
56         //@param std::vector<double> *pointsY - Y-coordinate of all contour points
57         //@param std::vector<double> *pointsZ - Z-coordinate of all contour points
58         manualBaseModel* InitializeContourModel(std::vector<double> pointsX, std::vector<double> pointsY,  std::vector<double> pointsZ);
59
60         //////////////////////
61         // Getters and setters
62         //////////////////////
63
64         vtkImageData* getInImage();
65         vtkImageData* getOutImage();
66         vtkPoints* getPoints();
67         double* getDirection();
68
69         void setInImage(vtkImageData* pImage);
70         void setOutImage(vtkImageData* pImage);
71         void setPoints(vtkPoints *pPoints);
72         void setDirection(double *pDirection);
73         
74 private:
75         //Input image
76         vtkImageData *_inImage;
77
78         //Output image
79         //vtkImageData *_outImage;
80
81         //Contour points
82         vtkPoints *_points;
83
84         //Direction vector
85         double *_direction;
86         
87         //Transform
88         vtkTransform *_transform;
89
90         //If cuts inside:0, else 1
91         int _cutInsideOutside;
92 };
93
94 #endif