vecVtkPolyDataMaper.push_back( polydatamapper );
vecVtkActors.push_back( vtkactor );
-// vtkImageData* img = bbGetInputImage();
+// vtkImageData* img = bbGetInputImage();
unsigned int i,size;
- double spc[3];
+ double spc[3];
// img->GetSpacing(spc);
spc[0]=1;
spc[1]=1;
spc[2]=1;
- if(!bbGetInputlstPointX().empty()){
+ int lstpointsXsize =bbGetInputlstPointX().size();
+
+ if( lstpointsXsize>0 ){
vtkPoints* allPoints = vtkPoints::New( );
vtkCellArray* allTopology = vtkCellArray::New( );
allTopology->InsertNextCell( numPoints );
{
//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],
- bbGetInputlstPointY()[i]*spc[1],
+ allPoints->InsertNextPoint( bbGetInputlstPointX()[i]*spc[0],
+ bbGetInputlstPointY()[i]*spc[1],
bbGetInputlstPointZ()[i]*spc[2] );
+// printf("DrawAxisTree3D::DrawOneAxis point %d -> %f, %f, %f \n", i, bbGetInputlstPointX()[i], bbGetInputlstPointY()[i], bbGetInputlstPointZ()[i] );
allTopology->InsertCellPoint( i-iGeneral );
} // rof
polydata->SetPoints( allPoints );
polydata->SetLines( allTopology );
allPoints->Delete();
- allTopology->Delete();
+ allTopology->Delete();
}
// color
double r,g,b;
- if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) ){
+ if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) )
+ {
r = bbGetInputColour()[0+iAxis*3];
- g = bbGetInputColour()[1+iAxis*3];
+ g = bbGetInputColour()[1+iAxis*3];
b = bbGetInputColour()[2+iAxis*3];
- } else {
- r = bbGetInputColour()[0];
- g = bbGetInputColour()[1];
- b = bbGetInputColour()[2];
- }
+ } else {
+ r = (rand() % 100) / 100.0;
+ g = (rand() % 100) / 100.0;
+ b = (rand() % 100) / 100.0;
+ }
- vtkactor->GetProperty()->SetColor( 1,0,0 );
- vtkactor->GetProperty()->SetLineWidth( 3 );
+ vtkactor->GetProperty()->SetColor( r,g,b );
+ vtkactor->GetProperty()->SetLineWidth( 0.5 );
+ vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
if ( bbGetInputTransform()!=NULL )
{
void DrawAxisTree3D::Process()
{
- int iActor,sizeActors = vecVtkActors.size();
- for (iActor=0 ; iActor<sizeActors; iActor++)
- {
- if (bbGetInputRenderer()!=NULL )
- {
- bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
- vecVtkPolyData[iActor]->Delete();
- vecVtkPolyDataMaper[iActor]->Delete();
- vecVtkActors[iActor]->Delete();
- }
- }
- vecVtkPolyData.clear();
- vecVtkPolyDataMaper.clear();
- vecVtkActors.clear();
-
+ printf("EED DrawAxisTree3D::Process start \n");
int iGeneral=0;
int iAxis,sizeLstAxis=bbGetInputlstIndexs().size();
+ int iActor,sizeActors = vecVtkActors.size();
int numPoints;
- for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
- {
- numPoints = bbGetInputlstIndexs()[iAxis];
- DrawOneAxis(iGeneral,numPoints,iAxis);
- iGeneral = iGeneral+numPoints;
- }
-
- bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );
+ if (oldLstSize!=sizeLstAxis)
+ {
+ oldLstSize=sizeLstAxis;
+ for (iActor=0 ; iActor<sizeActors; iActor++)
+ {
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
+ vecVtkPolyData[iActor]->Delete();
+ vecVtkPolyDataMaper[iActor]->Delete();
+ vecVtkActors[iActor]->Delete();
+ }
+ }
+ vecVtkPolyData.clear();
+ vecVtkPolyDataMaper.clear();
+ vecVtkActors.clear();
+
+ for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
+ {
+ numPoints = bbGetInputlstIndexs()[iAxis];
+ DrawOneAxis(iGeneral,numPoints,iAxis);
+ iGeneral = iGeneral+numPoints;
+
+ // if ((iAxis % 1)==0)
+ // {
+ // printf("EED DrawAxisTree3D::Process %d/%d\n", iAxis,sizeLstAxis );
+ // }
+
+ }
+
+ if ( bbGetInputiAxis() < (int)(vecVtkActors.size()-1) )
+ {
+ bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );
+ } else {
+ printf("TubeTreeFilter .ERROR. missing index vector...\n");
+ }
+
+ } else {// if oldLstSize
+ for (iActor=0 ; iActor<sizeActors; iActor++)
+ {
+ vecVtkActors[iActor]->GetProperty()->SetOpacity( bbGetInputOpacity() );
+ }
+ }
+
+ printf("EED DrawAxisTree3D::Process end \n");
}
void DrawAxisTree3D::bbUserSetDefaultValues()
-{
+{
+ oldLstSize=-1;
bbSetInputiAxis(0);
std::vector<double> colour;
// 1- red
colour.push_back(0.0);
colour.push_back(1.0);
colour.push_back(0.0);
- // 5-
+ // 5-
colour.push_back(0.0);
colour.push_back(1.0);
colour.push_back(1.0);
- // 6-
+ // 6-
colour.push_back(0.5);
colour.push_back(0.5);
colour.push_back(0.5);
bbSetInputColour(colour);
+ bbSetInputOpacity(1);
+ bbSetInputColourLaw(1);
}
-
- //-----------------------------------------------------------------
+
+ //-----------------------------------------------------------------
void DrawAxisTree3D::bbUserInitializeProcessing()
{
}
-
- //-----------------------------------------------------------------
+
+ //-----------------------------------------------------------------
void DrawAxisTree3D::bbUserFinalizeProcessing()
{
}
-
- //-----------------------------------------------------------------
+
+ //-----------------------------------------------------------------
}
// EO namespace bbcreaMaracasVisu