1 #include "bbmaracasvisuDrawAxe3D.h"
2 #include "bbcreaMaracasVisuPackage.h"
5 #include "vtkImageData.h"
7 #include "vtkPolyDataMapper.h"
9 #include "vtkCellArray.h"
10 #include "vtkProperty.h"
13 namespace bbcreaMaracasVisu
17 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,DrawAxe3D)
18 BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxe3D,bbtk::AtomicBlackBox);
19 void DrawAxe3D::Process()
22 std::vector< double > vectx = bbGetInputlstPointX();
23 std::vector< double > vecty = bbGetInputlstPointY();
24 std::vector< double > vectz = bbGetInputlstPointZ();
26 // vtkImageData* img = bbGetInputImage();
29 // img->GetSpacing(spc);
34 if(!vectx.empty()&&!vecty.empty()&&!vectz.empty()){
35 vtkPoints* allPoints = vtkPoints::New( );
36 vtkCellArray* allTopology = vtkCellArray::New( );
37 allTopology->InsertNextCell( vectx.size() );
39 for( i = 0; i < vectx.size( ); i++) {
40 //multiplicar ver parametros spacing, en maracas cuando se toca la imagen y se ve dycom
41 //hay parĂ¡metro dycom, vtkImagedata valor spacing y esos datos hay que multiplicar al polydata
42 allPoints->InsertNextPoint( vectx[i]*spc[0], vecty[i]*spc[1], vectz[i]*spc[2] );
43 allTopology->InsertCellPoint( i );
45 mallData->SetPoints( allPoints );
46 mallData->SetLines( allTopology );
48 allTopology->Delete();
51 mvtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
52 bbGetInputColour()[1],
53 bbGetInputColour()[2] );
55 if ( bbGetInputTransform()!=NULL )
57 mvtkactor->SetUserTransform( bbGetInputTransform() );
61 if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
64 bbGetInputRenderer()->AddActor( mvtkactor );
69 void DrawAxe3D::bbUserConstructor()
72 mallData = vtkPolyData::New( );
73 vtkPolyDataMapper* polydatamapper = vtkPolyDataMapper::New();
74 mvtkactor = vtkActor::New();
75 polydatamapper->SetInput(mallData);
76 mvtkactor->SetMapper(polydatamapper);
77 bbSetOutputOut(mvtkactor);
79 std::vector<double> colour;
80 colour.push_back(1.0);
81 colour.push_back(0.0);
82 colour.push_back(0.0);
83 bbSetInputColour(colour);
86 void DrawAxe3D::bbUserCopyConstructor()
89 void DrawAxe3D::bbUserDestructor()
95 // EO namespace bbcreaMaracasVisu