X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuDrawAxisTree3D.cxx;h=0e2d99d9005851634c62277576d6264860e5b470;hb=12b981bff843fa03341334fe5b911a011afaadff;hp=9af83d5eaab9a88e2b0cf40d3f9f6df3bf555de5;hpb=e78a80c507961553cc6186b93a793c0d1fc96be2;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx b/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx index 9af83d5..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 ); @@ -40,33 +42,36 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) for (i=iGeneral;iInsertNextPoint( bbGetInputlstPointX()[i]*spc[0], - bbGetInputlstPointY()[i]*spc[1], + //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], 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) < 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 ) { @@ -83,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::bbUserConstructor() -{ +void DrawAxisTree3D::bbUserSetDefaultValues() +{ + oldLstSize=-1; bbSetInputiAxis(0); std::vector colour; // 1- red @@ -134,27 +164,34 @@ void DrawAxisTree3D::bbUserConstructor() 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::bbUserCopyConstructor(bbtk::BlackBox::Pointer) -{ -} -void DrawAxisTree3D::bbUserDestructor() -{ -} + //----------------------------------------------------------------- + void DrawAxisTree3D::bbUserInitializeProcessing() + { + } + + //----------------------------------------------------------------- + void DrawAxisTree3D::bbUserFinalizeProcessing() + { + } + + //----------------------------------------------------------------- } // EO namespace bbcreaMaracasVisu