]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuPlaneDirection.cxx
remove home-made 'uint', 'uchar', 'ushort', etc replace by uint32_t, uint8_t, uint16_t
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuPlaneDirection.cxx
1 #include "bbcreaMaracasVisuPlaneDirection.h"
2 #include "bbcreaMaracasVisuPackage.h"
3 namespace bbcreaMaracasVisu
4 {
5
6 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,PlaneDirection)
7 BBTK_BLACK_BOX_IMPLEMENTATION(PlaneDirection,bbtk::WxBlackBox);
8 void PlaneDirection::Process()
9 {
10         int radio = bbGetInputArrowSize();
11         std::vector<int> lstPointsx = bbGetInputlstPointsX();
12         std::vector<int> lstPointsy = bbGetInputlstPointsY();
13         std::vector<int> lstPointsz = bbGetInputlstPointsZ();
14         std::vector<double> _lstPointsx;
15         std::vector<double> _lstPointsy;
16         std::vector<double> _lstPointsz;
17         vtkRenderer* render = bbGetInputRenderer();
18         vtkImageData* img = bbGetInputIn();     
19         std::string filename = bbGetInputFilename();
20
21         _planedir->SetArrowSize(radio);
22         if(render!=NULL){
23                 _planedir->SetRenderer(render);
24         }
25
26         if(lstPointsx.size()>0&&lstPointsy.size()>0&&lstPointsz.size()>0){
27                 double* spc;
28                 if(img != NULL){
29                         spc = img->GetSpacing();
30                 }else{
31                         spc = new double[3];
32             spc[0]=1;
33                         spc[1]=1;
34                         spc[2]=1;
35                 }
36                 
37                 for(int i = 0; i < lstPointsx.size();i++){                      
38                         _lstPointsx.push_back(lstPointsx[i]*spc[0]);
39                         _lstPointsy.push_back(lstPointsy[i]*spc[1]);
40                         _lstPointsz.push_back(lstPointsz[i]*spc[2]);
41                 }               
42                 
43                 _planedir->SetVectors(_lstPointsx, _lstPointsy, _lstPointsz);
44                 _planedir->UpdateDirections();
45                 if(filename.compare("")!=0){
46                         _planedir->WriteInformation(filename,spc);
47                 }
48         }
49 }
50
51 void PlaneDirection::CreateWidget(wxWindow* parent)
52 {
53         _planedir = PlaneDirectionViewer::getInstance(parent, radio, colour, opacity);
54    bbSetOutputWidget( _planedir );      
55 }
56
57 void PlaneDirection::bbUserSetDefaultValues()
58 {
59         radio = 5;
60         colour[0] = 1;
61         colour[1] = 0;
62         colour[2] = 0;
63         opacity = 100;
64 }
65
66 void PlaneDirection::bbUserInitializeProcessing()
67 {
68         std::vector<int> temp;
69         bbSetInputFilename("");
70         bbSetInputRenderer(0);
71         bbSetInputIn(0);
72         bbSetInputlstPointsX(temp);
73         bbSetInputlstPointsY(temp);
74         bbSetInputlstPointsZ(temp);
75 }
76
77 void PlaneDirection::bbUserFinalizeProcessing()
78 {
79
80 }
81 }
82 // EO namespace bbcreaMaracasVisu
83
84