--- /dev/null
+#include "bbcreaMaracasVisuSTL.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+
+#include "wxSTLWidget_03.h"
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,STL)
+BBTK_BLACK_BOX_IMPLEMENTATION(STL,bbtk::WxBlackBox);
+void STL::Process()
+{
+
+
+ vtkImageData* img = bbGetInputIn();
+ if(img != NULL){
+ ((wxSTLWidget_03*)bbGetOutputWidget())->setImage(img);
+ // mar->_experiment->initExperiment(img);
+ }
+
+}
+void STL::CreateWidget(wxWindow* parent)
+{
+
+
+ //mar = new marInterface();
+
+ wxWindow* stl = new wxSTLWidget_03(parent);//, mar);
+ bbSetOutputWidget( stl );
+ //Process();
+
+}
+void STL::bbUserConstructor()
+{
+
+ bbSetInputIn(NULL);
+
+}
+void STL::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
+{
+
+
+
+}
+void STL::bbUserDestructor()
+{
+
+
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuSTL_h_INCLUDED__
+#define __bbcreaMaracasVisuSTL_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+#include "vtkImageData.h"
+
+//#include "marInterface.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT STL
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(STL,bbtk::WxBlackBox);
+//==================================================================
+/// User callback called in the box contructor
+virtual void bbUserConstructor();
+/// User callback called in the box copy constructor
+virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer);
+/// User callback called in the box destructor
+virtual void bbUserDestructor();
+//==================================================================
+ BBTK_DECLARE_INPUT(In,vtkImageData*);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+
+private:
+ //marInterface* mar;
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(STL,bbtk::WxBlackBox);
+BBTK_NAME("STL");
+BBTK_AUTHOR("car-prie@uniandes.edu.co");
+BBTK_DESCRIPTION("BB of the module STL in Maracas");
+BBTK_CATEGORY("__CategoryBlackBox__");
+BBTK_INPUT(STL,In,"Image to the STL",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(STL);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuSTL_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
{
wxPanel *panel = this;
- mcontourvoiwidget = new ContourVOIWidget( panel, wxvtkbaseview, imagedata );
+ if(wxvtkbaseview!=NULL&&imagedata!=NULL){
+
+ setBaseView(wxvtkbaseview);
+ setImageData(imagedata);
+ initializeVOIWidget();
+
+ }
+
+
+ }
+
+ wxWidgetVOI::setBaseView(wxVtkBaseView * wxvtkbaseview){
+ this->wxvtkbaseview = wxvtkbaseview;
+ }
+ wxWidgetVOI::setImageData(vtkImageData * imagedata){
+ this->imagedata = imagedata;
+ }
+
+ wxWidgetVOI::initializeVOIWidget(){
+ mcontourvoiwidget = new ContourVOIWidget( this, wxvtkbaseview, imagedata );
mcontourvoiwidget->ConfigureVTK();
// wxwidget = new wxMPRWidget2( panel, marimagedata , 1 );
wxFlexGridSizer *sizer=new wxFlexGridSizer(1);
sizer -> Add( mcontourvoiwidget,1,wxGROW );
sizer -> AddGrowableCol(0);
- panel -> SetSizer(sizer);
- panel -> SetAutoLayout(true);
- panel -> Layout();
+ this -> SetSizer(sizer);
+ this -> SetAutoLayout(true);
+ this -> Layout();
+ this->Refresh();
}
//--------------------------------------------------------------------------
wxWidgetVOI::~wxWidgetVOI()
//------------------------------------------------------
void ContourVOI::Process()
{
+
+ /*if (bbGetInputwxVtkBaseView()==NULL)
+ {
+ wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'wxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
+ }
+ if (bbGetInputIn()==NULL)
+ {
+ wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'In' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
+ }*/
+
+
+ vtkImageData* img = bbGetInputIn();
+ wxVtkBaseView* base = bbGetInputwxVtkBaseView();
+
wxWidgetVOI* wxwidgetvoi = (wxWidgetVOI*)bbGetOutputWidget();
+
+ if(base !=NULL && img != NULL && _img != img && _base != base){
+
+ _img = img;
+ _base = base;
+
+ wxwidgetvoi->setBaseView(base);
+ wxwidgetvoi->setImageData(img);
+ wxwidgetvoi->initializeVOIWidget();
+ }
+
+
if (wxwidgetvoi!=NULL){
ContourVOIWidget* contourvoiwidget = wxwidgetvoi->GetContourVOIWidget();
-
+
int voi[6];
contourvoiwidget->GetVOI(voi);
char buffer[40];
sprintf(buffer,"%d %d %d ", voi[1]-voi[0]+1, voi[3]-voi[2]+1, voi[5]-voi[4]+1 );
std::string Size(buffer);
+ std::cout<<"ContourVOI index "<<Index<<" size "<<Size<<std::endl;
+
bbSetOutputIndex( Index );
bbSetOutputSize( Size );
- } //wxwidgetvoi
+ }
+
}
//------------------------------------------------------
void ContourVOI::CreateWidget(wxWindow* parent)
{
bbtkDebugMessageInc("Core",9,"ContourVOI::CreateWidget()"<<std::endl);
-
- if (bbGetInputwxVtkBaseView()==NULL)
- {
- wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'wxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
- }
- if (bbGetInputIn()==NULL)
- {
- wxMessageDialog(NULL, bbtk::std2wx("(ContourVOI) Input 'In' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
- }
-
- wxWidgetVOI *mwxwidget = new wxWidgetVOI( parent, bbGetInputwxVtkBaseView(), bbGetInputIn() );
-
+ wxWidgetVOI *mwxwidget = new wxWidgetVOI( parent );
bbSetOutputWidget(mwxwidget);
bbtkDebugDecTab("Core",9);
+ this->bbSignalOutputModification();
+
+ //Process();
}
//------------------------------------------------------
void ContourVOI::bbUserConstructor()
{
+
+ _img = NULL;
+ _base = NULL;
+ bbSetInputwxVtkBaseView(NULL);
+ bbSetInputIn(NULL);
+ bbSetOutputWidget(NULL);
+
}
//------------------------------------------------------
void ContourVOI::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
{
+ _img = NULL;
+ _base = NULL;
+
}
//------------------------------------------------------
class wxWidgetVOI : public wxPanel
{
public:
- wxWidgetVOI(wxWindow* parent, wxVtkBaseView *wxvtkbaseview, vtkImageData *imagedata);
+ wxWidgetVOI(wxWindow* parent, wxVtkBaseView *wxvtkbaseview=NULL, vtkImageData *imagedata=NULL);
~wxWidgetVOI();
//if the MPR had generated the refresh event
ContourVOIWidget* GetContourVOIWidget();
+ setBaseView(wxVtkBaseView * wxvtkbaseview);
+ setImageData(vtkImageData * imagedata);
+
+ initializeVOIWidget();
+
private:
// ContourVOI *mbbViewerMPR;
ContourVOIWidget *mcontourvoiwidget;
+ wxVtkBaseView * wxvtkbaseview;
+ vtkImageData * imagedata;
+
+
+
DECLARE_EVENT_TABLE( );
};
BBTK_CREATE_WIDGET(CreateWidget);
void CreateWidget(wxWindow*);
+private:
+ vtkImageData* _img;
+ wxVtkBaseView* _base;
+
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ContourVOI,bbtk::WxBlackBox);
BBTK_BLACK_BOX_IMPLEMENTATION(ImageChangeInformation,bbtk::AtomicBlackBox);
void ImageChangeInformation::Process()
{
- int ext[6];
- bbGetInputIn()->GetExtent( ext );
- if (mchange!=NULL) { mchange->Delete(); }
- mchange = vtkImageChangeInformation::New();
- mchange->SetInput( bbGetInputIn() );
- mchange->SetExtentTranslation( -ext[0], -ext[2], -ext[4] );
- mchange->Update(); //important
+ int ext[6];
+ vtkImageData* img = bbGetInputIn();
+ if(img!=NULL){
+ img->GetExtent( ext );
+ if (mchange!=NULL) { mchange->Delete(); }
+ mchange = vtkImageChangeInformation::New();
+ mchange->SetInput( img );
+ mchange->SetExtentTranslation( -ext[0], -ext[2], -ext[4] );
+ mchange->Update(); //important
+
+ bbSetOutputOut( mchange->GetOutput() );
+ }
- bbSetOutputOut( mchange->GetOutput() );
}
void ImageChangeInformation::bbUserConstructor()
{
mchange=NULL;
+ bbSetOutputOut( NULL);
+ bbSetInputIn(NULL);
}
void ImageChangeInformation::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
{
-
+ mchange=NULL;
}
void ImageChangeInformation::bbUserDestructor()
{
wxPanel *panel = this;
mbbViewerMPR = box;
+
wxwidget = new wxMPRWidget2( panel, marimagedata , 1 );
- wxwidget->ConfigureVTK();
+
+ if(marimagedata != NULL){
+ wxwidget->ConfigureVTK();
+ }
wxFlexGridSizer *sizer=new wxFlexGridSizer(1);
sizer -> Add( wxwidget,0,wxGROW );
sizer -> AddGrowableCol(1);
panel -> SetAutoLayout(true);
panel -> Layout();
}
+
+ void wxWidgetMPR::setMarImage(marImageData* marimagedata){
+ wxwidget->setMarImage(marimagedata, 1);
+
+
+ }
+ void wxWidgetMPR::ConfigureVTK(){
+ wxwidget->ConfigureVTK();
+ }
//--------------------------------------------------------------------------
wxWidgetMPR::~wxWidgetMPR()
{
void ViewerMPR::Process()
{
if (wxwidget!=NULL){
+ if(marimagedata==NULL){
+ wxwidget->setMarImage(new marImageData(bbGetInputIn() ));
+ wxwidget->ConfigureVTK();
+ }
wxBusyCursor wait;
bbSetOutputPoint( wxwidget->GetPoint() );
bbSetOutputRenderer( wxwidget->GetRenderer() );
void ViewerMPR::CreateWidget(wxWindow* parent)
{
bbtkDebugMessageInc("Core",9,"ViewerMPR::CreateWidget() " <<std::endl);
- marImageData *marimagedata = new marImageData(bbGetInputIn() );
+ //JCP 10 - 03 - 09 marImageData *marimagedata = new marImageData(bbGetInputIn() );
bbtkDebugDecTab("Core",9);
- wxwidget = new wxWidgetMPR(this , parent ,marimagedata);
+ wxwidget = new wxWidgetMPR(this , parent);//JCP 10 - 03 - 09,marimagedata);
bbSetOutputWidget( wxwidget );
}
void ViewerMPR::bbUserConstructor()
{
+ marimagedata = NULL;
wxwidget = NULL;
bbSetInputIn(NULL);
}
void ViewerMPR::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
{
+ marimagedata = NULL;
+ wxwidget = NULL;
+ bbSetInputIn(NULL);
+
}
void ViewerMPR::bbUserDestructor()
{
class wxWidgetMPR : public wxPanel
{
public:
- wxWidgetMPR(ViewerMPR* box,wxWindow* parent, marImageData *marimagedata);
+ wxWidgetMPR(ViewerMPR* box,wxWindow* parent, marImageData *marimagedata=NULL);
~wxWidgetMPR();
//if the MPR had generated the refresh event
//refreshView
void Refresh();
+
+ void setMarImage(marImageData* marimagedata);
+ void ConfigureVTK();
private:
-
+
ViewerMPR *mbbViewerMPR;
wxMPRWidget2 *wxwidget;
std::vector<int> point;
private:
wxWidgetMPR *wxwidget;
+ marImageData *marimagedata;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ViewerMPR,bbtk::WxBlackBox);
BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox);
//-------------------------------------------------------------
void ViewerNV::Process()
-{
- if (mwxwidget != NULL)
- {
+{
+
+ vtkImageData* img = bbGetInputIn();
+ std::vector<int> type = bbGetInputnTypeView();
+
+ if(img != NULL && mwxwidget != NULL){// && !enter){
+
+ if(!compareVectors(type, currenttype)){
+ mwxwidget->SetType(&type);
+ mwxwidget->UpdateLayout(img);
+ }else if (img != currentimg){
+ mwxwidget->SetImage(img);
+ }
+ currenttype = type;
+ currentimg = img;
+
+
point.clear();
point.push_back((int)mwxwidget->GetX());
point.push_back((int)mwxwidget->GetY());
bbSetOutputPoint(point);
// WxBlackBox::Process();
- mwxwidget->SetImage( bbGetInputIn() );
+// mwxwidget->SetImage(img );
wxVtkBaseView *wvbv1 = mwxwidget->GetwxVtkBaseView(1);
wxVtkBaseView *wvbv2 = mwxwidget->GetwxVtkBaseView(2);
wxVtkBaseView *wvbv3 = mwxwidget->GetwxVtkBaseView(3);
if (wvbv2!=NULL) { bbSetOutputRenderer2( wvbv2->GetRenderer() ); }
if (wvbv3!=NULL) { bbSetOutputRenderer3( wvbv3->GetRenderer() ); }
if (wvbv4!=NULL) { bbSetOutputRenderer4( wvbv4->GetRenderer() ); }
- } // mwxwidget
+ }
}
//-------------------------------------------------------------
void ViewerNV::CreateWidget(wxWindow* parent)
{
- bbtkDebugMessageInc("Core",9,"ViewerNV::CreateWidget()"<<std::endl);
- mwxwidget = new bbwxMaracas_N_ViewersWidget( this, parent , bbGetInputIn() , &(bbGetInputnTypeView()) );
- bbtkDebugDecTab("Core",9);
- bbSetOutputWidget( mwxwidget );
+ bbtkDebugMessageInc("Core",9,"ViewerNV::CreateWidget()"<<std::endl);
+ mwxwidget = new bbwxMaracas_N_ViewersWidget( this, parent );
+ bbtkDebugDecTab("Core",9);
+ bbSetOutputWidget( mwxwidget );
+
+
+ this->bbSignalOutputModification();
+ //Process();
}
//-------------------------------------------------------------
void ViewerNV::bbUserConstructor()
{
+
mwxwidget = NULL;
bbSetInputIn(NULL);
//-------------------------------------------------------------
void ViewerNV::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
{
+
+ mwxwidget = NULL;
+
}
//-------------------------------------------------------------
void ViewerNV::bbUserDestructor()
{
+std::cout << "ViewerNV destroy "<<this<<" vs "<<GetThisPointer<void>()<<std::endl;
+
+}
+
+bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype){
+
+ bool ret = true;
+
+ if(type.size()==currenttype.size()){
+ for(int i = 0; i < type.size() && ret; i++){
+ if(type[i]!=currenttype[i]){
+ ret = false;
+ }
+ }
+ }else{
+ ret=false;
+ }
+ return ret;
+
+
}
}
class bbwxMaracas_N_ViewersWidget : public wxMaracas_N_ViewersWidget
{
public:
- bbwxMaracas_N_ViewersWidget(ViewerNV* box,wxWindow *parent, vtkImageData* imagedata, std::vector<int> *nTypeView);
+ bbwxMaracas_N_ViewersWidget(ViewerNV* box,wxWindow *parent, vtkImageData* imagedata=NULL, std::vector<int> *nTypeView=NULL);
~bbwxMaracas_N_ViewersWidget();
//if the MPR had generated the refresh event
BBTK_CREATE_WIDGET(CreateWidget);
void CreateWidget(wxWindow* parent);
-private:
- wxMaracas_N_ViewersWidget *mwxwidget;
+private:
+ bool enter;
std::vector<int> point;
+ vtkImageData* currentimg;
+ std::vector<int> currenttype;
+ wxMaracas_N_ViewersWidget *mwxwidget;
+
+ bool compareVectors(std::vector<int> type,std::vector<int> currenttype);
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ViewerNV,bbtk::WxBlackBox);