X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbcreaMaracasVisuTubeFilter.cxx;h=16441924a4e790b274dd027b7d2054fa4e3ecb3c;hb=8b01430072604956a52213748415d28c87e018a6;hp=2c191be0f6b902e63fa83dfe5a3c7b304b30c2c5;hpb=7673025235c97a2fded5c1a8190028f21bd9930a;p=creaMaracasVisu.git diff --git a/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx b/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx index 2c191be..1644192 100644 --- a/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx +++ b/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx @@ -17,12 +17,10 @@ #include #include #include -#include #include #include #include -#include namespace bbcreaMaracasVisu @@ -31,37 +29,56 @@ namespace bbcreaMaracasVisu MaracasTubeFilter::MaracasTubeFilter() { } + + MaracasTubeFilter::~MaracasTubeFilter() + { + // Interface Update + if (renderer!=NULL ) + { + renderer->RemoveActor(actor); + } + + } + void MaracasTubeFilter::SetvtkRenderer(vtkRenderer *render) { this->renderer = render; } + + void MaracasTubeFilter::SetlstPoints( std::vector lstPointX , std::vector lstPointY , std::vector lstPointZ ) { - this->lstPointX=lstPointX; - this->lstPointY=lstPointY; - this->lstPointZ=lstPointZ; + this->lstPointX = lstPointX; + this->lstPointY = lstPointY; + this->lstPointZ = lstPointZ; } void MaracasTubeFilter::SetlstRadius( std::vector lstRadius ) { - this->lstRadius=lstRadius; + this->lstRadius = lstRadius; + } + + void MaracasTubeFilter::SetOpacity(double opacity) + { + this->opacity = opacity; + } + + void MaracasTubeFilter::SetTransform( vtkLinearTransform* transform ) + { + this->transform = transform; } + vtkActor *MaracasTubeFilter::GetActor() + { + return actor; + } void MaracasTubeFilter::Run() { - // Spiral tube -// double vX, vY, vZ; -// unsigned int nV = 256; // No. of vertices -// unsigned int nCyc = 5; // No. of spiral cycles -// double rT1 = 0.1, rT2 = 0.5;// Start/end tube radii -// double rS = 2; // Spiral radius -// double h = 10; // Height - unsigned int nTv = 8; // No. of surface elements for each tube vertex - unsigned int i; + unsigned int nTv = 8; // No. of surface elements for each tube vertex // Create points and cells vtkSmartPointer points = vtkSmartPointer::New(); @@ -122,11 +139,23 @@ namespace bbcreaMaracasVisu mapper->SetScalarModeToUsePointFieldData(); mapper->SelectColorArray("Colors"); - vtkSmartPointer actor = - vtkSmartPointer::New(); + // vtkSmartPointer actor =vtkSmartPointer::New(); + actor = vtkSmartPointer::New(); actor->SetMapper(mapper); + actor->GetProperty()->SetOpacity( opacity ); + - renderer->AddActor(actor); + if ( transform!=NULL ) + { + actor->SetUserTransform( transform ); + } + + // Interface Update + if (renderer!=NULL ) + { + renderer->AddActor(actor); + } + } @@ -154,51 +183,57 @@ void TubeFilter::Process() printf("EED TubeFilter::Process start \n"); + if (tubefilter!=NULL) + { + delete tubefilter; + } + + tubefilter = new MaracasTubeFilter(); tubefilter->SetvtkRenderer( bbGetInputRenderer() ); tubefilter->SetlstPoints( bbGetInputlstPointX(), bbGetInputlstPointY(), bbGetInputlstPointZ() ); tubefilter->SetlstRadius( bbGetInputlstRadio() ); + tubefilter->SetOpacity( bbGetInputOpacity() ); + tubefilter->SetTransform( bbGetInputTransform() ); tubefilter->Run(); - bbSetOutputOutAxis( NULL ); - + bbSetOutputOutAxis( tubefilter->GetActor() ); printf("EED TubeFilter::Process end \n"); } + //===== // 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) //===== void TubeFilter::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 -// bbSetInputIn(0); - + bbSetInputOpacity(1); + bbSetInputTransform(NULL); + } + //===== // 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) //===== void TubeFilter::bbUserInitializeProcessing() { - // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers -// if any - - tubefilter = new MaracasTubeFilter(); - +// if any + tubefilter = NULL; } + //===== // 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) //===== void TubeFilter::bbUserFinalizeProcessing() { - // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any - } + } // EO namespace bbcreaMaracasVisu