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 #include "vtkLinearTransform.h"
14 namespace bbcreaMaracasVisu
18 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,DrawAxe3D)
19 BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxe3D,bbtk::AtomicBlackBox);
20 void DrawAxe3D::Process()
23 std::vector< double > vectx = bbGetInputlstPointX();
24 std::vector< double > vecty = bbGetInputlstPointY();
25 std::vector< double > vectz = bbGetInputlstPointZ();
27 // vtkImageData* img = bbGetInputImage();
30 // img->GetSpacing(spc);
35 if(!vectx.empty()&&!vecty.empty()&&!vectz.empty()){
36 vtkPoints* allPoints = vtkPoints::New( );
37 vtkCellArray* allTopology = vtkCellArray::New( );
38 allTopology->InsertNextCell( vectx.size() );
40 for( i = 0; i < vectx.size( ); i++) {
41 //multiplicar ver parametros spacing, en maracas cuando se toca la imagen y se ve dycom
42 //hay parĂ¡metro dycom, vtkImagedata valor spacing y esos datos hay que multiplicar al polydata
43 allPoints->InsertNextPoint( vectx[i]*spc[0], vecty[i]*spc[1], vectz[i]*spc[2] );
44 allTopology->InsertCellPoint( i );
46 mallData->SetPoints( allPoints );
47 mallData->SetLines( allTopology );
49 allTopology->Delete();
52 mvtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
53 bbGetInputColour()[1],
54 bbGetInputColour()[2] );
56 if ( bbGetInputTransform()!=NULL )
58 mvtkactor->SetUserTransform( bbGetInputTransform() );
62 if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
65 bbGetInputRenderer()->AddActor( mvtkactor );
70 void DrawAxe3D::bbUserConstructor()
73 mallData = vtkPolyData::New( );
74 vtkPolyDataMapper* polydatamapper = vtkPolyDataMapper::New();
75 mvtkactor = vtkActor::New();
76 polydatamapper->SetInput(mallData);
77 mvtkactor->SetMapper(polydatamapper);
78 bbSetOutputOut(mvtkactor);
80 std::vector<double> colour;
81 colour.push_back(1.0);
82 colour.push_back(0.0);
83 colour.push_back(0.0);
84 bbSetInputColour(colour);
87 void DrawAxe3D::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
90 void DrawAxe3D::bbUserDestructor()
96 // EO namespace bbcreaMaracasVisu