]> Creatis software - creaRigidRegistration.git/blob - PackRecalage/src/bbPackRecalageImageSubstraction.h
New items
[creaRigidRegistration.git] / PackRecalage / src / bbPackRecalageImageSubstraction.h
1 #ifndef __bbPackRecalageImageSubstraction_h_INCLUDED__
2 #define __bbPackRecalageImageSubstraction_h_INCLUDED__
3 #include "bbPackRecalage_EXPORT.h"
4 #include "bbtkAtomicBlackBox.h"
5 #include "iostream"
6 #include "vtkImageData.h"
7
8 #include <string>
9 #include <vector>
10
11
12 namespace bbPackRecalage
13 {
14
15         class MyImageSubstraction 
16 {
17
18         //----------------------------------------------------------------------------------------
19         // Methods definition
20         //----------------------------------------------------------------------------------------
21         public:
22         //--------------------------
23         //Constructor & Destructor
24         //--------------------------            
25                 MyImageSubstraction(vtkImageData* imageData1, vtkImageData* imageData2, int uZLevel,int lZLevel, std::vector<double> uColor, std::vector<double> lColor, std::vector<double> mColor);
26                 ~MyImageSubstraction();
27         //--------------------------
28         //Methods
29         //--------------------------
30                 /*
31                 getting ready the points
32                 */
33                 void initialize(int dimensions[],double spacing[]);
34                 /*
35                 Calculate the new image and save it in the attribute imageResult
36                 it is used if the user had given the imageData
37                 */
38                 void substractImage(vtkImageData* imageData1, vtkImageData* imageData2);
39                 
40                 /*
41                 Returns the ImageResult
42                 */
43                 vtkImageData* getSubstractedImage();
44                 
45                 /*
46                  Get Image Size
47                 */
48                 int getImageSize();
49                 
50                 /*
51                 constructing image substract
52                 */
53                 void substract(vtkImageData* imageData1, vtkImageData* imageData2);
54                 
55
56
57         //----------------------------------------------------------------------------------------
58         // Attributes declaration
59         //----------------------------------------------------------------------------------------
60         private: 
61                 /*
62                  Substracted Image
63                 */
64                 vtkImageData* imageResult;
65                 /*
66                  image size dimx*dimy*dimz
67                 */
68                 int sizeImage;
69                 /*
70                 upper zero level for doing the Substraction
71                 */
72                 int uZeroLevel;
73                 /*
74                 lower zero level for doing the Substraction
75                 */
76                 int lZeroLevel;
77                 /*
78                 Color for the upper threshold
79                 */
80                 int upperColor[3];
81                 /*
82                 Color for the lower threshold
83                 */
84                 int lowerColor[3];
85                 /*
86                 Color for the medium threshold
87                 */
88                 int mediumColor[3];
89 };
90
91 class bbPackRecalage_EXPORT ImageSubstraction
92  : 
93    public bbtk::AtomicBlackBox
94 {
95   BBTK_BLACK_BOX_INTERFACE(ImageSubstraction,bbtk::AtomicBlackBox);
96   BBTK_DECLARE_INPUT(In1,vtkImageData*);
97   BBTK_DECLARE_INPUT(In2,vtkImageData*);
98   BBTK_DECLARE_INPUT(In3,int);
99   BBTK_DECLARE_INPUT(In4,int);
100   BBTK_DECLARE_INPUT(InU,std::vector<double>);
101   BBTK_DECLARE_INPUT(InM,std::vector<double>);
102   BBTK_DECLARE_INPUT(InL,std::vector<double>);
103   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
104   BBTK_PROCESS(Process);
105   void Process();
106 };
107
108 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageSubstraction,bbtk::AtomicBlackBox);
109 BBTK_NAME("ImageSubstraction");
110 BBTK_AUTHOR("jn.trillos44@uniandes.edu.co");
111 BBTK_DESCRIPTION("Creates a image resulting from the substraction of the RGB values of 2 other images.");
112 BBTK_CATEGORY("__CATEGORY__");
113 BBTK_INPUT(ImageSubstraction,In1,"Image 1",vtkImageData*,"");
114 BBTK_INPUT(ImageSubstraction,In2,"Image 2",vtkImageData*,"");
115 BBTK_INPUT(ImageSubstraction,In3,"Upper Zero Level (Value between 0 and 255)",int,"");
116 BBTK_INPUT(ImageSubstraction,In4,"Lower Zero Level (Value between 0 and 255)",int,"");
117 BBTK_INPUT(ImageSubstraction,InU,"Upper Level Color (RGB)",std::vector<double>,"");
118 BBTK_INPUT(ImageSubstraction,InM,"Medium Level Color (RGB)",std::vector<double>,"");
119 BBTK_INPUT(ImageSubstraction,InL,"Lower Level Color (RGB)",std::vector<double>,"");
120 BBTK_OUTPUT(ImageSubstraction,Out,"Image Result",vtkImageData*,"");
121 BBTK_END_DESCRIBE_BLACK_BOX(ImageSubstraction);
122 }
123 // EO namespace bbCreaRecalage
124
125 #endif // __bbCreaRecalageImageSubstraction_h_INCLUDED__
126