void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
{
-//EED printf("8.1 ");
vtkPolyData *polydata = vtkPolyData::New( );
vtkPolyDataMapper *polydatamapper = vtkPolyDataMapper::New();
vtkActor *vtkactor = vtkActor::New();
#endif
vtkactor->SetMapper(polydatamapper);
-//EED printf("8.2 ");
-
vecVtkPolyData.push_back( polydata );
vecVtkPolyDataMaper.push_back( polydatamapper );
vecVtkActors.push_back( vtkactor );
-//EED printf("8.3 ");
-
// vtkImageData* img = bbGetInputImage();
unsigned int i,size;
double spc[3];
spc[2]=1;
int lstpointsXsize =bbGetInputlstPointX().size();
-
-//EED printf("8.4 ");
-
if( lstpointsXsize>0 )
{
-//EED printf("8.5 ");
vtkPoints *allPoints = vtkPoints::New( );
vtkPolyLine *polyline = vtkPolyLine::New();
vtkCellArray* allTopology = vtkCellArray::New( );
size=iGeneral+numPoints;
-//EED printf("8.6a %p %d %d ",allPoints, iGeneral,size);
-//EED printf("8.6b %d %d %d ",bbGetInputlstPointX().size(), bbGetInputlstPointY().size(), bbGetInputlstPointZ().size() );
for (i=iGeneral;i<size;i++)
{
-//EED printf("8.7(%d) ",i);
//multiplicar ver parametros spacing, en maracas cuando se toca la imagen y se ve dycom
//hay parĀ·metro dycom, vtkImagedata valor spacing y esos datos hay que multiplicar al polydata
allPoints->InsertNextPoint( bbGetInputlstPointX()[i]*spc[0],
// allTopology->InsertCellPoint( i-iGeneral );
} // rof
-//EED printf("8.8 ");
- allTopology->InsertNextCell(polyline);
-
- // create cell array for edges
- vtkCellArray *edges = vtkCellArray::New();
-//EED printf("8.9 ");
-
-// connect edge's and vertexes point ids
- for(vtkIdType i = iGeneral; i < size-1; i++)
- {
-//EED printf("8.10(%d) ",i);
- vtkLine *edge = vtkLine::New();
- edge->GetPointIds()->SetId(0, i-iGeneral);
- edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
- edges->InsertNextCell(edge);
- edge->Delete();
-// vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
-// vertex->GetPointIds()->SetId(0, i);
-// vertexes->InsertNextCell(vertex);
- }
-
-//EED printf("8.11 ");
- polydata->SetPoints( allPoints );
- polydata->SetLines(edges);
+ allTopology->InsertNextCell(polyline);
+ // create cell array for edges
+ vtkCellArray *edges = vtkCellArray::New();
+ // connect edge's and vertexes point ids
+ for(vtkIdType i = iGeneral; i < size-1; i++)
+ {
+ vtkLine *edge = vtkLine::New();
+ edge->GetPointIds()->SetId(0, i-iGeneral);
+ edge->GetPointIds()->SetId(1, (i-iGeneral+1) );
+ edges->InsertNextCell(edge);
+ edge->Delete();
+ // vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();
+ // vertex->GetPointIds()->SetId(0, i);
+ // vertexes->InsertNextCell(vertex);
+ }
+ polydata->SetPoints( allPoints );
+ polydata->SetLines(edges);
// polydata->SetLines( allTopology );
edges->Delete();
allPoints->Delete();
allTopology->Delete();
-//EED printf("8.12 ");
-
}
// color
if (bbGetInputColourLaw()==1) // the same color for all
{
-//EED printf("8.13(%d) ",bbGetInputColour().size() );
-
r = bbGetInputColour()[0];
g = bbGetInputColour()[1];
b = bbGetInputColour()[2];
if (bbGetInputColourLaw()==2) // different colors for each segment
{
-//EED printf("8.14 ");
if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) )
{
r = bbGetInputColour()[0+iAxis*3];
g = (rand() % 100) / 100.0;
b = (rand() % 100) / 100.0;
}
-//EED printf("8.15 ");
vtkactor->GetProperty()->SetColor( r,g,b );
} // Law 2 color for each segment
if (bbGetInputColourLaw()==3) // color for each point
{
-//EED printf("8.16 ");
// Setup the colors array
vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
colors->SetNumberOfComponents(3);
colors->SetName("Colors");
// colors->SetName("vertex color");
int iPoint,pointSize=iGeneral+numPoints;
-
-
for (iPoint=iGeneral; iPoint<pointSize; iPoint++)
{
r = bbGetInputColour()[0+iPoint*3]*255.0;
} // Law 3 color for each point
-//EED printf("8.17 ");
vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
if ( bbGetInputTransform()!=NULL )
{
-//EED printf("8.18 ");
vtkactor->SetUserTransform( bbGetInputTransform() );
}
-
- // Interface Update
- if (bbGetInputRenderer()!=NULL )
- {
-//EED printf("8.19 ");
- bbGetInputRenderer()->AddActor( vtkactor );
- }
-//EED printf("8.20 ");
-
+ // Interface Update
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->AddActor( vtkactor );
+ }
}
void DrawAxisTree3D::Process()
{
-printf("DrawAxisTree3D::Process Start >> %s\n", bbGetFullName().c_str() );
// Removing actors
int iActor,sizeActors = vecVtkActors.size();
printf("\nDrawAxisTree3D .ERROR. size of vectors lstPointX.size=%d lstPointY.size=%d lstPointZ.size=%d are not coherent \n\n",bbGetInputlstPointX().size(), bbGetInputlstPointY().size(), bbGetInputlstPointZ().size() );
}// size X Y Z
} // if Active
-printf("DrawAxisTree3D::Process End \n");
}