X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuDrawAxe3D.cxx;h=5736969768048baf27802e602f6f1541859a6338;hb=1e114d2e85dfcbb93b774b5aa43bc96a2293c4e7;hp=5a0a17d3a69fbbf9a4a631d72d2b8c644c65358b;hpb=9dc674e734b8dc98f1729630889bcabc9f4a695c;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuDrawAxe3D.cxx b/bbtk/src/bbmaracasvisuDrawAxe3D.cxx index 5a0a17d..5736969 100644 --- a/bbtk/src/bbmaracasvisuDrawAxe3D.cxx +++ b/bbtk/src/bbmaracasvisuDrawAxe3D.cxx @@ -1,25 +1,20 @@ #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() { - std::vector< double > vectx = bbGetInputlstPointX(); std::vector< double > vecty = bbGetInputlstPointY(); std::vector< double > vectz = bbGetInputlstPointZ(); @@ -39,7 +34,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 @@ -50,8 +45,8 @@ void DrawAxe3D::Process() } mvtkactor->GetProperty()->SetColor( bbGetInputColour()[0], - bbGetInputColour()[1], - bbGetInputColour()[2] ); + bbGetInputColour()[1], + bbGetInputColour()[2] ); if ( bbGetInputTransform()!=NULL ) { @@ -64,18 +59,14 @@ void DrawAxe3D::Process() firsttime=false; bbGetInputRenderer()->AddActor( mvtkactor ); } - } -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); @@ -84,13 +75,43 @@ void DrawAxe3D::bbUserConstructor() bbSetInputColour(colour); } -void DrawAxe3D::bbUserCopyConstructor(bbtk::BlackBox::Pointer) -{ -} -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