]> Creatis software - creaImageIO.git/blob - bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomCreateAxesTreeData.cxx
#3326 bbtk_Transform3Ddicom_PKG
[creaImageIO.git] / bbtk_Transform3Ddicom_PKG / src / bbTransform3DdicomCreateAxesTreeData.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbTransform3DdicomCreateAxesTreeData.h"
5 #include "bbTransform3DdicomPackage.h"
6 #include "math.h"
7
8 namespace bbTransform3Ddicom
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,CreateAxesTreeData)
12 BBTK_BLACK_BOX_IMPLEMENTATION(CreateAxesTreeData,bbtk::AtomicBlackBox);
13 //===== 
14 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
15 //===== 
16 void CreateAxesTreeData::Process()
17 {
18
19 // THE MAIN PROCESSING METHOD BODY
20 //   Here we simply set the input 'In' value to the output 'Out'
21 //   And print out the output value
22 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
23 //    void bbSet{Input|Output}NAME(const TYPE&)
24 //    const TYPE& bbGet{Input|Output}NAME() const 
25 //    Where :
26 //    * NAME is the name of the input/output
27 //      (the one provided in the attribute 'name' of the tag 'input')
28 //    * TYPE is the C++ type of the input/output
29 //      (the one provided in the attribute 'type' of the tag 'input')
30
31 //    bbSetOutputOut( bbGetInputIn() );
32 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
33
34         std::vector<double> LstX;
35         std::vector<double> LstY;
36         std::vector<double> LstZ;
37         std::vector<int>        LstIndex;
38         std::vector<double> LstColor;
39         if ((bbGetInputIPP().size()==3) && (bbGetInputIOP().size()==6) )
40         {
41         // Axis X
42                 LstX.push_back( bbGetInputIPP()[0] );
43                 LstY.push_back( bbGetInputIPP()[1] );
44                 LstZ.push_back( bbGetInputIPP()[2] );
45                 LstX.push_back( bbGetInputIPP()[0]+20 );
46                 LstY.push_back( bbGetInputIPP()[1] );
47                 LstZ.push_back( bbGetInputIPP()[2] );           
48                 LstIndex.push_back(2);
49                 LstColor.push_back(1);
50                 LstColor.push_back(0);
51                 LstColor.push_back(0);
52         // Axis Y
53                 LstX.push_back( bbGetInputIPP()[0] );
54                 LstY.push_back( bbGetInputIPP()[1] );
55                 LstZ.push_back( bbGetInputIPP()[2] );
56                 LstX.push_back( bbGetInputIPP()[0] );
57                 LstY.push_back( bbGetInputIPP()[1]+20 );
58                 LstZ.push_back( bbGetInputIPP()[2] );           
59                 LstIndex.push_back(2);
60                 LstColor.push_back(1);
61                 LstColor.push_back(1);
62                 LstColor.push_back(0);
63         // Axis Z
64                 LstX.push_back( bbGetInputIPP()[0] );
65                 LstY.push_back( bbGetInputIPP()[1] );
66                 LstZ.push_back( bbGetInputIPP()[2] );
67                 LstX.push_back( bbGetInputIPP()[0] );
68                 LstY.push_back( bbGetInputIPP()[1] );
69                 LstZ.push_back( bbGetInputIPP()[2]+20 );                
70                 LstIndex.push_back(2);
71                 LstColor.push_back(1);
72                 LstColor.push_back(0);
73                 LstColor.push_back(1);
74         // Axis V1
75                 LstX.push_back( bbGetInputIPP()[0] );
76                 LstY.push_back( bbGetInputIPP()[1] );
77                 LstZ.push_back( bbGetInputIPP()[2] );
78                 double sizeX = (bbGetInputImageSize()[0]-1)*bbGetInputImageSpacing()[0];
79                 LstX.push_back( bbGetInputIPP()[0] + bbGetInputIOP()[0]*sizeX);
80                 LstY.push_back( bbGetInputIPP()[1] + bbGetInputIOP()[1]*sizeX);
81                 LstZ.push_back( bbGetInputIPP()[2] + bbGetInputIOP()[2]*sizeX);         
82                 LstIndex.push_back(2);
83                 LstColor.push_back(1);
84                 LstColor.push_back(1);
85                 LstColor.push_back(1);
86         // Axis V2
87                 LstX.push_back( bbGetInputIPP()[0] );
88                 LstY.push_back( bbGetInputIPP()[1] );
89                 LstZ.push_back( bbGetInputIPP()[2] );
90                 double sizeY = (bbGetInputImageSize()[1]-1)*bbGetInputImageSpacing()[1];
91                 LstX.push_back( bbGetInputIPP()[0] + bbGetInputIOP()[3]*sizeY);
92                 LstY.push_back( bbGetInputIPP()[1] + bbGetInputIOP()[4]*sizeY);
93                 LstZ.push_back( bbGetInputIPP()[2] + bbGetInputIOP()[5]*sizeY);         
94                 LstIndex.push_back(2);
95                 LstColor.push_back(0.7);
96                 LstColor.push_back(0.7);
97                 LstColor.push_back(0.7);
98      //  ---------------
99                 bbSetOutputLstX( LstX );
100                 bbSetOutputLstY( LstY );
101                 bbSetOutputLstZ( LstZ );
102                 bbSetOutputLstIndex( LstIndex );
103                 bbSetOutputLstColor( LstColor );
104         }
105 }
106 //===== 
107 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
108 //===== 
109 void CreateAxesTreeData::bbUserSetDefaultValues()
110 {
111 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
112 //    Here we initialize the input 'In' to 0
113  //  bbSetInputIn(0); 
114 }
115
116 //===== 
117 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
118 //===== 
119 void CreateAxesTreeData::bbUserInitializeProcessing()
120 {
121 //  THE INITIALIZATION METHOD BODY :
122 //    Here does nothing 
123 //    but this is where you should allocate the internal/output pointers 
124 //    if any  
125 }
126
127 //===== 
128 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
129 //===== 
130 void CreateAxesTreeData::bbUserFinalizeProcessing()
131 {
132 //  THE FINALIZATION METHOD BODY :
133 //    Here does nothing 
134 //    but this is where you should desallocate the internal/output pointers 
135 //    if any 
136 }
137
138 } // EO namespace bbTransform3Ddicom
139
140