if(surrend != NULL){
vtkRenderer* renderer = bbGetInputRenderer();
+ vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
surrend->setRenderer(renderer);
+ surrend->setInteractor(interactor);
vtkImageData* prop3D;
tempvect.push_back(bbGetInputIn0());
tempvect.push_back(bbGetInputIn1());
bbSetInputIn3(NULL);
bbSetInputIn4(NULL);
bbSetInputRenderer(NULL);
+ bbSetInputInteractor(NULL);
bbSetOutputWidget(NULL);
bbSetOutputOut1(NULL);
bbSetOutputOut2(NULL);
#define __bbcreaMaracasVisuSurfaceRendering_h_INCLUDED__
#include "bbcreaMaracasVisu_EXPORT.h"
#include "bbtkWxBlackBox.h"
+#include "vtkRenderWindowInteractor.h"
#include "vtkImageData.h"
#include "vtkProp3D.h"
BBTK_BLACK_BOX_INTERFACE(SurfaceRendering,bbtk::WxBlackBox);
//BBTK_DECLARE_INPUT(In,vtkImageData*);
BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+ BBTK_DECLARE_INPUT(Interactor,vtkRenderWindowInteractor*);
BBTK_DECLARE_INPUT(In0,vtkImageData*);
BBTK_DECLARE_INPUT(In1,vtkImageData*);
BBTK_DECLARE_INPUT(In2,vtkImageData*);
BBTK_DECLARE_INPUT(In3,vtkImageData*);
BBTK_DECLARE_INPUT(In4,vtkImageData*);
+
BBTK_DECLARE_OUTPUT(Out1,vtkImageData*);
BBTK_DECLARE_OUTPUT(Out2,vtkImageData*);
BBTK_DECLARE_OUTPUT(Out3,vtkImageData*);
BBTK_CATEGORY("__CategoryBlackBox__");
//BBTK_INPUT(SurfaceRendering,In,"Renderer to show the different prop3D",vtkImageData*,"");
BBTK_INPUT(SurfaceRendering,Renderer,"Renderer to show the different prop3D",vtkRenderer*,"");
+BBTK_INPUT(SurfaceRendering,Interactor,"Renderer to show the different prop3D",vtkRenderWindowInteractor*,"");
BBTK_INPUT(SurfaceRendering,In0,"Input image to the SurfaceRendering",vtkImageData*,"");
BBTK_INPUT(SurfaceRendering,In1,"Input image to the SurfaceRendering",vtkImageData*,"");
BBTK_INPUT(SurfaceRendering,In2,"Input image to the SurfaceRendering",vtkImageData*,"");
<ComboBoxItem>
<TransferenceFunction>
<Transferencepoint>
- <greyValue>0.0701324</greyValue>
+ <greyValue>0</greyValue>
<intensity>1</intensity>
</Transferencepoint>
<Transferencepoint>
- <greyValue>0.491417</greyValue>
+ <greyValue>0.5</greyValue>
<intensity>1</intensity>
</Transferencepoint>
<Transferencepoint>
- <greyValue>0.888426</greyValue>
+ <greyValue>1</greyValue>
<intensity>1</intensity>
</Transferencepoint>
</TransferenceFunction>
<Colors>
<greyValueRGBpoint>
- <RGBgreyValue>0.00465915</RGBgreyValue>
+ <RGBgreyValue>0</RGBgreyValue>
<red>1</red>
<green>1</green>
<blue>1</blue>
</greyValueRGBpoint>
<greyValueRGBpoint>
- <RGBgreyValue>0.997548</RGBgreyValue>
+ <RGBgreyValue>1</RGBgreyValue>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </greyValueRGBpoint>
+ </Colors>
+ </ComboBoxItem>
+ <ComboBoxItem>
+ <TransferenceFunction>
+ <Transferencepoint>
+ <greyValue>0</greyValue>
+ <intensity></intensity>
+ </Transferencepoint>
+ <Transferencepoint>
+ <greyValue>1</greyValue>
+ <intensity>1</intensity>
+ </Transferencepoint>
+ </TransferenceFunction>
+ <Colors>
+ <greyValueRGBpoint>
+ <RGBgreyValue>0</RGBgreyValue>
<red>0</red>
<green>0</green>
<blue>0</blue>
</greyValueRGBpoint>
+ <greyValueRGBpoint>
+ <RGBgreyValue>1</RGBgreyValue>
+ <red>1</red>
+ <green>1</green>
+ <blue>1</blue>
+ </greyValueRGBpoint>
</Colors>
</ComboBoxItem>
</ComboBoxData>
Program: wxMaracas
Module: $RCSfile: wxMaracasSurfaceRendering.cxx,v $
Language: C++
- Date: $Date: 2009/11/13 09:34:10 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2009/11/13 11:47:41 $
+ Version: $Revision: 1.6 $
Copyright: (c) 2002, 2003
License:
surrendmanager->setRenderer(renderer);
}
+void wxMaracasSurfaceRendering::setInteractor(vtkRenderWindowInteractor* interactor){
+ surrendmanager->setInteractor(interactor);
+}
+
void wxMaracasSurfaceRendering::addRemoveActor(int propid, bool addremove){
try{
surrendmanager->addRemoveActor(propid, addremove);
delete diag;
}
}
+void wxMaracasSurfaceRendering::addRemoveSurfaceBox(int propid, bool addremove){
+ try{
+ surrendmanager->addRemoveSurfaceBox(propid, addremove);
+ }
+ catch(char* str){
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ delete diag;
+ }
+}
+
void wxMaracasSurfaceRendering::changeOpacity(int _propid, int value){
try{
{
loadPropMHD(pathfile,filename);
}
- //else if(filename.EndsWith(stl)){
- //loadProp3D(pathfile,filename);
- //}
+ else if(filename.EndsWith(stl)){
+ loadProp3D(pathfile,filename);
+ }
}
delete fildial;
}
Program: wxMaracas
Module: $RCSfile: wxMaracasSurfaceRendering.h,v $
Language: C++
- Date: $Date: 2009/11/13 09:34:10 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/11/13 11:47:41 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
void setRenderer(vtkRenderer* renderer);
+ void setInteractor(vtkRenderWindowInteractor* interactor);
+
void changeOpacity(int propid, int value);
void changeIsoValue(int propid, double value);
void addRemoveActor(int propid, bool addremove);
+ void addRemoveSurfaceBox(int propid, bool addremove);
+
void changeColor(int propid, double red, double green, double blue);
void addProp3D(vtkProp3D* prop3D, std::string dataname="");
Program: wxMaracas
Module: $RCSfile: wxMaracasSurfaceRenderingManager.cxx,v $
Language: C++
- Date: $Date: 2009/11/13 09:34:10 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/11/13 11:47:41 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
**/
wxMaracasSurfaceRenderingManager::wxMaracasSurfaceRenderingManager(){
_renderer = NULL;
+ _interactor = NULL;
_idCount=0;
}
wxMaracasSurfaceRenderingManager::~wxMaracasSurfaceRenderingManager(){
_renderer = renderer;
}
+/**
+** Sets the renderer to manage the prop3D from the surface render
+**/
+void wxMaracasSurfaceRenderingManager::setInteractor(vtkRenderWindowInteractor* interactor){
+ _interactor = interactor;
+}
+
+
/**
** Gets the renderer to manage the prop3D from the surface render
**/
int wxMaracasSurfaceRenderingManager::addProp3D(vtkProp3D* prop3D, std::string dataname) throw(char*){
checkInvariant();
if(prop3D != NULL){
- wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerData(prop3D, dataname);
+ wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerData(prop3D, dataname, _interactor);
prop3Dvect.push_back(data);
_renderer->AddActor(data->getProp3D());
data->setId(_idCount);
checkInvariant();
if(imagedata != NULL){
image = imagedata;
- wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerDataMhd(imagedata, dataname);
+ wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerDataMhd(imagedata, dataname, _interactor);
prop3Dvect.push_back(data);
_renderer->AddActor(data->getProp3D());
data->setId(_idCount);
_renderer->Render();
}
}
+/**
+** adds or removes the surface box depending of the bool value
+**/
+void wxMaracasSurfaceRenderingManager::addRemoveSurfaceBox(int propid, bool addremove) throw(char*){
+ checkInvariant();
+
+ wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
+ if(data->getProp3D()!=NULL){
+ data->addRemoveSurfaceBox(addremove);
+ /*if(addremove){
+ data->
+ _renderer->AddViewProp(data->getProp3D());
+ }else{
+ _renderer->RemoveViewProp(data->getProp3D());
+ }
+ _renderer->Render();*/
+ }
+
+}
+
/**
** Changes the opacity in a prop3D
**/
Program: wxMaracas
Module: $RCSfile: wxMaracasSurfaceRenderingManager.h,v $
Language: C++
- Date: $Date: 2009/11/09 19:14:56 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/11/13 11:47:41 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
**/
void addRemoveActor(int propid, bool addremove)throw(char*);
/**
+ **
+ **/
+ void addRemoveSurfaceBox(int propid, bool addremove) throw(char*);
+ /**
** Check if the variables are setted correctly
**/
+
void checkInvariant()throw(char*);
/**
**/
wxMaracasSurfaceRenderingManagerData* getViewData(int id)throw(char*);
+ /**
+ **
+ **/
+ void setInteractor(vtkRenderWindowInteractor* interactor);
+
/**
** Given the id, return the max iso value from the imagedata
**/
std::vector<wxMaracasSurfaceRenderingManagerData*> prop3Dvect;
vtkRenderer* _renderer;
+ vtkRenderWindowInteractor* _interactor;
vtkImageData* image;
int _idCount;
** Start of data viewmanagerData
*********************************************************************************************/
-wxMaracasSurfaceRenderingManagerData::wxMaracasSurfaceRenderingManagerData(vtkProp3D* prop3Dvect, std::string dataname){
+wxMaracasSurfaceRenderingManagerData::wxMaracasSurfaceRenderingManagerData(vtkProp3D* prop3Dvect, std::string dataname, vtkRenderWindowInteractor* interactor){
_prop3D = prop3Dvect;
- _dataname = dataname;
+ _dataname = dataname;
+
+
+ initializeBoxWidget(interactor);
+
+
+
+ /*_boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) );
+ _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(1) );
+ _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(2) );
+ _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(3) );*/
}
_prop3D->Delete();
}
+void wxMaracasSurfaceRenderingManagerData::initializeBoxWidget(vtkRenderWindowInteractor* interactor){
+ if(interactor!= NULL){
+ _boxWidgetS1 = vtkBoxWidget::New();
+ _boxWidgetS1->SetInteractor( interactor );
+ _boxWidgetS1->SetPlaceFactor(1.25);
+
+ //_boxWidgetS1->SetInput( );
+ _boxWidgetS1->PlaceWidget();
+ //_boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverS(i) );
+ _boxWidgetS1->HandlesOn ();
+ _boxWidgetS1->Off();
+ }
+}
+
/**
** Adds a prop3D to the world of the application
**/
_prop3D = prop3D;
}
+void wxMaracasSurfaceRenderingManagerData::addRemoveSurfaceBox(bool visible)
+{
+ if(_boxWidgetS1){
+ if (visible==true){
+ _boxWidgetS1->On();
+ } else {
+ _boxWidgetS1->Off();
+ }
+ }
+}
/**
** Changes the opacity in a prop3D
**/
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkProperty.h"
+#include "vtkBoxWidget.h"
class wxMaracasSurfaceRenderingManagerData {
public:
- wxMaracasSurfaceRenderingManagerData(vtkProp3D* _prop3Dvect, std::string dataname="");
+ wxMaracasSurfaceRenderingManagerData(vtkProp3D* _prop3Dvect, std::string dataname="", vtkRenderWindowInteractor* interactor=NULL);
~wxMaracasSurfaceRenderingManagerData();
/**
**/
void changeColor(double red, double green, double blue);
+ /**
+ ** adds or removes the surface box
+ **/
+ void addRemoveSurfaceBox(bool visible);
+
+ void initializeBoxWidget(vtkRenderWindowInteractor* interactor);
protected:
/**
* Prop 3D (data actor)
**/
std::string _dataname;
-
+ /**
+ **
+ **/
+ vtkBoxWidget* _boxWidgetS1;
private:
/*
int _id;
+
+
};
#endif /*WXMARACASSURFACERENDERINGMANAGERDATA_H_*/
#include "wxMaracasSurfaceRenderingManagerDataMhd.h"
-wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname)
-: wxMaracasSurfaceRenderingManagerData(NULL, dataname)
+wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname, vtkRenderWindowInteractor* interactor)
+: wxMaracasSurfaceRenderingManagerData(NULL, dataname, interactor)
{
this->setVtkImageData(imagedata);
_dataMapper->ImmediateModeRenderingOn();
dataActor->SetMapper(_dataMapper);
+ if(_boxWidgetS1){
+ _boxWidgetS1->SetInput(imagedata);
+ }
+
this->_prop3D = dataActor;
this->changeIsoValue(this->_maxgreylevel);
public:
- wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname="");
+ wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname="", vtkRenderWindowInteractor* interactor=0);
~wxMaracasSurfaceRenderingManagerDataMhd();
if(!isComplexBox)
{
- wxString choices[2];
- choices[0] = wxString(_T("On"));
- choices[1] = wxString(_T("Off"));
+ //wxString choices[2];
+ //choices[0] = wxString(_T("On"));
+ //choices[1] = wxString(_T("Off"));
+ wxFlexGridSizer* checkboxsizer = new wxFlexGridSizer(2);
+
checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange);
checkbox->SetValue(true);
+ checkboxsizer->Add(checkbox,wxFIXED_MINSIZE);
+
+ checkboxsurface = new wxCheckBox(this,-1,wxString(_T("Surface Box")));
+ Connect(checkboxsurface->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxSurfaceChange);
+ checkboxsurface->SetValue(true);
+ checkboxsizer->Add(checkboxsurface,wxFIXED_MINSIZE);
+
- sizersurfprop->Add(checkbox,wxFIXED_MINSIZE);
+ sizersurfprop->Add(checkboxsizer,wxFIXED_MINSIZE);
}
//this->addControl(checkbox);
//if(!isComplexBox)
wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
}
+void wxMaracasSurfaceRenderingProp3D::onCheckBoxSurfaceChange(wxCommandEvent& event){
+ //if(!isComplexBox)
+ wxMaracasSurfaceRendering::getInstance()->addRemoveSurfaceBox(this->getPropId(), checkboxsurface->GetValue());
+}
/**
**
virtual void createControls();
void onOpacityRelease(wxScrollEvent& event);
void onCheckBoxChange(wxCommandEvent& event);
+ void onCheckBoxSurfaceChange(wxCommandEvent& event);
void onColorChange(wxCommandEvent& event);
void onViewImage(wxCommandEvent& event);
private:
wxCheckBox* checkbox;
+ wxCheckBox* checkboxsurface;
wxSlider* opacity;
wxBitmapButton* _colorchoose;
wxBitmapButton* _viewimage;