00001 00002 #ifndef __CutModelPolygonH__ 00003 #define __CutModelPolygonH__ 00004 00005 #include "vtkImageData.h" 00006 #include "vtkPoints.h" 00007 #include "vtkTransform.h" 00008 #include "manualBaseModel.h" 00009 #include "manualContourModelPolygon.h" 00010 #include "ContourExtractData.h" 00011 #include <vector> 00012 00013 class CutModelPolygon{ 00014 public: 00015 //Constructor method 00016 CutModelPolygon(); 00017 ~CutModelPolygon(); 00018 00019 // Principal method wich process the input imageData 00020 void processOutImage(int cutInsideOutside); 00021 00022 //Initialize the characteristics of the output ImageData with dimensions 00023 //and type of the input one. 00024 void initializeOutputImage(); 00025 00026 //Calculate three orthogonal and normalized vectors which are saved in parameters 00027 //v1 and v2. v1 is the resultant vector between point 0 and point 1 of the contour. 00028 //v2 is an orthogonal vector to v1 and the direction vector. 00029 //@param double v1 - Vector 1 00030 //@param double v2 - Vector 2, perpendicular to v1 and direction vector 00031 void calculateOrthogonalVectors(double* v1, double* v2); 00032 00033 //Constructs the matrix transformation with the vectors given. 00034 //@param double v1 - Vector 1 00035 //@param double v2 - Vector 2 00036 //@param double v3 - Vector 3 00037 void updateTransform(double* v1, double* v2, double* v3); 00038 00039 //Transforms all contour points with the transformation created with the correspondent vectors. 00040 //The transformed points are saved in the vectors given by parameter. 00041 //@param std::vector<double> *vectorOutX 00042 //@param std::vector<double> *vectorOutY 00043 //@param std::vector<double> *vectorOutZ 00044 void transformContourPoints(std::vector<double> *vectorOutX,std::vector<double> *vectorOutY,std::vector<double> *vectorOutZ); 00045 00046 //Creates a Polygonal contour and put all the points which are included into it in the "direction vector" direction in value zero, 00047 //and all the rest remains as they are in the original input image. It is the final step of the process. 00048 //This algorithm creates a hole in the whole image. 00049 //@param std::vector<double> *vectorOutX - X-coordinate of all contour points 00050 //@param std::vector<double> *vectorOutY - Y-coordinate of all contour points 00051 //@param std::vector<double> *vectorOutZ - Z-coordinate of all contour points 00052 void cutInputImage(std::vector<double> vectorOutX,std::vector<double> vectorOutY,std::vector<double> vectorOutZ); 00053 00054 //Creates a Polygonal contour with the points given by parameter. This parameter exists in creaMaracasVisu 00055 //@param std::vector<double> *pointsX - X-coordinate of all contour points 00056 //@param std::vector<double> *pointsY - Y-coordinate of all contour points 00057 //@param std::vector<double> *pointsZ - Z-coordinate of all contour points 00058 manualBaseModel* InitializeContourModel(std::vector<double> pointsX, std::vector<double> pointsY, std::vector<double> pointsZ); 00059 00061 // Getters and setters 00063 00064 vtkImageData* getInImage(); 00065 vtkImageData* getOutImage(); 00066 vtkPoints* getPoints(); 00067 double* getDirection(); 00068 00069 void setInImage(vtkImageData* pImage); 00070 void setOutImage(vtkImageData* pImage); 00071 void setPoints(vtkPoints *pPoints); 00072 void setDirection(double *pDirection); 00073 00074 private: 00075 //Input image 00076 vtkImageData *_inImage; 00077 00078 //Output image 00079 //vtkImageData *_outImage; 00080 00081 //Contour points 00082 vtkPoints *_points; 00083 00084 //Direction vector 00085 double *_direction; 00086 00087 //Transform 00088 vtkTransform *_transform; 00089 00090 //If cuts inside:0, else 1 00091 int _cutInsideOutside; 00092 }; 00093 00094 #endif