]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuContourToControlPoints.h
48553fa7e4fb31bc1d07ff782d10292450f064e0
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuContourToControlPoints.h
1 #ifndef __bbmaracasvisuContourToControlPoints_h_INCLUDED__
2 #define __bbmaracasvisuContourToControlPoints_h_INCLUDED__
3 #include "bbtkAtomicBlackBox.h"
4 #include "iostream"
5
6 #include "Contour/ExtractControlPoints2D.h"
7 #include "Contour/ContourPropagation.h"
8 #include "Contour/Propagation.h"
9
10 #include "vtkImageData.h"
11
12 namespace bbmaracasvisu
13 {
14
15 class /*BBTK_EXPORT*/ ContourToControlPoints
16  : 
17    public bbtk::AtomicBlackBox
18 {
19         //BBTK_USER_BLACK_BOX_INTERFACE(ContourToControlPoints,bbtk::AtomicBlackBox);
20         BBTK_BLACK_BOX_INTERFACE(ContourToControlPoints,bbtk::AtomicBlackBox);
21
22 //==================================================================
23 /// User callback called in the box contructor
24 virtual void bbUserConstructor();
25 /// User callback called in the box copy constructor
26 virtual void bbUserCopyConstructor();
27 /// User callback called in the box destructor
28 virtual void bbUserDestructor();
29 //==================================================================
30   BBTK_DECLARE_INPUT(In,double);
31                 BBTK_DECLARE_INPUT(Sampling, double);
32                 BBTK_DECLARE_INPUT(Slice,int);
33                 BBTK_DECLARE_INPUT(InContourX, std::vector<double>*);
34                 BBTK_DECLARE_INPUT(InContourY, std::vector<double>*);
35                 BBTK_DECLARE_INPUT(InContourZ, std::vector<double>*);
36                 BBTK_DECLARE_INPUT(RadRBF, double);
37                 BBTK_DECLARE_INPUT(Option, int);
38                 BBTK_DECLARE_INPUT(LoadContour, int);
39   BBTK_DECLARE_OUTPUT(Out,double);
40                 BBTK_DECLARE_OUTPUT(ControlPointX, std::vector<double>*);
41                 BBTK_DECLARE_OUTPUT(ControlPointY, std::vector<double>*);
42                 BBTK_DECLARE_OUTPUT(ControlPointZ, std::vector<double>*);
43                 BBTK_DECLARE_OUTPUT(ImagePropg, vtkImageData*);
44
45   BBTK_PROCESS(Process);
46   void Process();
47   private:
48                         int pos;
49                         bool inic;
50                         
51                         ContourPropagation              *_contprop;
52                         PropContour                             *_propgdata;
53                         ExtractControlPoints2D  *_ext2D;
54
55                         vtkImageData                    *_imagedata;
56                         FILE                                    *_fd;
57                         
58                         std::vector<double> OutContourX;
59                         std::vector<double> OutContourY;
60                         std::vector<double> OutContourZ;
61
62                         std::vector<double> KeyContourX;
63                         std::vector<double> KeyContourY;
64                         std::vector<double> KeyContourZ;
65                         std::vector<int> KeySizes;
66                         
67                         //TEMP DATA
68                         std::vector<double> tempX;
69                         std::vector<double> tempY;
70                         std::vector<double> tempZ;
71                         std::vector<int>::iterator it;
72   
73 };
74
75 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ContourToControlPoints,bbtk::AtomicBlackBox);
76 BBTK_NAME("ContourToControlPoints");
77 BBTK_AUTHOR("Juan Sebasltian Torres");
78 BBTK_DESCRIPTION("Generates the control points of a contour");
79 BBTK_CATEGORY("filter");
80    BBTK_INPUT(ContourToControlPoints,Sampling,"Sampling (in %) to obtain the control points",double,"");
81    BBTK_INPUT(ContourToControlPoints,Slice,"Slice Number Propagation",int,"");
82    BBTK_INPUT(ContourToControlPoints,InContourX,"Coordinate X of a Contour",std::vector<double>*,"");
83    BBTK_INPUT(ContourToControlPoints,InContourY,"Coordinate Y of a Contour",std::vector<double>*,"");
84    BBTK_INPUT(ContourToControlPoints,InContourZ,"Coordinate Z of a Contour",std::vector<double>*,"");
85    BBTK_INPUT(ContourToControlPoints,RadRBF,"Radius of th RBF method",double,"");
86    BBTK_INPUT(ContourToControlPoints,Option,"1 -> Control Points || 2 -> Propagation",int,"");
87    BBTK_INPUT(ContourToControlPoints,LoadContour,"1 -> Load Saved Manual Points",int,"");
88 //THE OUTPUTS
89    BBTK_OUTPUT(ContourToControlPoints,ControlPointX,"Processed Coordinate X of the Boundary",std::vector<double>*,"");
90    BBTK_OUTPUT(ContourToControlPoints,ControlPointY,"Processed Coordinate Y of the Boundary",std::vector<double>*,"");
91    BBTK_OUTPUT(ContourToControlPoints,ControlPointZ,"Processed Coordinate Z of the Boundary",std::vector<double>*,"");
92    BBTK_OUTPUT(ContourToControlPoints,ImagePropg,"vtkImageData of the propagation image-3D",vtkImageData*,"");
93 BBTK_END_DESCRIBE_BLACK_BOX(ContourToControlPoints);
94 }
95 // EO namespace bbmaracasvisu
96
97 #endif // __bbmaracasvisuContourToControlPoints_h_INCLUDED__
98