--- /dev/null
+#include "bbmaracasvisuAxeVolume.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,AxeVolume)
+BBTK_BLACK_BOX_IMPLEMENTATION(AxeVolume,bbtk::AtomicBlackBox);
+void AxeVolume::Process()
+{
+ if ( mimage!=NULL )
+ {
+ mimage->Delete();
+ }
+
+ int ext[6];
+ bbGetInputIn()->GetExtent(ext);
+ int sizeX=ext[1]-ext[0];
+ int sizeY=ext[3]-ext[2];
+ int sizeZ=ext[5]-ext[4];
+
+ mimage = vtkImageData::New();
+ mimage->SetDimensions(sizeX,sizeY,sizeZ);
+ mimage->SetOrigin(0,0,0);
+ mimage->SetExtent( 0 , sizeX-1 , 0 , sizeY-1 , 0, sizeZ-1 );
+ mimage->SetWholeExtent( 0 , sizeX-1 , 0 , sizeY-1 , 0, sizeZ-1 );
+ mimage->SetScalarTypeToUnsignedShort();
+ mimage->AllocateScalars();
+
+
+ int i,j,k;
+ int sizeLstPointR = bbGetInputlstPointR().size();
+ int iAxe,sizeAxe=bbGetInputlstPointX().size();
+ double rx,ry,rz;
+ double r,rr;
+ unsigned short *p;
+ int sizeImage = sizeX*sizeY*sizeZ;
+ double px,py,pz,px1,py1,pz1,px2,py2,pz2;
+
+ // Clean image
+ p = (unsigned short*)mimage->GetScalarPointer (0, 0, 0);
+ for ( i=0 ; i<sizeImage ; i++)
+ {
+ *p = 0;
+ p++;
+ }
+
+ for (iAxe=0 ; iAxe<sizeAxe; iAxe++)
+ {
+ if (sizeLstPointR<iAxe)
+ {
+ r = bbGetInputlstPointR()[ bbGetInputlstPointR().size() ];
+ } else {
+ r = bbGetInputlstPointR()[ iAxe ];
+ }
+ px = bbGetInputlstPointX()[iAxe];
+ py = bbGetInputlstPointY()[iAxe];
+ pz = bbGetInputlstPointZ()[iAxe];
+ px1 = px - r;
+ py1 = py - r;
+ pz1 = pz - r;
+ px2 = px + r;
+ py2 = py + r;
+ pz2 = pz + r;
+
+ for ( i=px1 ; i<=px2 ; i++ )
+ {
+ for ( j=py1 ; j<py2 ; j++ )
+ {
+ for ( k=pz1 ; k<pz2 ; k++ )
+ {
+ if ( (i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) &&(k>=0) && (k<sizeZ) ){
+ rx = i - px;
+ ry = j - py;
+ rz = k - pz;
+ rr = rx*rx + ry*ry + rz*rz;
+ if ( rx*rx + ry*ry + rz*rz <= r*r )
+ {
+ p = (unsigned short*)mimage->GetScalarPointer (i, j, k);
+ *p=255;
+ }
+ } // inside point
+ } //for k
+ } //for j
+ } //for i
+ } // for iAxe
+ bbSetOutputOut( mimage );
+}
+
+
+
+
+void AxeVolume::bbUserConstructor()
+{
+ mimage = NULL;
+}
+void AxeVolume::bbUserCopyConstructor()
+{
+
+}
+void AxeVolume::bbUserDestructor()
+{
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+#ifndef __bbcreaMaracasVisuAxeVolume_h_INCLUDED__
+#define __bbcreaMaracasVisuAxeVolume_h_INCLUDED__
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class /*BBTK_EXPORT*/ AxeVolume
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(AxeVolume,bbtk::AtomicBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor();
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+ BBTK_DECLARE_INPUT( In , vtkImageData * );
+ BBTK_DECLARE_INPUT( lstPointX , std::vector<double> );
+ BBTK_DECLARE_INPUT( lstPointY , std::vector<double> );
+ BBTK_DECLARE_INPUT( lstPointZ , std::vector<double> );
+ BBTK_DECLARE_INPUT( lstPointR , std::vector<double> );
+ BBTK_DECLARE_OUTPUT(Out,vtkImageData *);
+ BBTK_PROCESS(Process);
+ void Process();
+
+private:
+ vtkImageData *mimage;
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(AxeVolume,bbtk::AtomicBlackBox);
+ BBTK_NAME("AxeVolume");
+ BBTK_AUTHOR("eduardo.davila@hotmail.com");
+ BBTK_DESCRIPTION("Axe Volume");
+ BBTK_CATEGORY("__CATEGORY__");
+ BBTK_INPUT(AxeVolume,In,"Size image X",vtkImageData*,"");
+ BBTK_INPUT(AxeVolume,lstPointX,"List of X values", std::vector<double> ,"");
+ BBTK_INPUT(AxeVolume,lstPointY,"List of Y values", std::vector<double> ,"");
+ BBTK_INPUT(AxeVolume,lstPointZ,"List of Z values", std::vector<double> ,"");
+ BBTK_INPUT(AxeVolume,lstPointR,"List of Radius", std::vector<double> ,"");
+ BBTK_OUTPUT(AxeVolume,Out,"Result image",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(AxeVolume);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuAxeVolume_h_INCLUDED__
+
--- /dev/null
+#include "bbmaracasvisuDrawAxe3D.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+
+#include "vtkImageData.h"
+#include "vtkActor.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkPoints.h"
+#include "vtkCellArray.h"
+#include "vtkProperty.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();
+
+// vtkImageData* img = bbGetInputImage();
+ unsigned int i;
+ double spc[3];
+// img->GetSpacing(spc);
+ spc[0]=1;
+ spc[1]=1;
+ spc[2]=1;
+
+ if(!vectx.empty()&&!vecty.empty()&&!vectz.empty()){
+ vtkPoints* allPoints = vtkPoints::New( );
+ vtkCellArray* allTopology = vtkCellArray::New( );
+ allTopology->InsertNextCell( vectx.size() );
+
+ 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
+ allPoints->InsertNextPoint( vectx[i]*spc[0], vecty[i]*spc[1], vectz[i]*spc[2] );
+ allTopology->InsertCellPoint( i );
+ } // rof
+ mallData->SetPoints( allPoints );
+ mallData->SetLines( allTopology );
+ allPoints->Delete();
+ allTopology->Delete();
+ }
+
+ mvtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
+ bbGetInputColour()[1],
+ bbGetInputColour()[2] );
+
+
+ // Interface Update
+ if ((firsttime==true) && (bbGetInputRenderer()!=NULL ))
+ {
+ firsttime=false;
+ bbGetInputRenderer()->AddActor( mvtkactor );
+ }
+
+}
+
+void DrawAxe3D::bbUserConstructor()
+{
+ firsttime = true;
+ mallData = vtkPolyData::New( );
+ vtkPolyDataMapper* polydatamapper = vtkPolyDataMapper::New();
+ mvtkactor = vtkActor::New();
+ polydatamapper->SetInput(mallData);
+ mvtkactor->SetMapper(polydatamapper);
+ bbSetOutputOut(mvtkactor);
+
+ std::vector<double> colour;
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ colour.push_back(0.0);
+ bbSetInputColour(colour);
+}
+
+void DrawAxe3D::bbUserCopyConstructor()
+{
+}
+void DrawAxe3D::bbUserDestructor()
+{
+}
+
+}
+
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+#ifndef __bbcreaMaracasVisuDrawAxe3D_h_INCLUDED__
+#define __bbcreaMaracasVisuDrawAxe3D_h_INCLUDED__
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+
+#include "vtkRenderer.h"
+#include "vtkPolyData.h"
+
+
+namespace bbcreaMaracasVisu
+{
+
+class /*BBTK_EXPORT*/ DrawAxe3D
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(DrawAxe3D,bbtk::AtomicBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor();
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+ BBTK_DECLARE_INPUT(lstPointX,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstPointY,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstPointZ,std::vector<double>);
+ BBTK_DECLARE_INPUT(Colour,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out,vtkProp3D *);
+
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ private:
+ bool firsttime;
+ vtkPolyData *mallData;
+ vtkActor *mvtkactor;
+};
+
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(DrawAxe3D,bbtk::AtomicBlackBox);
+BBTK_NAME("DrawAxe3D");
+BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
+BBTK_DESCRIPTION("Draw a 3D axe in a vtk 3D Viewer");
+BBTK_CATEGORY("__CATEGORY__");
+ BBTK_INPUT(DrawAxe3D,Renderer,"vtk Renderer 3D universe",vtkRenderer*,"");
+ BBTK_INPUT(DrawAxe3D,lstPointX,"list of point X",std::vector<double>,"");
+ BBTK_INPUT(DrawAxe3D,lstPointY,"list of point Y",std::vector<double>,"");
+ BBTK_INPUT(DrawAxe3D,lstPointZ,"list of point Z",std::vector<double>,"");
+ BBTK_INPUT(DrawAxe3D,Colour,"Color of the line R(0..1) G(0..1) B(0..1) ",std::vector<double>,"colour");
+ BBTK_OUTPUT(DrawAxe3D,Out,"Actor",vtkProp3D*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(DrawAxe3D);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuDrawAxe3D_h_INCLUDED__
+
--- /dev/null
+#include "bbmaracasvisuDrawAxisTree3D.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,DrawAxisTree3D)
+BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxisTree3D,bbtk::AtomicBlackBox);
+
+
+
+void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis)
+{
+ vtkPolyData *polydata = vtkPolyData::New( );
+ vtkPolyDataMapper *polydatamapper = vtkPolyDataMapper::New();
+ vtkActor *vtkactor = vtkActor::New();
+
+ polydatamapper->SetInput(polydata);
+ vtkactor->SetMapper(polydatamapper);
+
+ vecVtkPolyData.push_back( polydata );
+ vecVtkPolyDataMaper.push_back( polydatamapper );
+ vecVtkActors.push_back( vtkactor );
+
+// vtkImageData* img = bbGetInputImage();
+ unsigned int i,size;
+ double spc[3];
+// img->GetSpacing(spc);
+ spc[0]=1;
+ spc[1]=1;
+ spc[2]=1;
+
+ if(!bbGetInputlstPointX().empty()){
+ vtkPoints* allPoints = vtkPoints::New( );
+ vtkCellArray* allTopology = vtkCellArray::New( );
+ allTopology->InsertNextCell( numPoints );
+
+ size=iGeneral+numPoints;
+ for (i=iGeneral;i<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
+ allPoints->InsertNextPoint( bbGetInputlstPointX()[i]*spc[0],
+ bbGetInputlstPointY()[i]*spc[1],
+ bbGetInputlstPointZ()[i]*spc[2] );
+ allTopology->InsertCellPoint( i-iGeneral );
+ } // rof
+ polydata->SetPoints( allPoints );
+ polydata->SetLines( allTopology );
+ allPoints->Delete();
+ allTopology->Delete();
+ }
+
+ // color
+ double r,g,b;
+
+ if ( (iAxis*3+1) < bbGetInputColour().size() ){
+ r = bbGetInputColour()[0+iAxis*3];
+ g = bbGetInputColour()[1+iAxis*3];
+ b = bbGetInputColour()[2+iAxis*3];
+ } else {
+ r = bbGetInputColour()[0];
+ g = bbGetInputColour()[1];
+ b = bbGetInputColour()[2];
+ }
+
+ vtkactor->GetProperty()->SetColor( 1,0,0 );
+ vtkactor->GetProperty()->SetLineWidth( 3 );
+
+ // Interface Update
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->AddActor( vtkactor );
+ }
+}
+
+
+void DrawAxisTree3D::Process()
+{
+ int iActor,sizeActors = vecVtkActors.size();
+ for (iActor=0 ; iActor<sizeActors; iActor++)
+ {
+ if (bbGetInputRenderer()!=NULL )
+ {
+ bbGetInputRenderer()->RemoveActor( vecVtkActors[iActor] );
+ vecVtkPolyData[iActor]->Delete();
+ vecVtkPolyDataMaper[iActor]->Delete();
+ vecVtkActors[iActor]->Delete();
+ }
+ }
+ vecVtkPolyData.clear();
+ vecVtkPolyDataMaper.clear();
+ vecVtkActors.clear();
+
+
+ int iGeneral=0;
+ int iAxis,sizeLstAxis=bbGetInputlstIndexs().size();
+ int numPoints;
+ for ( iAxis=0 ; iAxis<sizeLstAxis ; iAxis++)
+ {
+ numPoints = bbGetInputlstIndexs()[iAxis];
+ DrawOneAxis(iGeneral,numPoints,iAxis);
+ iGeneral = iGeneral+numPoints;
+ }
+
+
+ bbSetOutputOutAxis( vecVtkActors[ bbGetInputiAxis() ] );
+
+}
+
+void DrawAxisTree3D::bbUserConstructor()
+{
+ bbSetInputiAxis(0);
+ std::vector<double> colour;
+ // 1- red
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ colour.push_back(0.0);
+ // 2- blue
+ colour.push_back(0.0);
+ colour.push_back(0.0);
+ colour.push_back(1.0);
+ // 3- yellow
+ colour.push_back(1.0);
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ // 4- green
+ colour.push_back(0.0);
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ // 5-
+ colour.push_back(0.0);
+ colour.push_back(1.0);
+ colour.push_back(1.0);
+
+ // 6-
+ colour.push_back(0.5);
+ colour.push_back(0.5);
+ colour.push_back(0.5);
+
+ bbSetInputColour(colour);
+
+}
+
+void DrawAxisTree3D::bbUserCopyConstructor()
+{
+}
+
+void DrawAxisTree3D::bbUserDestructor()
+{
+}
+
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+#ifndef __bbcreaMaracasVisuDrawAxisTree3D_h_INCLUDED__
+#define __bbcreaMaracasVisuDrawAxisTree3D_h_INCLUDED__
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vtkProp3D.h>
+#include <vtkRenderer.h>
+#include "vtkImageData.h"
+#include "vtkActor.h"
+#include "vtkPolyData.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkPoints.h"
+#include "vtkCellArray.h"
+#include "vtkProperty.h"
+
+
+
+namespace bbcreaMaracasVisu
+{
+
+class /*BBTK_EXPORT*/ DrawAxisTree3D
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(DrawAxisTree3D,bbtk::AtomicBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor();
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+ BBTK_DECLARE_INPUT(Renderer ,vtkRenderer*);
+ BBTK_DECLARE_INPUT(lstIndexs,std::vector<int>);
+ BBTK_DECLARE_INPUT(lstPointX,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstPointY,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstPointZ,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstRadio ,std::vector<double>);
+ BBTK_DECLARE_INPUT(Colour ,std::vector<double>);
+ BBTK_DECLARE_INPUT(iAxis, int );
+ BBTK_DECLARE_OUTPUT(OutAxis,vtkProp3D *);
+ BBTK_PROCESS(Process);
+ void Process();
+
+private:
+
+ std::vector<vtkPolyData*> vecVtkPolyData;
+ std::vector<vtkPolyDataMapper*> vecVtkPolyDataMaper;
+ std::vector<vtkActor*> vecVtkActors;
+
+ void DrawOneAxis(int iGeneral,int numPoints, int iAxis);
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(DrawAxisTree3D,bbtk::AtomicBlackBox);
+BBTK_NAME("DrawAxisTree3D");
+BBTK_AUTHOR("InfoTeam CREATIS-LRMN");
+BBTK_DESCRIPTION("Draw Axis Tree 3D");
+BBTK_CATEGORY("__CATEGORY__");
+BBTK_INPUT(DrawAxisTree3D,Renderer,"Renderer",vtkRenderer*,"");
+BBTK_INPUT(DrawAxisTree3D,lstIndexs,"Indexs",std::vector<int>,"");
+BBTK_INPUT(DrawAxisTree3D,lstPointX,"lstPointX",std::vector<double>,"");
+BBTK_INPUT(DrawAxisTree3D,lstPointY,"lstPointY",std::vector<double>,"");
+BBTK_INPUT(DrawAxisTree3D,lstPointZ,"lstPointZ",std::vector<double>,"");
+BBTK_INPUT(DrawAxisTree3D,lstRadio,"lstRadio",std::vector<double>,"");
+BBTK_INPUT(DrawAxisTree3D,Colour,"Colour",std::vector<double>,"");
+BBTK_INPUT(DrawAxisTree3D,iAxis,"iAxis",int,"");
+BBTK_OUTPUT(DrawAxisTree3D,OutAxis,"Axis[iAxis]",vtkProp3D *,"");
+BBTK_END_DESCRIBE_BLACK_BOX(DrawAxisTree3D);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuDrawAxisTree3D_h_INCLUDED__
+
--- /dev/null
+#include "bbmaracasvisuShowNPoints.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include "vtkProperty.h"
+#include "vtkSphereSource.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkRenderWindow.h"
+
+namespace bbcreaMaracasVisu
+{
+
+
+//----------------------------------------------------------------------
+ WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, vtkRenderer *renderer, ShowNPoints *box)
+ : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
+ {
+ mbbShowNPoints = box;
+ this->renderer = renderer;
+ wxPanel *panel = this;
+ wxSizer *sizer = NULL;
+
+
+ // Widget interface
+ wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add Point"));
+ wxButton *btnEraseLstPoint = new wxButton( panel, -1, _T("Erase Last point"));
+ wxButton *btnDeleteAllPoints= new wxButton( panel, -1, _T("Delete all points"));
+
+
+ wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
+// sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+
+ Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
+ Connect(btnEraseLstPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
+ Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
+
+ sizer1->Add(btnAddPoint);
+ sizer1->Add(btnEraseLstPoint);
+ sizer1->Add(btnDeleteAllPoints);
+
+ sizer = sizer1;
+ panel -> SetSizer(sizer);
+ panel -> SetAutoLayout(true);
+ panel -> Layout();
+
+}
+
+
+//------------------------------------------------------------------------
+WidgetShowNPoints::~WidgetShowNPoints()
+{
+}
+
+void WidgetShowNPoints::SetRadio(double radio)
+{
+ mradio=radio;
+}
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstPointsX()
+{
+ return lstPointsX;
+}
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstPointsY()
+{
+ return lstPointsY;
+}
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstPointsZ()
+{
+ return lstPointsZ;
+}
+
+
+
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::SetPoint(std::vector<int> ppoint)
+{
+ mpoint = ppoint;
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::SetColour(std::vector<double> colour)
+{
+ this->mcolour = colour;
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::SetOpacity(double opacity)
+{
+ this->mopacity=opacity;
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::SetImage(vtkImageData *image)
+{
+ this->mimage=image;
+}
+
+
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
+{
+// printf("EED %p WidgetShowNPoints::OnAddPoint %d,%d,%d \n", this,mpoint[0],mpoint[1],mpoint[2] );
+
+ if (mpoint.size()==3){
+ lstPointsX.push_back( mpoint[0] );
+ lstPointsY.push_back( mpoint[1] );
+ lstPointsZ.push_back( mpoint[2] );
+
+ // Sphere
+ vtkSphereSource *vtksphere = vtkSphereSource::New();
+ vtksphere->SetThetaResolution (20);
+ vtksphere->SetPhiResolution (20);
+ vtksphere->SetRadius( mradio );
+ vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
+ sphereMapper->SetInput( vtksphere->GetOutput() );
+ vtkActor *sphereActor = vtkActor::New();
+ sphereActor->SetMapper(sphereMapper);
+ sphereActor->SetOrigin(0, 0, 0);
+ double spc[3];
+ mimage->GetSpacing(spc);
+ sphereActor->SetPosition( spc[0]*mpoint[0] , spc[1]*mpoint[1] , spc[2]*mpoint[2] );
+ sphereActor->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
+ sphereActor->GetProperty()->SetOpacity( mopacity );
+
+ lstActors.push_back(sphereActor);
+ renderer->AddActor( sphereActor );
+
+ renderer->GetRenderWindow()->Render();
+
+ //--BBTK
+ mbbShowNPoints->bbSetModifiedStatus();
+ mbbShowNPoints->bbSignalOutputModification("Point");
+
+ }
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
+{
+ int id = lstActors.size()-1;
+ if (id>=0){
+ renderer->RemoveActor( lstActors[id] );
+ lstActors.erase( lstActors.begin()+id );
+ lstPointsX.erase( lstPointsX.begin()+id );
+ lstPointsY.erase( lstPointsY.begin()+id );
+ lstPointsZ.erase( lstPointsZ.begin()+id );
+ renderer->GetRenderWindow()->Render();
+ //--BBTK
+ mbbShowNPoints->bbSetModifiedStatus();
+ mbbShowNPoints->bbSignalOutputModification("Point");
+ }
+
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
+{
+ int i,size=lstActors.size();
+ for (i=0;i<size;i++)
+ {
+ renderer->RemoveActor( lstActors[i] );
+ }
+ lstActors.clear();
+ lstPointsX.clear();
+ lstPointsY.clear();
+ lstPointsZ.clear();
+ renderer->GetRenderWindow()->Render();
+ //--BBTK
+ mbbShowNPoints->bbSetModifiedStatus();
+ mbbShowNPoints->bbSignalOutputModification("Point");
+}
+
+
+
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints)
+BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints,bbtk::WxBlackBox);
+
+void ShowNPoints::Process()
+{
+ mwxwidget->SetPoint( bbGetInputIn() );
+ mwxwidget->SetImage( bbGetInputImage() );
+ mwxwidget->SetColour( bbGetInputColour() );
+ mwxwidget->SetOpacity( bbGetInputOpacity() );
+ mwxwidget->SetRadio( bbGetInputRadio() );
+
+ bbSetOutputlstPointsX( mwxwidget->GetLstPointsX() );
+ bbSetOutputlstPointsY( mwxwidget->GetLstPointsY() );
+ bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ() );
+}
+
+
+void ShowNPoints::CreateWidget()
+{
+ mwxwidget = new WidgetShowNPoints( bbGetWxParent() , bbGetInputRenderer(), this);
+ mwxwidget->SetPoint( bbGetInputIn() );
+
+ if (bbGetInputImage()==NULL)
+ {
+ printf("Missing Image (ShowNPoints) \n");
+ }
+
+ bbSetOutputWidget( mwxwidget );
+ Process();
+}
+
+void ShowNPoints::bbUserConstructor()
+{
+ std::vector<double> colour;
+ colour.push_back(1.0);
+ colour.push_back(0.0);
+ colour.push_back(0.0);
+ bbSetInputColour(colour);
+ bbSetInputOpacity(1);
+ bbSetInputImage(NULL);
+ bbSetInputRadio(0.5);
+}
+
+
+void ShowNPoints::bbUserCopyConstructor()
+{
+}
+
+void ShowNPoints::bbUserDestructor()
+{
+}
+
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
+#define __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
+#include "bbtkWxBlackBox.h"
+
+
+#include "vtkActor.h"
+#include "vtkImageData.h"
+#include "vtkRenderer.h"
+
+namespace bbcreaMaracasVisu
+{
+
+ class ShowNPoints;
+
+ //--------------------------------------------------------------------------
+ class WidgetShowNPoints : public wxPanel
+ {
+ public:
+ WidgetShowNPoints( wxWindow *parent, vtkRenderer *renderer, ShowNPoints *box);
+ ~WidgetShowNPoints();
+ void OnAddPoint(wxCommandEvent &event);
+ void OnErasePoint(wxCommandEvent &event);
+ void OnDeleteAllPoints(wxCommandEvent &event);
+ void SetPoint(std::vector<int> ppoint);
+ void SetColour(std::vector<double> colour);
+ void SetOpacity(double opacity);
+ void SetRadio(double radio);
+ void SetImage(vtkImageData *image);
+ std::vector<int> GetLstPointsX();
+ std::vector<int> GetLstPointsY();
+ std::vector<int> GetLstPointsZ();
+
+ private:
+ ShowNPoints *mbbShowNPoints;
+ vtkRenderer *renderer;
+ std::vector<int> lstPointsX;
+ std::vector<int> lstPointsY;
+ std::vector<int> lstPointsZ;
+ std::vector<vtkActor*> lstActors;
+
+ std::vector<int> mpoint;
+ vtkImageData *mimage;
+ std::vector<double> mcolour;
+ double mopacity;
+ double mradio;
+ };
+
+
+
+class /*BBTK_EXPORT*/ ShowNPoints
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ShowNPoints,bbtk::WxBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor();
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+ BBTK_DECLARE_INPUT(In, std::vector<int> );
+ BBTK_DECLARE_INPUT(Renderer, vtkRenderer* );
+ BBTK_DECLARE_INPUT(Image, vtkImageData* );
+ BBTK_DECLARE_INPUT(Colour, std::vector<double> );
+ BBTK_DECLARE_INPUT(Opacity, double );
+ BBTK_DECLARE_INPUT(Radio, double );
+ BBTK_DECLARE_OUTPUT( lstPointsX, std::vector<int> );
+ BBTK_DECLARE_OUTPUT( lstPointsY, std::vector<int> );
+ BBTK_DECLARE_OUTPUT( lstPointsZ, std::vector<int> );
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget();
+
+private:
+ WidgetShowNPoints *mwxwidget;
+
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
+BBTK_NAME("ShowNPoints");
+BBTK_AUTHOR("Eduardo DAVILA");
+BBTK_DESCRIPTION("widget that shows N moints in 3D (vtkActors)");
+BBTK_CATEGORY("widgetVtk");
+BBTK_INPUT(ShowNPoints,In,"One Point",std::vector<int>,"");
+BBTK_INPUT(ShowNPoints,Renderer,"Renderer",vtkRenderer*,"");
+BBTK_INPUT(ShowNPoints,Image,"vktkImageData",vtkImageData*,"");
+BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector<double>,"colour");
+BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor",double,"");
+BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres",double,"");
+BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
+BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
+BBTK_OUTPUT(ShowNPoints , lstPointsZ , " list of points Z ", std::vector<int> ,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuShowNPoints_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
mbbtkSliderMinMax = bbParent;
modBarRange->PushEventHandler(this);
Connect(modBarRange->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onBarrange );
+// Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onActualChange_Bar );
Connect(modBarRange->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onActualChange_Bar );
- Connect(modBarRange->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onStartChange_Bar );
+ Connect(modBarRange->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onStartChange_Bar );
Connect(modBarRange->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onEndChange_Bar );
Connect(modBarRange->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onSelectionEnd );
Connect(modBarRange->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onMovedBar );
}
void wxWidgetSliderMinMaxVOI :: onActualChange_Bar(wxCommandEvent& event)
{
+std::cout << "wxWidgetSliderMinMaxVOI ::onActualChange_Bar" << std::endl;
wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)mcontourtool->GetWxVtkBaseView();
wxvtk2dbaseview->GetVtkBaseData()->SetZ(modBarRange->GetActual());
wxvtk2dbaseview->Refresh();
}
void wxWidgetSliderMinMaxVOI :: onStartChange_Bar(wxCommandEvent& event)
{
+std::cout << "wxWidgetSliderMinMaxVOI ::onStartChange_Bar" << std::endl;
wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)mcontourtool->GetWxVtkBaseView();
wxvtk2dbaseview->GetVtkBaseData()->SetZ(modBarRange->GetStart());
wxvtk2dbaseview->Refresh();
}
void wxWidgetSliderMinMaxVOI :: onEndChange_Bar(wxCommandEvent& event)
{
+std::cout << "wxWidgetSliderMinMaxVOI ::onEndChange_Bar" << std::endl;
wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)mcontourtool->GetWxVtkBaseView();
wxvtk2dbaseview->GetVtkBaseData()->SetZ(modBarRange->GetEnd());
wxvtk2dbaseview->Refresh();
#include "mBarRange.h"
+//const wxEventType wxEVT_TSBAR = wxNewEventType();
+
DEFINE_EVENT_TYPE(wxEVT_TSBAR)
DEFINE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL)
DEFINE_EVENT_TYPE(wxEVT_TSBAR_START)
DEFINE_EVENT_TYPE(wxEVT_TSBAR_MOVED)
DEFINE_EVENT_TYPE(wxEVT_SELECTION_END)
+
+
//----------------------------------------------------------------------------
//EVENT TABLE
//----------------------------------------------------------------------------
//-------------------------------------------
// Sending the event of start triangle moved
//-------------------------------------------
- createAndSendEvent( wxEVT_TSBAR_START );
+ createAndSendEvent( wxEVT_TSBAR_START );
}
//start has to be less than actual
else if (validPos_StartTri && _in_rangeProperty)
//-------------------------------------------
// Sending the event of start triangle moved
//-------------------------------------------
- createAndSendEvent( wxEVT_TSBAR_START );
+ createAndSendEvent( wxEVT_TSBAR_START );
}
}
} // _selectionMoveId == 1
//Sending the event of actual triangle moved
//-------------------------------------------
createAndSendEvent( wxEVT_TSBAR_ACTUAL );
-printf("EED mBarRange::OnMouseMove \n");
+// createAndSendEvent( 98765 );
+printf("EED mBarRange::OnMouseMove XXXXXXX \n");
+
}
else if( validPos_ActualTri && _in_rangeProperty )
// the tringle in between start and end
return withActualDrawed;
}
- void mBarRange :: createAndSendEvent(WXTYPE theEventType)
+ void mBarRange::createAndSendEvent(WXTYPE theEventType)
{
wxCommandEvent cevent( theEventType, GetId() );
cevent.SetEventObject( this );
//DECLARING THE NEW EVENT
//wxEVT_TSBAR= event of the two side bar
//----------------------------------------------------------------------------
+
BEGIN_DECLARE_EVENT_TYPES()
- DECLARE_EVENT_TYPE(wxEVT_TSBAR, -1)
- DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL, -1)
- DECLARE_EVENT_TYPE(wxEVT_TSBAR_START, -1)
- DECLARE_EVENT_TYPE(wxEVT_TSBAR_END, -1)
- DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED, -1)
- DECLARE_EVENT_TYPE(wxEVT_SELECTION_END, -1)
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR,-1)
+//DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL,-1)
+//DECLARE_EXPORTED_EVENT_TYPE(MARACASVISULIB_EXPORTS,wxEVT_TSBAR_ACTUAL,-1)
+extern MARACASVISULIB_EXPORTS const wxEventType wxEVT_TSBAR_ACTUAL;
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR_START,-1)
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR_END,-1)
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED,-1)
+ DECLARE_EVENT_TYPE(wxEVT_SELECTION_END,-1)
END_DECLARE_EVENT_TYPES()
+
+
//-------------------------------------------------------------------------------------------------------------
// Enum declarations
//-------------------------------------------------------------------------------------------------------------
For convenience mpLayer defines a name, a font (wxFont), and a pen (wxPen)
as class members. These may or may not be used by implementations.
*/
-class mpLayer : public wxObject
+class MARACASVISULIB_EXPORTS mpLayer : public wxObject
{
public:
mpLayer();
//----------------------------------------------------------------------------
// Class definition
//----------------------------------------------------------------------------
-class pPlotterLayer: public mpLayer
+class MARACASVISULIB_EXPORTS pPlotterLayer: public mpLayer
{
public:
Program: wxMaracas
Module: $RCSfile: marTypes.h,v $
Language: C++
- Date: $Date: 2008/11/24 10:47:12 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/11/25 15:59:44 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
#ifdef creaMaracasVisu_BUILD_SHARED
#define MARACASVISULIB_EXPORTS __declspec( dllexport )
#else
- #define MARACASVISULIB_EXPORTS //__declspec( dllimport )
+ #define MARACASVISULIB_EXPORTS __declspec( dllimport )
#endif //maracasvisulib_EXPORTS
#else
#define MARACASVISULIB_EXPORTS