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 __CutModelPolygonH__
27 #define __CutModelPolygonH__
29 #include "vtkImageData.h"
30 #include "vtkPoints.h"
31 #include "vtkTransform.h"
32 #include "manualBaseModel.h"
33 #include "manualContourModelPolygon.h"
34 #include "ContourExtractData.h"
37 class CutModelPolygon{
43 // Principal method wich process the input imageData
44 void processOutImage(int cutInsideOutside);
46 //Initialize the characteristics of the output ImageData with dimensions
47 //and type of the input one.
48 void initializeOutputImage();
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);
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);
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);
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);
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);
84 //////////////////////
85 // Getters and setters
86 //////////////////////
88 vtkImageData* getInImage();
89 vtkImageData* getOutImage();
90 vtkPoints* getPoints();
91 double* getDirection();
93 void setInImage(vtkImageData* pImage);
94 void setOutImage(vtkImageData* pImage);
95 void setPoints(vtkPoints *pPoints);
96 void setDirection(double *pDirection);
100 vtkImageData *_inImage;
103 //vtkImageData *_outImage;
112 vtkTransform *_transform;
114 //If cuts inside:0, else 1
115 int _cutInsideOutside;