X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuDrawAxe3D.cxx;h=cd9997b4087ced046f0f9161465b126adfc456f2;hb=56a256c7d1687cb895052aa6353260654820e0eb;hp=61c3ade4fa0a0607c11780d931eccec525ac42da;hpb=a2002b519bbc151c24ea558cea99625c13ed392d;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuDrawAxe3D.cxx b/bbtk/src/bbmaracasvisuDrawAxe3D.cxx index 61c3ade..cd9997b 100644 --- a/bbtk/src/bbmaracasvisuDrawAxe3D.cxx +++ b/bbtk/src/bbmaracasvisuDrawAxe3D.cxx @@ -1,24 +1,22 @@ #include "bbmaracasvisuDrawAxe3D.h" #include "bbcreaMaracasVisuPackage.h" - #include "vtkImageData.h" #include "vtkActor.h" -#include "vtkPolyDataMapper.h" #include "vtkPoints.h" #include "vtkCellArray.h" #include "vtkProperty.h" - +#include "vtkLinearTransform.h" namespace bbcreaMaracasVisu { - BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,DrawAxe3D) BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxe3D,bbtk::AtomicBlackBox); void DrawAxe3D::Process() { - + printf("EED DrawAxe3D::Process start \n"); + std::vector< double > vectx = bbGetInputlstPointX(); std::vector< double > vecty = bbGetInputlstPointY(); std::vector< double > vectz = bbGetInputlstPointZ(); @@ -38,7 +36,7 @@ void DrawAxe3D::Process() for( i = 0; i < vectx.size( ); i++) { //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 + //hay parametro dicom, vtkImagedata valor spacing y esos datos hay que multiplicar al polydata allPoints->InsertNextPoint( vectx[i]*spc[0], vecty[i]*spc[1], vectz[i]*spc[2] ); allTopology->InsertCellPoint( i ); } // rof @@ -49,8 +47,8 @@ void DrawAxe3D::Process() } mvtkactor->GetProperty()->SetColor( bbGetInputColour()[0], - bbGetInputColour()[1], - bbGetInputColour()[2] ); + bbGetInputColour()[1], + bbGetInputColour()[2] ); if ( bbGetInputTransform()!=NULL ) { @@ -63,18 +61,17 @@ void DrawAxe3D::Process() firsttime=false; bbGetInputRenderer()->AddActor( mvtkactor ); } + + printf("EED DrawAxe3D::Process end \n"); } -void DrawAxe3D::bbUserConstructor() +void DrawAxe3D::bbUserSetDefaultValues() { - firsttime = true; - mallData = vtkPolyData::New( ); - vtkPolyDataMapper* polydatamapper = vtkPolyDataMapper::New(); - mvtkactor = vtkActor::New(); - polydatamapper->SetInput(mallData); - mvtkactor->SetMapper(polydatamapper); - bbSetOutputOut(mvtkactor); + firsttime = true; + mallData = NULL; + polydatamapper = NULL; + mvtkactor = NULL; std::vector colour; colour.push_back(1.0); @@ -83,13 +80,43 @@ void DrawAxe3D::bbUserConstructor() bbSetInputColour(colour); } -void DrawAxe3D::bbUserCopyConstructor() -{ -} -void DrawAxe3D::bbUserDestructor() -{ -} + + //----------------------------------------------------------------- + void DrawAxe3D::bbUserInitializeProcessing() + { + mallData = vtkPolyData::New( ); + polydatamapper = vtkPolyDataMapper::New(); + mvtkactor = vtkActor::New(); + + polydatamapper->SetInput(mallData); + mvtkactor->SetMapper(polydatamapper); + bbSetOutputOut(mvtkactor); + } + + //----------------------------------------------------------------- + void DrawAxe3D::bbUserFinalizeProcessing() + { + if (mallData!=NULL) + { + mallData->Delete(); + mallData=NULL; + } + + if (polydatamapper!=NULL) + { + polydatamapper->Delete(); + polydatamapper=NULL; + } + + if (mvtkactor!=NULL) + { + mvtkactor->Delete(); + mvtkactor=NULL; + } + } + + //----------------------------------------------------------------- } // EO namespace bbcreaMaracasVisu