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