2 #ifndef __CutModelPolygonH__
3 #define __CutModelPolygonH__
5 #include "vtkImageData.h"
7 #include "vtkTransform.h"
8 #include "manualBaseModel.h"
9 #include "manualContourModelPolygon.h"
10 #include "ContourExtractData.h"
13 class CutModelPolygon{
19 // Principal method wich process the input imageData
20 void processOutImage(int cutInsideOutside);
22 //Initialize the characteristics of the output ImageData with dimensions
23 //and type of the input one.
24 void initializeOutputImage();
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);
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);
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);
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);
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);
60 //////////////////////
61 // Getters and setters
62 //////////////////////
64 vtkImageData* getInImage();
65 vtkImageData* getOutImage();
66 vtkPoints* getPoints();
67 double* getDirection();
69 void setInImage(vtkImageData* pImage);
70 void setOutImage(vtkImageData* pImage);
71 void setPoints(vtkPoints *pPoints);
72 void setDirection(double *pDirection);
76 vtkImageData *_inImage;
79 //vtkImageData *_outImage;
88 vtkTransform *_transform;
90 //If cuts inside:0, else 1
91 int _cutInsideOutside;