X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbcreaMaracasVisuTubeTreeFilter.cxx;h=8f2a3ce5b96a44cd26d1a401feb3b34d085db377;hb=35a5d83be3d84f9d1544b8d3ad0de044f1e65286;hp=e6e860f5b5d35f27e5ea166e8e605098e3231e3d;hpb=8b01430072604956a52213748415d28c87e018a6;p=creaMaracasVisu.git diff --git a/bbtk/src/bbcreaMaracasVisuTubeTreeFilter.cxx b/bbtk/src/bbcreaMaracasVisuTubeTreeFilter.cxx index e6e860f..8f2a3ce 100644 --- a/bbtk/src/bbcreaMaracasVisuTubeTreeFilter.cxx +++ b/bbtk/src/bbcreaMaracasVisuTubeTreeFilter.cxx @@ -97,26 +97,6 @@ void TubeTreeFilter::DrawOneTube(int iGeneral,int numPoints, int iTube) sphereActorEnd->SetOrigin( 0,0,0 ); sphereActorEnd->SetPosition(bbGetInputlstPointX()[i]*spc[0], bbGetInputlstPointY()[i]*spc[1], bbGetInputlstPointZ()[i]*spc[2] ); - - // color - double r,g,b; - if ( (iTube*3+1) < (int)(bbGetInputColour().size()) ) - { - r = bbGetInputColour()[0+iTube*3]; - g = bbGetInputColour()[1+iTube*3]; - b = bbGetInputColour()[2+iTube*3]; - } else { - r = (rand() % 100) / 100.0; - g = (rand() % 100) / 100.0; - b = (rand() % 100) / 100.0; - } - r = bbGetInputColour()[0]; - g = bbGetInputColour()[1]; - b = bbGetInputColour()[2]; - - - - vtkSmartPointer tube = vtkSmartPointer::New(); //EED vtkTubeFilter *tube = vtkTubeFilter::New(); tube->SetInput(polyData); @@ -131,26 +111,11 @@ void TubeTreeFilter::DrawOneTube(int iGeneral,int numPoints, int iTube) // vtkSmartPointer actor =vtkSmartPointer::New(); vtkSmartPointer actor = vtkSmartPointer::New(); -//EED vtkActor *actor = vtkActor::New(); actor->SetMapper(mapper); - actor->GetProperty()->SetColor( r,g,b ); - actor->GetProperty()->SetOpacity( bbGetInputOpacity() ); - sphereActorStart->GetProperty()->SetColor( r,g,b );; - sphereActorEnd->GetProperty()->SetColor( r,g,b );; - sphereActorStart->GetProperty()->SetOpacity( bbGetInputOpacity() ); - sphereActorEnd->GetProperty()->SetOpacity( bbGetInputOpacity() ); vecVtkActors.push_back( actor ); - vecVtkActors.push_back( sphereActorStart ); vecVtkActors.push_back( sphereActorEnd ); - - - if ( bbGetInputTransform()!=NULL ) - { - actor->SetUserTransform( bbGetInputTransform() ); - sphereActorStart->SetUserTransform( bbGetInputTransform() ); - sphereActorEnd->SetUserTransform( bbGetInputTransform() ); - } + vecVtkActors.push_back( sphereActorStart ); // Interface Update // Interface Update if (bbGetInputRenderer()!=NULL ) @@ -162,6 +127,64 @@ void TubeTreeFilter::DrawOneTube(int iGeneral,int numPoints, int iTube) } +void TubeTreeFilter::SetGraphicProperties() +{ + int iTube,sizeLstAxis=bbGetInputlstIndexs().size(); + + vtkActor *actorTube; + vtkActor *actorSpherEnd; + vtkActor *actorSpherStart; + + + double r,g,b; + r = bbGetInputColour()[0]; + g = bbGetInputColour()[1]; + b = bbGetInputColour()[2]; + for (iTube=0 ; iTubeGetProperty()->SetOpacity( bbGetInputOpacity() ); + actorSpherEnd->GetProperty()->SetOpacity( bbGetInputOpacity() ); + actorSpherStart->GetProperty()->SetOpacity( bbGetInputOpacity() ); + + //Set Colour + if ( bbGetInputTransform()!=NULL ) + { + actorTube->SetUserTransform( bbGetInputTransform() ); + actorSpherEnd->SetUserTransform( bbGetInputTransform() ); + actorSpherStart->SetUserTransform( bbGetInputTransform() ); + } + + if (bbGetInputColourLaw()==1) // One solide colour + { + // + } + + if (bbGetInputColourLaw()==2) // color for differents tubes + { + if ( (iTube*3+1) < (int)(bbGetInputColour().size()) ) + { + r = bbGetInputColour()[0+iTube*3]; + g = bbGetInputColour()[1+iTube*3]; + b = bbGetInputColour()[2+iTube*3]; + } else { + r = (rand() % 100) / 100.0; + g = (rand() % 100) / 100.0; + b = (rand() % 100) / 100.0; + } + } + + actorTube->GetProperty()->SetColor( r,g,b ); + actorSpherEnd->GetProperty()->SetColor( r,g,b ); + actorSpherStart->GetProperty()->SetColor( r,g,b ); + } // for +} + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== @@ -205,31 +228,9 @@ void TubeTreeFilter::Process() bbSetOutputOutTube( vecVtkActors[ bbGetInputiTube()*3 ] ); } else { printf("TubeTreeFilter .ERROR. missing index vector...\n"); - } - - } - - double r,g,b; - r = bbGetInputColour()[0]; - g = bbGetInputColour()[1]; - b = bbGetInputColour()[2]; - for (iTube=0 ; iTubeGetProperty()->SetOpacity( bbGetInputOpacity() ); - actor2->GetProperty()->SetOpacity( bbGetInputOpacity() ); - actor3->GetProperty()->SetOpacity( bbGetInputOpacity() ); - if (bbGetInputColourLaw()==1) - { - actor1->GetProperty()->SetColor( r,g,b ); - actor2->GetProperty()->SetColor( r,g,b ); - actor3->GetProperty()->SetColor( r,g,b ); - } - } // for - + }// vector Actor size + } + SetGraphicProperties(); printf("EED TubeTreeFilter::Process end \n"); }