X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuDrawAxisTree3D.cxx;h=0e2d99d9005851634c62277576d6264860e5b470;hb=46e997508c80de816d3e26f9ccdb4a5e6d68a5f9;hp=8d7324555487e2d214136069df0093304b2fccf8;hpb=badc6cea49d018dec82191a977fc082299a1da35;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx b/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx index 8d73245..0e2d99d 100644 --- a/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx +++ b/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx @@ -23,15 +23,17 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) 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 ); @@ -41,15 +43,16 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) { //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 @@ -58,12 +61,9 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) 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]; r = (rand() % 100) / 100.0; g = (rand() % 100) / 100.0; b = (rand() % 100) / 100.0; @@ -71,6 +71,7 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) vtkactor->GetProperty()->SetColor( r,g,b ); vtkactor->GetProperty()->SetLineWidth( 0.5 ); + vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() ); if ( bbGetInputTransform()!=NULL ) { @@ -87,39 +88,64 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) void DrawAxisTree3D::Process() { - int iActor,sizeActors = vecVtkActors.size(); - for (iActor=0 ; iActorRemoveActor( 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 ; iAxisRemoveActor( vecVtkActors[iActor] ); + vecVtkPolyData[iActor]->Delete(); + vecVtkPolyDataMaper[iActor]->Delete(); + vecVtkActors[iActor]->Delete(); + } + } + vecVtkPolyData.clear(); + vecVtkPolyDataMaper.clear(); + vecVtkActors.clear(); + + for ( iAxis=0 ; iAxisGetProperty()->SetOpacity( bbGetInputOpacity() ); + } + } + + printf("EED DrawAxisTree3D::Process end \n"); } void DrawAxisTree3D::bbUserSetDefaultValues() -{ +{ + oldLstSize=-1; bbSetInputiAxis(0); std::vector colour; // 1- red @@ -138,32 +164,34 @@ void DrawAxisTree3D::bbUserSetDefaultValues() 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