--- /dev/null
+#include "bbcreaMaracasVisuRenderingViewer.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include "wxMaracasRendererView.h"
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,RenderingViewer)
+BBTK_BLACK_BOX_IMPLEMENTATION(RenderingViewer,bbtk::WxBlackBox);
+void RenderingViewer::Process()
+{
+
+ wxMaracasRendererView* view = (wxMaracasRendererView*)bbGetOutputWidget();
+ vtkImageData* _img1 = bbGetInputIn1();
+ vtkImageData* _img2 = bbGetInputIn2();
+ vtkImageData* _img3 = bbGetInputIn3();
+ vtkImageData* _img4 = bbGetInputIn4();
+ vtkRenderer* renderer = bbGetInputRenderer();
+
+ if(view!=NULL)
+ {
+ if(renderer!=NULL&&_currentrenderer != renderer)
+ {
+ view->setRenderer(renderer);
+ _currentrenderer = renderer;
+ }
+ if(_currentrenderer!=NULL)
+ {
+ if(_img1 !=NULL)
+ {
+ view->addVolume(_img1, "INPUT 1");
+ }
+ if(_img2 !=NULL)
+ {
+ view->addVolume(_img2, "INPUT 2");
+ }
+ if(_img3 !=NULL)
+ {
+ view->addVolume(_img3, "INPUT 3");
+ }
+ if(_img4 !=NULL)
+ {
+ view->addVolume(_img4, "INPUT 4");
+ }
+ }
+ }
+
+}
+void RenderingViewer::CreateWidget(wxWindow* parent)
+{
+ wxMaracasRendererView* surrend = wxMaracasRendererView::getInstance(parent);
+ bbSetOutputWidget(surrend);
+
+}
+void RenderingViewer::bbUserSetDefaultValues()
+{
+ bbSetInputIn1(NULL);
+ bbSetInputIn2(NULL);
+ bbSetInputIn3(NULL);
+ bbSetInputIn4(NULL);
+ bbSetInputRenderer(NULL);
+ bbSetOutputWidget(NULL);
+ bbSetOutputOut1(NULL);
+ bbSetOutputOut2(NULL);
+ bbSetOutputOut3(NULL);
+ bbSetOutputOut4(NULL);
+}
+void RenderingViewer::bbUserInitializeProcessing()
+{
+
+}
+void RenderingViewer::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuRenderingViewer_h_INCLUDED__
+#define __bbcreaMaracasVisuRenderingViewer_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+#include "vtkImageData.h"
+//#include "vtkRenderer.h"
+#include "vtkProp3D.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT RenderingViewer
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(RenderingViewer,bbtk::WxBlackBox);
+ //BBTK_DECLARE_INPUT(Title,std::string);
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+ 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_DECLARE_OUTPUT(Out4,vtkImageData*);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+
+ private:
+ vtkRenderer* _currentrenderer;
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(RenderingViewer,bbtk::WxBlackBox);
+BBTK_NAME("RenderingViewer");
+BBTK_AUTHOR("Carolina Perez");
+BBTK_DESCRIPTION("Complex box which gathers VolumeRendering and SurfaceRendering funtionalities");
+BBTK_CATEGORY("__CategoryBlackBox__");
+//BBTK_INPUT(RenderingViewer,Title,"Title prepended to the text",std::string,"");
+BBTK_INPUT(RenderingViewer,Renderer,"Renderer to show image" ,vtkRenderer*, "");
+BBTK_INPUT(RenderingViewer,In1,"Input image to the Rendering",vtkImageData*,"");
+BBTK_INPUT(RenderingViewer,In2,"Input image to the Rendering",vtkImageData*,"");
+BBTK_INPUT(RenderingViewer,In3,"Input image to the Rendering",vtkImageData*,"");
+BBTK_INPUT(RenderingViewer,In4,"Input image to the Rendering",vtkImageData*,"");
+BBTK_OUTPUT(RenderingViewer,Out1,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(RenderingViewer,Out2,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(RenderingViewer,Out3,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(RenderingViewer,Out4,"Output resulting image",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(RenderingViewer);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuRenderingViewer_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
--- /dev/null
+#include "bbcreaMaracasVisuSurfaceRendering.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+
+#include "wxMaracasSurfaceRendering.h"
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SurfaceRendering)
+BBTK_BLACK_BOX_IMPLEMENTATION(SurfaceRendering,bbtk::WxBlackBox);
+void SurfaceRendering::Process()
+{
+
+ wxMaracasSurfaceRendering* surrend = wxMaracasSurfaceRendering::getInstance();
+ std::vector<vtkImageData*> tempvect;
+ int i;
+
+ if(surrend != NULL){
+ vtkRenderer* renderer = bbGetInputRenderer();
+ surrend->setRenderer(renderer);
+ vtkImageData* prop3D;
+ tempvect.push_back(bbGetInputIn0());
+ tempvect.push_back(bbGetInputIn1());
+ tempvect.push_back(bbGetInputIn2());
+ tempvect.push_back(bbGetInputIn3());
+ tempvect.push_back(bbGetInputIn4());
+
+ for(i = 0; i < tempvect.size();i++){
+ prop3D = tempvect[i];
+ if(prop3D != NULL&&renderer != NULL){
+ surrend->addPropMHD(prop3D);
+ }
+ }
+ }
+}
+void SurfaceRendering::CreateWidget(wxWindow* parent)
+{
+
+
+ //std::cout << "Your application's directory is: " << path;
+
+ wxMaracasSurfaceRendering* surrend = wxMaracasSurfaceRendering::getInstance(parent);
+ //GetDllDirectory(_MAX_PATH, currentPath);
+ //std::cout << "Your application's directory is: " << GetDllDirectory(_MAX_PATH, currentPath)<<std::endl;
+
+ bbSetOutputWidget(surrend);
+
+}
+
+ //-----------------------------------------------------------------
+ void SurfaceRendering::bbUserSetDefaultValues()
+ {
+ bbSetInputIn0(NULL);
+ bbSetInputIn1(NULL);
+ bbSetInputIn2(NULL);
+ bbSetInputIn3(NULL);
+ bbSetInputIn4(NULL);
+ bbSetInputRenderer(NULL);
+ bbSetOutputWidget(NULL);
+ bbSetOutputOut1(NULL);
+ bbSetOutputOut2(NULL);
+ bbSetOutputOut3(NULL);
+ bbSetOutputOut4(NULL);
+ }
+
+ //-----------------------------------------------------------------
+ void SurfaceRendering::bbUserInitializeProcessing()
+ {
+ }
+
+ //-----------------------------------------------------------------
+ void SurfaceRendering::bbUserFinalizeProcessing()
+ {
+ }
+
+ //-----------------------------------------------------------------
+
+
+
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /dev/null
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuSurfaceRendering_h_INCLUDED__
+#define __bbcreaMaracasVisuSurfaceRendering_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+#include "vtkImageData.h"
+#include "vtkProp3D.h"
+
+//#include "marInterface.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT SurfaceRendering
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(SurfaceRendering,bbtk::WxBlackBox);
+ //BBTK_DECLARE_INPUT(In,vtkImageData*);
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+ 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_DECLARE_OUTPUT(Out4,vtkImageData*);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+
+private:
+ //marInterface* mar;
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(SurfaceRendering,bbtk::WxBlackBox);
+BBTK_NAME("SurfaceRendering");
+BBTK_AUTHOR("car-prie@uniandes.edu.co");
+BBTK_DESCRIPTION("BB of the module SurfaceRendering");
+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,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*,"");
+BBTK_INPUT(SurfaceRendering,In3,"Input image to the SurfaceRendering",vtkImageData*,"");
+BBTK_INPUT(SurfaceRendering,In4,"Input image to the SurfaceRendering",vtkImageData*,"");
+BBTK_OUTPUT(SurfaceRendering,Out1,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(SurfaceRendering,Out2,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(SurfaceRendering,Out3,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(SurfaceRendering,Out4,"Output resulting image",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(SurfaceRendering);
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuSurfaceRendering_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
}
void VolumeRendering::CreateWidget(wxWindow* parent)
{
-
wxMaracasMultipleVolumeRendererView* volview = wxMaracasMultipleVolumeRendererView::getInstance(parent);
bbSetOutputWidget(volview);
-
}
void VolumeRendering::bbUserSetDefaultValues()
{
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
-// Here we initialize the input 'In' to 0
- bbSetInputIn1(0);
- bbSetInputIn2(0);
- bbSetInputIn3(0);
- bbSetInputIn4(0);
- bbSetInputRenderer(0);
+// Here we initialize the input 'In' to 0
+ bbSetInputIn1(0);
+ bbSetInputIn2(0);
+ bbSetInputIn3(0);
+ bbSetInputIn4(0);
+ bbSetInputRenderer(0);
}
void VolumeRendering::bbUserInitializeProcessing()
}
}
-// EO namespace bbcreaMaracasVisu
-
-
+// EO namespace bbcreaMaracasVisu
\ No newline at end of file
BBTK_DECLARE_INPUT(In3,vtkImageData*);
BBTK_DECLARE_INPUT(In4,vtkImageData*);
BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+
+ BBTK_DECLARE_OUTPUT(Out1,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out2,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out3,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out4,vtkImageData*);
/*BBTK_DECLARE_INPUT(GreyLevel, std::vector<double> );
BBTK_INPUT(VolumeRendering,In3,"Image to create the volume rendering",vtkImageData*,"");
BBTK_INPUT(VolumeRendering,In4,"Image to create the volume rendering",vtkImageData*,"");
BBTK_INPUT(VolumeRendering,Renderer,"Image to create the volume rendering",vtkRenderer*,"");
+BBTK_OUTPUT(VolumeRendering,Out1,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(VolumeRendering,Out2,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(VolumeRendering,Out3,"Output resulting image",vtkImageData*,"");
+BBTK_OUTPUT(VolumeRendering,Out4,"Output resulting image",vtkImageData*,"");
//BBTK_OUTPUT(VolumeRendering,Out,"Prop3D resulting from the volume rendering",vtkProp3D*,"");
wxMaracasHelpDialog.h
wxMaracasQuantification.cxx
wxMaracasQuantification.h
- wxMaracasIRMView.cxx
- wxMaracasIRMView.h
+ wxMaracasSurfaceRendering.cxx
+ wxMaracasSurfaceRendering.h
+ wxMaracasRendererView.cxx
+ wxMaracasRendererView.h
+
widgets/wxVTKRenderWindowInteractor.cxx
--- /dev/null
+#include "wxMaracasSurfaceRenderingProp3D.h"
+
+#include <wx/colordlg.h>
+#include "wxMaracasSurfaceRendering.h"
+#include <OpenImage.xpm>
+#include "Color.xpm"
+/**
+** Implementation of SurfaceRenderingProp3D
+**/
+
+wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent,int propid)
+:wxMaracasSurfaceRenderingPanel(parent, propid){
+ createControls();
+}
+
+wxMaracasSurfaceRenderingProp3D::~wxMaracasSurfaceRenderingProp3D(){
+ //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false);
+ wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid);
+}
+
+void wxMaracasSurfaceRenderingProp3D::createControls(){
+
+ wxFlexGridSizer* sizersurrendprop = new wxFlexGridSizer(1,1,1);
+
+ wxString choices[2];
+ choices[0] = wxString(_T("On"));
+ choices[1] = wxString(_T("Off"));
+ checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
+ Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange);
+ checkbox->SetValue(true);
+
+ sizersurrendprop->Add(checkbox,wxFIXED_MINSIZE);
+
+ //this->addControl(checkbox);
+
+ wxBitmap bitmap(Color_xpm);
+ _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
+ Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onColorChange);
+ sizersurrendprop->Add(_colorchoose,wxFIXED_MINSIZE);
+
+ //sizercolor->Add(checkbox,wxFIXED_MINSIZE);
+ //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
+ //this->addControl(sizercolor);
+
+
+ wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity")));
+ opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);
+ Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onOpacityRelease);
+ wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1);
+ sizeropacity->Add(label,wxFIXED_MINSIZE);
+ sizeropacity->Add(opacity,wxFIXED_MINSIZE);
+
+ sizersurrendprop->Add(sizeropacity,wxFIXED_MINSIZE);
+
+ /**wxBitmap bitmap1(OpenImage_xpm);
+ _viewimage = new wxBitmapButton(this, -1, bitmap1, wxDefaultPosition, wxSize(30,30));
+ Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onViewImage);
+ sizersurrendprop->Add(_viewimage,wxFIXED_MINSIZE); */
+
+ //this->addControl(sizeropacity);
+ this->addControl(sizersurrendprop);
+
+}
+void wxMaracasSurfaceRenderingProp3D::onCheckBoxChange(wxCommandEvent& event){
+ wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+}
+void wxMaracasSurfaceRenderingProp3D::onColorChange(wxCommandEvent& event){
+ wxColourDialog* colourdiag = new wxColourDialog(this);
+ if(colourdiag->ShowModal()==wxID_OK){
+ wxColour colour = colourdiag->GetColourData().GetColour();
+ _colorchoose->SetBackgroundColour(colour);
+
+ double r = (double)(colour.Red())/255.0;
+ double g = (double)(colour.Green())/255.0;
+ double b = (double)(colour.Blue())/255.0;
+
+ wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b);
+ }
+ delete colourdiag;
+}
+/*void wxMaracasSurfaceRenderingProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){
+
+}*/
+
+void wxMaracasSurfaceRenderingProp3D::onOpacityRelease(wxScrollEvent& event ){
+
+ wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
+
+}
+
+void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){
+
+ //if(mwxwidget->ShowModal()==wxID_OK){
+
+ // mwxwidget->Show(false);
+ //}
+}
+
#include <wx/colordlg.h>
#include "wxMaracasMultipleVolumeRendererView.h"
+#include <OpenImage.xpm>
#include "Color.xpm"
//#include <vtkImageCast.h>
/**
Connect(mwxwidget->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange);
sizerirmprop->Add(mwxwidget,wxFIXED_MINSIZE);
-
+ //std::string iconsdir = wxMaracasMultipleVolumeRendererView::getInstance()->getPath();
+ //iconsdir+="/data/Icons/Add.xmp";
+ //wxBitmap* bitmap = new wxBitmap(wxString(iconsdir.c_str(),wxConvUTF8), wxBITMAP_TYPE_XPM);
+ wxBitmap bitmap(OpenImage_xpm);
+ _viewimage = new wxBitmapButton(this, -1, bitmap, wxDefaultPosition, wxSize(30,30));
+ Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onViewImage);
+ sizerirmprop->Add(_viewimage,wxFIXED_MINSIZE);
+
this->SetSizer(sizerirmprop, true);
this->SetAutoLayout( true );
-
//_frame = new wxFrame(this, 10, _T("Configure Transfer Functions"));
wxButton* button3 = new wxButton(_frame,40,_T("Update"));
Connect(button3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onUpdate); */
-
-
-
/*mwxwidget->erasePointsTransferenceFunction();
double range[2];
img->GetScalarRange(range);
// mwxwidget->Show(false);
//}
}
+
+void wxMaracasMultipleVolumeRendererPanel::onViewImage(wxCommandEvent& event){
+
+}
void wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange(wxCommandEvent& event){
wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
}
void onOK(wxCommandEvent& event);
void onCancel(wxCommandEvent& event);
void onUpdate(wxCommandEvent& event);
+ void onViewImage(wxCommandEvent& event);
void updateVolume();
int getPropId();
private:
wxCheckBox* checkbox;
- //wxBitmapButton* _colorchoose;
+ wxBitmapButton* _viewimage;
int _propid;
HistogramDialogComboBox* mwxwidget;
//wxFrame* _frame;
-
};
#endif /*wxMaracasMultipleVolumeRendererPanel_H_*/
Program: wxMaracas
Module: $RCSfile: wxMaracasMultipleVolumeRendererView.cxx,v $
Language: C++
- Date: $Date: 2009/07/20 10:06:12 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/10/15 11:56:43 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
std::string iconsdir = path;
iconsdir+="/data/Icons";
this->_toolb = new ToolBarMultipleVolumeRenderer(this,iconsdir);
+ wxStaticText* txt = new wxStaticText(this, -1, wxString(_T(" Volume Rendering ")));
wxAuiPaneInfo paneinfo;
+ wxauimanager->AddPane(txt,paneinfo.ToolbarPane().Top());
wxauimanager->AddPane(_toolb,paneinfo.ToolbarPane().Top());
wxauimanager->Update();
wxAuiPaneInfo paneinfo;
wxauimanager->AddPane(irmview, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s));
wxauimanager->Update();
-
-
}
void wxMaracasMultipleVolumeRendererView::addVolume(vtkImageData* img, std::string dataname){
std::string s = std::string(filename.mb_str());
vtkImageData* img = volmanager->getImageData(s);
+ imgVect.push_back(img);
+
if(img!=NULL){
s = std::string(dataname.mb_str());
addVolume(img, s);
}
-
}
void wxMaracasMultipleVolumeRendererView::deleteVolume(int volid){
- volmanager->deleteActor(volid);
+ //volmanager->deleteActor(volid);
}
void wxMaracasMultipleVolumeRendererView::SetValuesColorPointsFunction(int volid, std::vector<double> greylevelcolors,std::vector<double> red,std::vector<double> green,std::vector<double> blue){
- volmanager->setVolumeColor(volid, greylevelcolors, red, green, blue);
+ //volmanager->setVolumeColor(volid, greylevelcolors, red, green, blue);
}
void wxMaracasMultipleVolumeRendererView::SetValuesPointsFunction(int volid, std::vector<double> greylevel, std::vector<double> values){
- volmanager->setVolumeOpacity(volid, greylevel, values);
+ //volmanager->setVolumeOpacity(volid, greylevel, values);
}
vtkPiecewiseFunction* wxMaracasMultipleVolumeRendererView::GetTransferFunction(int volumeid){
//iconfil+= "/OpenImage.png";
//wxBitmap* bitmap0 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
wxBitmap bitmap0(OpenImage_xpm);
- this->AddTool(1, wxString(_T("test")),bitmap0);
+ this->AddTool(1, wxString(_T("test")),bitmap0, NULL, wxITEM_NORMAL, wxString(_T("Open File")));
/*iconfil+= "/Open.png";
wxBitmap* bitmap2 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
Program: wxMaracas
Module: $RCSfile: wxMaracasMultipleVolumeRendererView.h,v $
Language: C++
- Date: $Date: 2009/07/20 10:06:12 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/10/15 11:56:43 $
+ Version: $Revision: 1.3 $
Copyright: (c) 2002, 2003
License:
wxToolBar* _toolb;
+ std::vector<vtkImageData*> imgVect;
};
class ToolBarEventHandlerMultipleVolumeRenderer : public wxEvtHandler{
--- /dev/null
+#include "wxMaracasRenderTabbedPanel.h"
+
+#include <wx/colordlg.h>
+#include <OpenImage.xpm>
+#include "Color.xpm"
+
+
+/**
+**
+**/
+wxMaracasRenderTabbedPanel::wxMaracasRenderTabbedPanel(wxWindow* parent, wxMaracasMultipleVolumeRendererManager* img1, wxMaracasSurfaceRenderingManager* img2, wxMaracasSurfaceRenderingManager* img3,
+ wxMaracasSurfaceRenderingManager* img4, wxString filename, wxString dataname)
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize)
+{
+ //_propid = propid;
+
+ createControls(img1, img2, img3, img4, filename, dataname);
+}
+
+/**
+**
+**/
+void wxMaracasRenderTabbedPanel::createControls(wxMaracasMultipleVolumeRendererManager* volmanager, wxMaracasSurfaceRenderingManager* surrendmanager1, wxMaracasSurfaceRenderingManager* surrendmanager2,
+ wxMaracasSurfaceRenderingManager* surrendmanager3, wxString filename, wxString dataname)
+{
+ wxPanel* up = new wxPanel(this, wxID_ANY);
+ wxFlexGridSizer* sizerup = new wxFlexGridSizer(2,2,1);
+
+ wxString choices[2];
+ choices[0] = wxString(_T("On"));
+ choices[1] = wxString(_T("Off"));
+ checkboxVol = new wxCheckBox(this,-1,wxString(_T("Volume Rendering")));
+ Connect(checkboxVol->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasRenderTabbedPanel::onCheckBoxVChange);
+ checkboxVol->SetValue(true);
+
+ sizerup->Add(checkboxVol, wxFIXED_MINSIZE);
+
+ //wxString choices[2];
+ //choices[0] = wxString(_T("On"));
+ //choices[1] = wxString(_T("Off"));
+ checkboxSA = new wxCheckBox(this,-1,wxString(_T("Surface Rendering A")));
+ Connect(checkboxSA->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasRenderTabbedPanel::onCheckBoxSAChange);
+ checkboxSA->SetValue(true);
+
+ sizerup->Add(checkboxSA, wxFIXED_MINSIZE);
+
+ //wxString choices[2];
+ //choices[0] = wxString(_T("On"));
+ //choices[1] = wxString(_T("Off"));
+ checkboxSB = new wxCheckBox(this,-1,wxString(_T("Surface Rendering B")));
+ Connect(checkboxSB->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasRenderTabbedPanel::onCheckBoxSBChange);
+ checkboxSB->SetValue(true);
+
+ sizerup->Add(checkboxSB, wxFIXED_MINSIZE);
+
+ //wxString choices[2];
+ //choices[0] = wxString(_T("On"));
+ //choices[1] = wxString(_T("Off"));
+ checkboxSC = new wxCheckBox(this,-1,wxString(_T("Surface Rendering C")));
+ Connect(checkboxSC->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasRenderTabbedPanel::onCheckBoxSCChange);
+ checkboxSC->SetValue(true);
+
+ sizerup->Add(checkboxSC, wxFIXED_MINSIZE);
+
+ up->SetSizer(sizerup, true);
+ up->SetAutoLayout( true );
+
+
+ wxPanel* down = new wxPanel(this, wxID_ANY);
+ down->SetSize(100, 100);
+ wxFlexGridSizer* sizerdown = new wxFlexGridSizer(1,1,1);
+
+ wxtabs = new wxNotebook(this, -1);
+ wxtabs->SetSize(100, 100);
+ //wxtabs->
+ std::string s = std::string(filename.mb_str());
+ vtkImageData* img1 = volmanager->getImageData(s);
+ vtkImageData* img2 = surrendmanager1->getImageData(s);
+ vtkImageData* img3 = surrendmanager2->getImageData(s);
+ vtkImageData* img4 = surrendmanager3->getImageData(s);
+ if(img1!=NULL)
+ {
+ s = std::string(dataname.mb_str());
+ wxMaracasMultipleVolumeRendererPanel* controlpan1 = addVolume(volmanager, img1, s);
+ wxMaracasSurfaceRenderingPanel* controlpan2 = addSurface1(surrendmanager1, img2, s);
+ wxMaracasSurfaceRenderingPanel* controlpan3 = addSurface2(surrendmanager2, img3, s);
+ wxMaracasSurfaceRenderingPanel* controlpan4 = addSurface3(surrendmanager3, img4, s);
+
+ wxtabs->AddPage(controlpan1, _T("Volume Rendering"), true);
+ wxtabs->AddPage(controlpan2, _T("Surf Rend A"));
+ wxtabs->AddPage(controlpan3, _T("Surf Rend B"));
+ wxtabs->AddPage(controlpan4, _T("Surf Rend C"));
+
+ wxtabs->Refresh();
+ sizerdown->Add(wxtabs, wxFIXED_MINSIZE);
+
+ down->SetSizer(sizerdown, true);
+ down->SetAutoLayout( true );
+
+ }
+
+ wxFlexGridSizer* sizerrenderprop = new wxFlexGridSizer(2,1,5);
+ sizerrenderprop->Add(up, wxFIXED_MINSIZE);
+ sizerrenderprop->Add(down, wxFIXED_MINSIZE);
+
+ this->SetSizer(sizerrenderprop, true);
+ this->SetAutoLayout( true );
+
+}
+
+wxMaracasRenderTabbedPanel::~wxMaracasRenderTabbedPanel()
+{
+ //wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
+ //wxMaracasRenderTabbedPanel::getInstance()->deleteVolume(_propid);
+ delete wxtabs;
+ //delete surview1;
+ //delete surview2;
+ //delete surview3;
+}
+
+/*
+*
+*/
+wxMaracasMultipleVolumeRendererPanel* wxMaracasRenderTabbedPanel::addVolume(wxMaracasMultipleVolumeRendererManager* volmanager, vtkImageData* img, std::string dataname)
+{
+
+ try
+ {
+ int id = volmanager->addVolume(img, dataname);
+ if(id!=-1)
+ {
+ wxMaracasMultipleVolumeRendererPanel* controlpan = new wxMaracasMultipleVolumeRendererPanel(wxtabs, id,img);
+ //controlpan->updateVolume();
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+wxMaracasSurfaceRenderingPanel* wxMaracasRenderTabbedPanel::addSurface1(wxMaracasSurfaceRenderingManager* surrendmanager1, vtkImageData* img, std::string dataname)
+{
+ try
+ {
+ int id = surrendmanager1->addPropMHD(img, dataname);
+
+ if(id!=-1)
+ {
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(wxtabs, id);
+ //int maxiso = surrendmanager1->getMaxIsoValue(id);
+ //((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso);
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+wxMaracasSurfaceRenderingPanel* wxMaracasRenderTabbedPanel::addSurface2(wxMaracasSurfaceRenderingManager* surrendmanager2, vtkImageData* img, std::string dataname)
+{
+ try
+ {
+ int id = surrendmanager2->addPropMHD(img, dataname);
+ if(id!=-1)
+ {
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(wxtabs, id);
+ //int maxiso = surrendmanager2->getMaxIsoValue(id);
+ //((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso);
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+wxMaracasSurfaceRenderingPanel* wxMaracasRenderTabbedPanel::addSurface3(wxMaracasSurfaceRenderingManager* surrendmanager3, vtkImageData* img, std::string dataname)
+{
+ try
+ {
+ int id = surrendmanager3->addPropMHD(img, dataname);
+ if(id!=-1)
+ {
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(wxtabs, id);
+ //int maxiso = surrendmanager3->getMaxIsoValue(id);
+ //((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso);
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+void wxMaracasRenderTabbedPanel::onOK(wxCommandEvent& event)
+{
+ updateVolume();
+ //_frame->Show(false);
+}
+
+void wxMaracasRenderTabbedPanel::onCancel(wxCommandEvent& event)
+{
+ //_frame->Show(false);
+}
+
+void wxMaracasRenderTabbedPanel::onUpdate(wxCommandEvent& event)
+{
+ updateVolume();
+}
+
+void wxMaracasRenderTabbedPanel::updateVolume()
+{
+ //std::vector<double> greylevelcolors;
+ //std::vector<double> red;
+ //std::vector<double> green;
+ //std::vector<double> blue;
+
+ //std::vector<double> greylevel;
+ //std::vector<double> values;
+
+ //mwxwidget->GetValuesColorPointsFunction(greylevelcolors, red, green, blue);
+ //mwxwidget->GetValuesPointsFunction(greylevel, values);
+
+
+ //wxMaracasMultipleVolumeRendererView::getInstance()->SetValuesColorPointsFunction(this->_propid, greylevelcolors, red, green, blue);
+ //wxMaracasMultipleVolumeRendererView::getInstance()->SetValuesPointsFunction(this->_propid, greylevel, values);
+
+}
+
+void wxMaracasRenderTabbedPanel::onColorChange(wxCommandEvent& event)
+{
+
+ //if(mwxwidget->ShowModal()==wxID_OK){
+ //updateVolume();
+ // mwxwidget->Show(false);
+ //}
+}
+
+/**
+**
+**/
+void wxMaracasRenderTabbedPanel::onViewImage(wxCommandEvent& event){
+
+}
+
+/**
+**
+**/
+void wxMaracasRenderTabbedPanel::onCheckBoxVChange(wxCommandEvent& event)
+{
+ //wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+}
+
+/**
+**
+**/
+void wxMaracasRenderTabbedPanel::onCheckBoxSAChange(wxCommandEvent& event)
+{
+ //wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+}
+
+/**
+**
+**/
+void wxMaracasRenderTabbedPanel::onCheckBoxSBChange(wxCommandEvent& event)
+{
+ //wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+}
+
+/**
+**
+**/
+void wxMaracasRenderTabbedPanel::onCheckBoxSCChange(wxCommandEvent& event)
+{
+ //wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+}
+
+/**
+**
+**/
+int wxMaracasRenderTabbedPanel::getPropId(){
+ return _propid;
+}
\ No newline at end of file
--- /dev/null
+#ifndef wxMaracasRenderTabbedPanel_H_
+#define wxMaracasRenderTabbedPanel_H_
+
+#include <wx/wx.h>
+#include <wx/notebook.h>
+#include "wxMaracasMultipleVolumeRendererPanel.h"
+#include "wxMaracasSurfaceRenderingPanel.h"
+#include "wxMaracasMultipleVolumeRendererManager.h"
+#include "wxMaracasSurfaceRenderingManager.h"
+#include "wxMaracasSurfaceRenderingProp3DMHD.h"
+
+
+class wxMaracasRenderTabbedPanel : public wxPanel
+{
+
+public:
+ wxMaracasRenderTabbedPanel(wxWindow* parent, wxMaracasMultipleVolumeRendererManager* img1, wxMaracasSurfaceRenderingManager* img2, wxMaracasSurfaceRenderingManager* img3,
+ wxMaracasSurfaceRenderingManager* img4, wxString filename, wxString dataname);
+ ~wxMaracasRenderTabbedPanel();
+ void createControls(wxMaracasMultipleVolumeRendererManager* volmanager, wxMaracasSurfaceRenderingManager* surrendmanager1, wxMaracasSurfaceRenderingManager* surrendmanager2,
+ wxMaracasSurfaceRenderingManager* surrendmanager3, wxString filename, wxString dataname);
+ wxMaracasMultipleVolumeRendererPanel* addVolume(wxMaracasMultipleVolumeRendererManager* volmanager, vtkImageData* img, std::string dataname);
+ wxMaracasSurfaceRenderingPanel* addSurface1(wxMaracasSurfaceRenderingManager* surrendmanager, vtkImageData* img, std::string dataname);
+ wxMaracasSurfaceRenderingPanel* addSurface2(wxMaracasSurfaceRenderingManager* surrendmanager, vtkImageData* img, std::string dataname);
+ wxMaracasSurfaceRenderingPanel* addSurface3(wxMaracasSurfaceRenderingManager* surrendmanager, vtkImageData* img, std::string dataname);
+ void onCheckBoxVChange(wxCommandEvent& event);
+ void onCheckBoxSAChange(wxCommandEvent& event);
+ void onCheckBoxSBChange(wxCommandEvent& event);
+ void onCheckBoxSCChange(wxCommandEvent& event);
+ void onColorChange(wxCommandEvent& event);
+ void onOK(wxCommandEvent& event);
+ void onCancel(wxCommandEvent& event);
+ void onUpdate(wxCommandEvent& event);
+ void onViewImage(wxCommandEvent& event);
+
+ void updateVolume();
+ int getPropId();
+
+private:
+ wxCheckBox* checkboxVol;
+ wxCheckBox* checkboxSA;
+ wxCheckBox* checkboxSB;
+ wxCheckBox* checkboxSC;
+ //wxBitmapButton* _viewimage;
+
+ wxNotebook* wxtabs;
+
+ int _propid;
+
+ bool first;
+
+ //wxMaracasMultipleVolumeRendererPanel* _irmview;
+ //wxMaracasSurfaceRenderingPanel* _surview1;
+ //wxMaracasSurfaceRenderingPanel* _surview2;
+ //wxMaracasSurfaceRenderingPanel* _surview3;
+};
+
+#endif /*wxMaracasMultipleVolumeRendererPanel_H_*/
\ No newline at end of file
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasRendererView.cxx,v $
+ Language: C++
+
+=========================================================================*/
+
+#include "wxMaracasRendererView.h"
+
+#include <wx/colordlg.h>
+#include <wx/bmpbuttn.h>
+
+#include <OpenImage.xpm>
+#include <Color.xpm>
+
+wxMaracasRendererView* wxMaracasRendererView::instance=NULL;
+
+/**
+**
+**/
+wxMaracasRendererView::wxMaracasRendererView(wxWindow* parent,std::string path)
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
+
+ wxauimanager = new wxAuiManager(this);
+
+ _path = path;
+
+ volmanager = new wxMaracasMultipleVolumeRendererManager();
+ surrendmanager1 = new wxMaracasSurfaceRenderingManager();
+ surrendmanager2 = new wxMaracasSurfaceRenderingManager();
+ surrendmanager3 = new wxMaracasSurfaceRenderingManager();
+
+ std::string iconsdir = path;
+ iconsdir+="/data/Icons";
+ this->_toolb = new ToolBarRenderer(this,iconsdir);
+ wxStaticText* txt = new wxStaticText(this, -1, wxString(_T(" Open File ")));
+ wxAuiPaneInfo paneinfo;
+ wxauimanager->AddPane(txt,paneinfo.ToolbarPane().Top());
+ wxauimanager->AddPane(_toolb,paneinfo.ToolbarPane().Top());
+
+ wxauimanager->Update();
+}
+
+/**
+**
+**/
+wxMaracasRendererView::~wxMaracasRendererView( )
+{
+ delete _toolb;
+}
+
+/**
+**
+**/
+std::string wxMaracasRendererView::getPath()
+{
+ return _path;
+}
+
+/**
+**
+**/
+wxMaracasRendererView* wxMaracasRendererView::getInstance(wxWindow* parent,std::string path)
+{
+ if(instance==NULL)
+ {
+ instance = new wxMaracasRendererView(parent,path);
+ }
+ return instance;
+}
+
+/**
+**
+**/
+wxMaracasRendererView* wxMaracasRendererView::getInstance()
+{
+ return instance;
+}
+
+/**
+**
+**/
+void wxMaracasRendererView::setRenderer(vtkRenderer* renderer)
+{
+ volmanager->setRenderer(renderer);
+ surrendmanager1->setRenderer(renderer);
+ surrendmanager2->setRenderer(renderer);
+ surrendmanager3->setRenderer(renderer);
+}
+
+/**
+** Adds or removes a volume rendering actor
+**/
+void wxMaracasRendererView::addRemoveActorVol(int id, bool addremove)
+{
+ volmanager->addRemoveActor(id, addremove);
+}
+
+/**
+** Adds or removes a surface rendering actor
+**/
+void wxMaracasRendererView::addRemoveSurf1Actor(int id, bool addremove)
+{
+ surrendmanager1->addRemoveActor(id, addremove);
+}
+
+/**
+** Adds or removes a surface rendering actor
+**/
+void wxMaracasRendererView::addRemoveSurf2Actor(int id, bool addremove)
+{
+ surrendmanager2->addRemoveActor(id, addremove);
+}
+
+/**
+** Adds or removes a surface rendering actor
+**/
+void wxMaracasRendererView::addRemoveSurf3Actor(int id, bool addremove)
+{
+ surrendmanager3->addRemoveActor(id, addremove);
+}
+
+/**
+**
+**/
+void wxMaracasRendererView::onLoadImageFile()
+{
+ wxString mhd(_T("mhd"));
+
+ wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a MHD file")),wxString(_T("")),
+ wxString(_T("")),wxString(_T("MHD files (*.mhd)|*.mhd")) );
+
+ if(fildial->ShowModal()==wxID_OK)
+ {
+ wxString filename = fildial->GetFilename();
+ wxString pathfile(fildial->GetDirectory() + _T("/") + filename);
+ if(filename.EndsWith(mhd))
+ {
+ loadVolume(pathfile,filename);
+ }
+ }
+ delete fildial;
+}
+
+/*
+*
+*/
+void wxMaracasRendererView::addPanels(wxString filename, wxString dataname)
+{
+ wxString s(dataname.c_str(),wxConvUTF8 );
+
+ wxtabs = new wxMaracasRenderTabbedPanel(this, volmanager, surrendmanager1, surrendmanager2, surrendmanager3, filename, dataname);
+
+ wxAuiPaneInfo paneinfo;
+ wxauimanager->AddPane(wxtabs, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s));
+ wxauimanager->Update();
+}
+
+/*
+*
+*/
+wxMaracasMultipleVolumeRendererPanel* wxMaracasRendererView::addVolume(vtkImageData* img, std::string dataname)
+{
+
+ try
+ {
+ int id = volmanager->addVolume(img, dataname);
+ if(id!=-1)
+ {
+ wxMaracasMultipleVolumeRendererPanel* controlpan = new wxMaracasMultipleVolumeRendererPanel(this, id,img);
+ //controlpan->updateVolume();
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+wxMaracasSurfaceRenderingPanel* wxMaracasRendererView::addSurface1(vtkImageData* img, std::string dataname)
+{
+ try
+ {
+ int id = surrendmanager1->addPropMHD(img, dataname);
+
+ if(id!=-1)
+ {
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(this, id);
+ //int maxiso = surrendmanager1->getMaxIsoValue(id);
+ //((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso);
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+wxMaracasSurfaceRenderingPanel* wxMaracasRendererView::addSurface2(vtkImageData* img, std::string dataname)
+{
+ try
+ {
+ int id = surrendmanager2->addPropMHD(img, dataname);
+ if(id!=-1)
+ {
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(this, id);
+ //int maxiso = surrendmanager2->getMaxIsoValue(id);
+ //((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso);
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+wxMaracasSurfaceRenderingPanel* wxMaracasRendererView::addSurface3(vtkImageData* img, std::string dataname)
+{
+ try
+ {
+ int id = surrendmanager3->addPropMHD(img, dataname);
+ if(id!=-1)
+ {
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(this, id);
+ //int maxiso = surrendmanager3->getMaxIsoValue(id);
+ //((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso);
+
+ return controlpan;
+ }
+ }
+ catch(char* str)
+ {
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
+void wxMaracasRendererView::loadVolume(wxString filename, wxString dataname)
+{
+
+ addPanels(filename, dataname);
+
+}
+
+void wxMaracasRendererView::deleteVolume(int volid)
+{
+ volmanager->deleteActor(volid);
+ surrendmanager1->deleteActor(volid);
+ surrendmanager2->deleteActor(volid);
+ surrendmanager3->deleteActor(volid);
+}
+
+void wxMaracasRendererView::SetValuesColorPointsFunction(int volid, std::vector<double> greylevelcolors,std::vector<double> red,std::vector<double> green,std::vector<double> blue){
+ volmanager->setVolumeColor(volid, greylevelcolors, red, green, blue);
+}
+void wxMaracasRendererView::SetValuesPointsFunction(int volid, std::vector<double> greylevel, std::vector<double> values){
+ volmanager->setVolumeOpacity(volid, greylevel, values);
+}
+
+vtkPiecewiseFunction* wxMaracasRendererView::GetTransferFunction(int volumeid){
+ return volmanager->GetTransferFunction(volumeid);
+}
+vtkColorTransferFunction* wxMaracasRendererView::GetColorFunction(int volumeid){
+ return volmanager->GetColorFunction(volumeid);
+}
+
+/**
+**
+**/
+ToolBarRenderer::ToolBarRenderer(wxWindow * parent,std::string iconsdir)
+: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize)
+{
+ std::string iconfil = iconsdir;
+
+ //iconfil+= "/OpenImage.png";
+ //wxBitmap* bitmap0 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
+ wxBitmap bitmap0(OpenImage_xpm);
+ this->AddTool(1, wxString(_T("test")),bitmap0, NULL, wxITEM_NORMAL, wxString(_T("Open File")));
+
+ /*iconfil+= "/Open.png";
+ wxBitmap* bitmap2 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
+ this->AddTool(2, wxString(_T("test")),*bitmap2); */
+
+ /*iconfil = iconsdir;
+ iconfil+= "/Open.png";
+ wxBitmap* bitmap30 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
+ this->AddTool(30, wxString(_T("test")),*bitmap30);*/
+
+ this->Realize();
+
+ _evthand = new ToolBarEventHandlerRenderer();
+ this->SetEventHandler(_evthand);
+
+}
+
+ToolBarRenderer::~ToolBarRenderer(void){
+}
+
+ToolBarEventHandlerRenderer::ToolBarEventHandlerRenderer()
+: wxEvtHandler(){
+}
+ToolBarEventHandlerRenderer::~ToolBarEventHandlerRenderer(){
+}
+
+void ToolBarEventHandlerRenderer::onLoadImageFile(wxCommandEvent& event){
+ wxMaracasRendererView::getInstance()->onLoadImageFile();
+}
+
+
+BEGIN_EVENT_TABLE(ToolBarEventHandlerRenderer, wxEvtHandler)
+ EVT_MENU(1, ToolBarEventHandlerRenderer::onLoadImageFile)
+END_EVENT_TABLE()
+
+
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasRendererView.h,v $
+ Language: C++
+
+=========================================================================*/
+
+#ifndef __wxMaracasRendererViewPanelH__
+#define __wxMaracasRendererViewPanelH__
+
+#include <vector>
+#include <wx/wx.h>
+#include "wx/aui/aui.h"
+#include <iostream>
+#include "marTypes.h"
+#include "vtkProp3D.h"
+
+#include "wxMaracasRendererView.h"
+#include "wxMaracasRenderTabbedPanel.h"
+#include "wxMaracasMultipleVolumeRendererManager.h"
+#include "wxMaracasMultipleVolumeRendererPanel.h"
+#include "wxMaracasSurfaceRenderingProp3DMHD.h"
+#include "wxMaracasSurfaceRenderingManager.h"
+
+
+class creaMaracasVisu_EXPORT wxMaracasRendererView : public wxPanel
+{
+
+public:
+ wxMaracasRendererView( wxWindow* parent, std::string path);
+ ~wxMaracasRendererView( );
+
+ static wxMaracasRendererView* getInstance(wxWindow* parent,std::string path="");
+
+ static wxMaracasRendererView* getInstance();
+
+ void setRenderer(vtkRenderer* renderer);
+
+ wxMaracasMultipleVolumeRendererPanel* addVolume(vtkImageData* img, std::string dataname="");
+
+ wxMaracasSurfaceRenderingPanel* addSurface1(vtkImageData* img, std::string dataname="");
+
+ wxMaracasSurfaceRenderingPanel* addSurface2(vtkImageData* img, std::string dataname="");
+
+ wxMaracasSurfaceRenderingPanel* addSurface3(vtkImageData* img, std::string dataname="");
+
+ void loadVolume(wxString filename, wxString dataname);
+
+ void onLoadImageFile();
+
+ void addPanels(wxString filename, wxString dataname = "");
+
+ std::string getPath();
+
+ void deleteVolume(int volid);
+
+ void addRemoveActorVol(int id, bool remove);
+ void addRemoveSurf1Actor(int id, bool addremove);
+ void addRemoveSurf2Actor(int id, bool addremove);
+ void addRemoveSurf3Actor(int id, bool addremove);
+
+ void SetValuesColorPointsFunction(int volid, std::vector<double> greylevelcolors,std::vector<double> red,std::vector<double> green,std::vector<double> blue);
+ void SetValuesPointsFunction(int volid, std::vector<double> greylevel, std::vector<double> values);
+
+ void addPanels(wxMaracasMultipleVolumeRendererPanel* irmview, std::string dataname);
+
+ vtkPiecewiseFunction* GetTransferFunction(int volumeid);
+ vtkColorTransferFunction* GetColorFunction(int volumeid);
+
+private:
+ static wxMaracasRendererView* instance;
+
+ wxMaracasMultipleVolumeRendererManager* volmanager;
+
+ wxMaracasSurfaceRenderingManager* surrendmanager1;
+
+ wxMaracasSurfaceRenderingManager* surrendmanager2;
+
+ wxMaracasSurfaceRenderingManager* surrendmanager3;
+
+ wxMaracasRenderTabbedPanel* wxtabs;
+
+ wxAuiManager* wxauimanager;
+
+ std::string _path;
+
+ wxToolBar* _toolb;
+
+};
+
+class ToolBarEventHandlerRenderer : public wxEvtHandler{
+
+ public:
+ ToolBarEventHandlerRenderer();
+ ~ToolBarEventHandlerRenderer();
+
+ void onLoadImageFile(wxCommandEvent& event);
+
+ private:
+
+ DECLARE_EVENT_TABLE()
+ };
+
+class ToolBarRenderer : public wxToolBar{
+
+
+public:
+ ToolBarRenderer(wxWindow * parent,std::string iconsdir);
+ ~ToolBarRenderer(void);
+
+
+private:
+
+ ToolBarEventHandlerRenderer* _evthand;
+
+};
+
+#endif
+
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasSurfaceRendering.cxx,v $
+ Language: C++
+ Date: $Date: 2009/10/15 11:56:43 $
+ Version: $Revision: 1.1 $
+
+ Copyright: (c) 2002, 2003
+ License:
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+
+
+
+// EOF - wxMaracasMPR.cxx
+
+#include "wxMaracasSurfaceRendering.h"
+//#include "wxMaracasSurfaceRenderingPanel.h"
+#include "wxMaracasSurfaceRenderingProp3DMHD.h"
+#include "wxMaracasSurfaceRenderingProp3D.h"
+
+#include <wx/colordlg.h>
+#include <wx/bmpbuttn.h>
+
+#include <OpenImage.xpm>
+#include <Color.xpm>
+
+wxMaracasSurfaceRendering* wxMaracasSurfaceRendering::instance=NULL;
+
+wxMaracasSurfaceRendering::wxMaracasSurfaceRendering( wxWindow* parent,std::string path)
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
+
+ surrendmanager = new wxMaracasSurfaceRenderingManager();
+
+ wxauimanager = new wxAuiManager(this);
+
+ _path = path;
+
+ std::string iconsdir = path;
+ iconsdir+="/data/Icons";
+ this->_toolb = new ToolBar(this,iconsdir);
+ wxStaticText* txt = new wxStaticText(this, -1, wxString(_T(" Surface Rendering ")));
+ wxAuiPaneInfo paneinfo;
+ wxauimanager->AddPane(txt,paneinfo.ToolbarPane().Top());
+ wxauimanager->AddPane(_toolb,paneinfo.ToolbarPane().Top());
+
+ wxauimanager->Update();
+ createFileChooser();
+
+
+}
+wxMaracasSurfaceRendering::~wxMaracasSurfaceRendering( ){
+
+ delete _toolb;
+
+}
+
+std::string wxMaracasSurfaceRendering::getPath(){
+ return _path;
+}
+
+
+
+void wxMaracasSurfaceRendering::createFileChooser(){
+
+}
+
+wxMaracasSurfaceRendering* wxMaracasSurfaceRendering::getInstance(wxWindow* parent,std::string path){
+ if(instance==NULL){
+ instance = new wxMaracasSurfaceRendering(parent,path);
+ }
+ return instance;
+}
+
+wxMaracasSurfaceRendering* wxMaracasSurfaceRendering::getInstance(){
+ return instance;
+}
+
+void wxMaracasSurfaceRendering::setRenderer(vtkRenderer* renderer){
+ surrendmanager->setRenderer(renderer);
+}
+
+void wxMaracasSurfaceRendering::addRemoveActor(int propid, bool addremove){
+ surrendmanager->addRemoveActor(propid, addremove);
+}
+
+void wxMaracasSurfaceRendering::changeOpacity(int _propid, int value){
+ surrendmanager->changeOpacity(_propid,value);
+}
+
+void wxMaracasSurfaceRendering::changeIsoValue(int propid, double value){
+ surrendmanager->changeIsoValue(propid, value);
+}
+
+void wxMaracasSurfaceRendering::changeColor(int propid, double red, double green, double blue){
+ try{
+ surrendmanager->changeColor(propid, red, green, blue);
+
+ }catch(char* str){
+
+ wxString s( str,wxConvUTF8 );
+ wxMessageDialog* diag = new wxMessageDialog(this, s, s, wxICON_ERROR);
+ diag->ShowModal();
+ delete diag;
+
+ }
+}
+
+void wxMaracasSurfaceRendering::onLoadImageFile(){
+
+ wxString mhd(_T("mhd"));
+ wxString stl(_T("stl"));
+
+ wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a STL file")),wxString(_T("")),
+ wxString(_T("")),wxString(_T("STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd")) );
+
+ if(fildial->ShowModal()==wxID_OK){
+ wxString filename = fildial->GetFilename();
+ wxString pathfile(fildial->GetDirectory() + _T("/") + filename);
+
+
+ if(filename.EndsWith(mhd))
+ {
+ loadPropMHD(pathfile,filename);
+ }
+ //else if(filename.EndsWith(stl)){
+ //loadProp3D(pathfile,filename);
+ //}
+ }
+ delete fildial;
+
+}
+void wxMaracasSurfaceRendering::loadPropMHD(wxString filename, wxString dataname){
+
+ std::string s = std::string(filename.mb_str());
+ vtkImageData* img = surrendmanager->getImageData(s);
+ if(img!=NULL){
+ s = std::string(dataname.mb_str());
+ addPropMHD(img, s);
+ }
+
+}
+
+void wxMaracasSurfaceRendering::addPropMHD(vtkImageData* imgdata, std::string dataname){
+ try{
+ int id = surrendmanager->addPropMHD(imgdata,dataname);
+ if(id!=-1){
+
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(this, id);
+ int maxiso = surrendmanager->getMaxIsoValue(id);
+ ((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso);
+ addSurfaceRenderingPanel(controlpan, dataname);
+ }
+
+ }catch(char* str){
+
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString( str,wxConvUTF8 ), wxString( str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+
+ }
+}
+
+void wxMaracasSurfaceRendering::loadProp3D(wxString filename, wxString dataname){
+ std::string s = std::string(filename.mb_str());
+ vtkProp3D* prop3D = surrendmanager->getProp3D(s);
+ if(prop3D != NULL){
+ s = std::string(dataname.mb_str() );
+ this->addProp3D(prop3D,s);
+ }else{
+ //TODO msj to the user indicating error in file
+ }
+
+
+
+}
+
+void wxMaracasSurfaceRendering::addProp3D(vtkProp3D* prop3D, std::string dataname){
+ try{
+ int id = surrendmanager->addProp3D(prop3D,dataname);
+ if(id!=-1){
+ wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3D(this, id);
+ addSurfaceRenderingPanel(controlpan, dataname);
+ }
+ }catch(char* str){
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+
+}
+void wxMaracasSurfaceRendering::addSurfaceRenderingPanel(wxMaracasSurfaceRenderingPanel* surrend, std::string dataname){
+
+ wxString s(dataname.c_str(),wxConvUTF8 );
+ wxAuiPaneInfo paneinfo;
+ wxauimanager->AddPane(surrend, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s));
+ wxauimanager->Update();
+
+
+}
+
+void wxMaracasSurfaceRendering::deleteActor(int propid){
+ try{
+ //surrendmanager->deleteActor(propid);
+ }catch(char* e){
+
+ }
+}
+
+
+
+
+
+/**
+**
+**/
+
+ToolBar::ToolBar(wxWindow * parent,std::string iconsdir)
+: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize)
+{
+
+
+ std::string iconfil = iconsdir;
+
+ //iconfil+= "/OpenImage.png";
+ //wxBitmap* bitmap0 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
+ wxBitmap bitmap0(OpenImage_xpm);
+ this->AddTool(1, wxString(_T("test")),bitmap0, NULL, wxITEM_NORMAL, wxString(_T("Open File")));
+
+ /*iconfil+= "/Open.png";
+ wxBitmap* bitmap2 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
+ this->AddTool(2, wxString(_T("test")),*bitmap2); */
+
+ /*iconfil = iconsdir;
+ iconfil+= "/Open.png";
+ wxBitmap* bitmap30 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
+ this->AddTool(30, wxString(_T("test")),*bitmap30);*/
+
+ this->Realize();
+
+ _evthand = new ToolBarEventHandler();
+ this->SetEventHandler(_evthand);
+
+}
+
+ToolBar::~ToolBar(void){
+}
+
+ToolBarEventHandler::ToolBarEventHandler()
+: wxEvtHandler(){
+}
+ToolBarEventHandler::~ToolBarEventHandler(){
+}
+
+void ToolBarEventHandler::onLoadImageFile(wxCommandEvent& event){
+ wxMaracasSurfaceRendering::getInstance()->onLoadImageFile();
+}
+
+
+
+BEGIN_EVENT_TABLE(ToolBarEventHandler, wxEvtHandler)
+ EVT_MENU(1, ToolBarEventHandler::onLoadImageFile)
+END_EVENT_TABLE()
+
+
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasSurfaceRendering.h,v $
+ Language: C++
+ Date: $Date: 2009/10/15 11:56:43 $
+ Version: $Revision: 1.1 $
+
+ Copyright: (c) 2002, 2003
+ License:
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+
+#ifndef __wxMaracasSurfaceRenderingPanelH__
+#define __wxMaracasSurfaceRenderingPanelH__
+
+#include <vector>
+#include <wx/wx.h>
+#include "wx/aui/aui.h"
+#include <iostream>
+#include "marTypes.h"
+#include "vtkProp3D.h"
+
+#include "wxMaracasSurfaceRenderingManager.h"
+#include "wxMaracasSurfaceRenderingPanel.h"
+
+
+
+class creaMaracasVisu_EXPORT wxMaracasSurfaceRendering : public wxPanel
+{
+
+public:
+ wxMaracasSurfaceRendering( wxWindow* parent, std::string path);
+ ~wxMaracasSurfaceRendering( );
+
+ static wxMaracasSurfaceRendering* getInstance(wxWindow* parent,std::string path="");
+
+ static wxMaracasSurfaceRendering* getInstance();
+
+ void setRenderer(vtkRenderer* renderer);
+
+ void changeOpacity(int propid, int value);
+
+ void changeIsoValue(int propid, double value);
+
+ void addRemoveActor(int propid, bool addremove);
+
+ void changeColor(int propid, double red, double green, double blue);
+
+ void addProp3D(vtkProp3D* prop3D, std::string dataname="");
+
+ void addPropMHD(vtkImageData* imgdata, std::string dataname="");
+
+ void loadProp3D(wxString filename, wxString dataname);
+
+ void loadPropMHD(wxString filename, wxString dataname);
+
+ void onLoadImageFile();
+
+ void addSurfaceRenderingPanel(wxMaracasSurfaceRenderingPanel* surrend, std::string dataname="");
+
+ std::string getPath();
+
+ void deleteActor(int propid);
+private:
+ static wxMaracasSurfaceRendering* instance;
+
+ wxMaracasSurfaceRenderingManager* surrendmanager;
+
+ wxAuiManager* wxauimanager;
+
+ void createFileChooser();
+
+ std::string _path;
+
+ wxToolBar* _toolb;
+
+};
+
+class ToolBarEventHandler : public wxEvtHandler{
+
+ public:
+ ToolBarEventHandler();
+ ~ToolBarEventHandler();
+
+ void onLoadImageFile(wxCommandEvent& event);
+
+ private:
+
+ DECLARE_EVENT_TABLE()
+ };
+
+class ToolBar : public wxToolBar{
+
+
+public:
+ ToolBar(wxWindow * parent,std::string iconsdir);
+ ~ToolBar(void);
+
+
+private:
+
+ ToolBarEventHandler* _evthand;
+
+};
+
+#endif
+
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasSurfaceRenderingManager.cxx,v $
+ Language: C++
+ Date: $Date: 2009/10/15 11:56:43 $
+ Version: $Revision: 1.1 $
+
+ Copyright: (c) 2002, 2003
+ License:
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+#include "wxMaracasSurfaceRenderingManager.h"
+
+#include "wxMaracasSurfaceRenderingManagerDataMhd.h"
+
+/**
+** Start of the manager class
+**/
+wxMaracasSurfaceRenderingManager::wxMaracasSurfaceRenderingManager(){
+ _renderer = NULL;
+ _idCount=0;
+}
+wxMaracasSurfaceRenderingManager::~wxMaracasSurfaceRenderingManager(){
+}
+
+/**
+** Sets the renderer to manage the prop3D from the surface render
+**/
+void wxMaracasSurfaceRenderingManager::setRenderer(vtkRenderer* renderer){
+ _renderer = renderer;
+}
+/**
+** Adds a prop3D to the manager and returns the identifier
+**/
+int wxMaracasSurfaceRenderingManager::addProp3D(vtkProp3D* prop3D, std::string dataname) throw(char*){
+ checkInvariant();
+ if(prop3D != NULL){
+ wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerData(prop3D, dataname);
+ prop3Dvect.push_back(data);
+ _renderer->AddActor(data->getProp3D());
+ data->setId(_idCount);
+ _idCount++;
+ return data->getId();
+ }else{
+ throw "Check vtkProp3D file or input";
+ }
+ return -1;
+}
+int wxMaracasSurfaceRenderingManager::addPropMHD(vtkImageData* imagedata, std::string dataname) throw(char*){
+
+ checkInvariant();
+ if(imagedata != NULL){
+ wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerDataMhd(imagedata, dataname);
+ prop3Dvect.push_back(data);
+ _renderer->AddActor(data->getProp3D());
+ data->setId(_idCount);
+ _idCount++;
+ return data->getId();
+ }else{
+ throw "Check ImageData file or input";
+ }
+ return -1;
+
+}
+/**
+** adds or removes an actor depending of the bool value
+**/
+void wxMaracasSurfaceRenderingManager::addRemoveActor(int propid, bool addremove) throw(char*){
+ checkInvariant();
+
+ wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
+ if(data->getProp3D()!=NULL){
+ if(addremove){
+ _renderer->AddViewProp(data->getProp3D());
+ }else{
+ _renderer->RemoveViewProp(data->getProp3D());
+ }
+ _renderer->Render();
+ }
+
+}
+/**
+** Changes the opacity in a prop3D
+**/
+void wxMaracasSurfaceRenderingManager::changeOpacity(int propid, int value) throw(char*){
+ checkInvariant();
+
+
+ this->getViewData(propid)->changeOpacity(value);
+
+ _renderer->Render();
+
+}
+
+/**
+** changes the isovalue in a prop3D
+**/
+void wxMaracasSurfaceRenderingManager::changeIsoValue(int propid, double value )throw(char*){
+ checkInvariant();
+
+ wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
+
+ //_renderer->RemoveActor(data->getProp3D());
+ ((wxMaracasSurfaceRenderingManagerDataMhd*)data)->changeIsoValue(value);
+ //_renderer->AddActor(data->getProp3D());
+
+ _renderer->Render();
+}
+
+vtkProp3D* wxMaracasSurfaceRenderingManager:: getProp3D(std::string filename){
+ if(filename.compare("")!= 0){
+ vtkSTLReader *STLReader=vtkSTLReader::New();
+ STLReader->SetFileName(filename.c_str());
+ STLReader->Update();
+ vtkPolyDataMapper* dataMapper = vtkPolyDataMapper::New();
+ dataMapper->SetInput(STLReader->GetOutput());
+
+ vtkActor* dataActor = vtkActor::New();
+ dataActor->SetMapper(dataMapper);
+ dataActor->GetProperty()->SetOpacity(1);
+
+ return dataActor;
+ }
+ return NULL;
+}
+
+vtkImageData* wxMaracasSurfaceRenderingManager::getImageData(std::string filename){
+ if(filename.compare("")!= 0){
+
+
+ vtkMetaImageReader* reader = vtkMetaImageReader::New();
+ reader->SetFileName(filename.c_str());
+ reader->Update();
+ vtkImageData* img = reader->GetOutput();
+ //reader->Delete();
+ return img;
+ }
+ return NULL;
+}
+
+void wxMaracasSurfaceRenderingManager::checkInvariant() throw(char*){
+ if(this->_renderer==NULL){
+ throw "Renderer not set";
+ }
+}
+
+wxMaracasSurfaceRenderingManagerData* wxMaracasSurfaceRenderingManager::getViewData(int id) throw(char*){
+ int i;
+ for(i = 0; i < (int)(prop3Dvect.size());i++){
+ if(prop3Dvect[i]->getId() == id){
+ return prop3Dvect[i];
+ }
+ }
+ throw "id not found in the data";
+
+ return NULL;
+}
+
+int wxMaracasSurfaceRenderingManager::getMaxIsoValue(int propid) throw(char*){
+
+ return ((wxMaracasSurfaceRenderingManagerDataMhd*)this->getViewData(propid))->getMaxGreyLevel();
+
+}
+
+void wxMaracasSurfaceRenderingManager::changeColor(int propid, double red, double green, double blue) throw(char*){
+ checkInvariant();
+ this->getViewData(propid)->changeColor(red, green, blue);
+
+ _renderer->Render();
+}
+
+void wxMaracasSurfaceRenderingManager::deleteActor(int propid) throw (char *){
+ checkInvariant();
+
+ this->addRemoveActor(propid, false);
+
+ int i,n;
+ bool exit = false;
+ for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){
+ if(prop3Dvect[i]->getId() == propid){
+ n=i;
+ exit = true;
+ }
+ }
+ if(exit){
+ wxMaracasSurfaceRenderingManagerData* data = prop3Dvect[n];
+ int j;
+ for(j = i; j < (int)(prop3Dvect.size())-1;j++){
+ prop3Dvect[j] = prop3Dvect[j+1];
+ }
+ delete data;
+ prop3Dvect.pop_back();
+ }else{
+ throw "id not found in the data";
+ }
+
+
+
+
+}
+
+
--- /dev/null
+/*=========================================================================
+
+ Program: wxMaracas
+ Module: $RCSfile: wxMaracasSurfaceRenderingManager.h,v $
+ Language: C++
+ Date: $Date: 2009/10/15 11:56:43 $
+ Version: $Revision: 1.1 $
+
+ Copyright: (c) 2002, 2003
+ License:
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+
+
+
+
+#ifndef __wxMaracasSurfaceRenderingManagerH__
+#define __wxMaracasSurfaceRenderingManagerH__
+
+#include <iostream>
+#include <vector>
+
+#include "wxMaracasSurfaceRenderingManagerData.h"
+
+
+class wxMaracasSurfaceRenderingManager {
+
+public:
+ wxMaracasSurfaceRenderingManager();
+ ~wxMaracasSurfaceRenderingManager();
+
+ /**
+ ** Sets the renderer to manage the prop3D from the surface render
+ **/
+ void setRenderer(vtkRenderer* renderer);
+ /**
+ ** Adds a prop3D to the manager and returns the identifier
+ **/
+ int addProp3D(vtkProp3D* prop3D, std::string dataname) throw (char*);
+ /**
+ ** Adds a prop3D to the manager and returns the identifier
+ **/
+ int addPropMHD(vtkImageData* imagedata, std::string dataname) throw(char*);
+ /**
+ ** Changes the opacity in a prop3D
+ **/
+ void changeOpacity(int propid, int value)throw(char*);
+
+ /**
+ ** changes the isovalue in a prop3D
+ **/
+ void changeIsoValue(int propid, double value)throw(char*);
+
+ /**
+ ** loads a prop3D from a nSTL file
+ **/
+ vtkProp3D* getProp3D(std::string filename);
+
+ /**
+ ** loads a MHD file to convert it into an actor
+ **/
+ vtkImageData* getImageData(std::string filename);
+
+ /**
+ ** adds or removes an actor depending of the bool value
+ **/
+ void addRemoveActor(int propid, bool addremove)throw(char*);
+ /**
+ ** Check if the variables are setted correctly
+ **/
+ void checkInvariant()throw(char*);
+
+ /**
+ ** Given an id search the data in the vector
+ **/
+ wxMaracasSurfaceRenderingManagerData* getViewData(int id)throw(char*);
+
+ /**
+ ** Given the id, return the max iso value from the imagedata
+ **/
+ int getMaxIsoValue(int propid)throw(char*);
+
+
+ /**
+ ** Changes the color of the actor
+ **/
+ void changeColor(int propid, double red, double green, double blue) throw(char*);
+
+ void deleteActor(int propid)throw (char *);
+
+private:
+ std::vector<wxMaracasSurfaceRenderingManagerData*> prop3Dvect;
+
+ vtkRenderer* _renderer;
+
+ int _idCount;
+
+
+
+
+};
+
+#endif
--- /dev/null
+
+#include "wxMaracasSurfaceRenderingManagerData.h"
+
+/********************************************************************************************
+** Start of data viewmanagerData
+*********************************************************************************************/
+
+wxMaracasSurfaceRenderingManagerData::wxMaracasSurfaceRenderingManagerData(vtkProp3D* prop3Dvect, std::string dataname){
+
+ _prop3D = prop3Dvect;
+ _dataname = dataname;
+
+}
+
+
+wxMaracasSurfaceRenderingManagerData::~wxMaracasSurfaceRenderingManagerData(){
+
+ _prop3D->Delete();
+}
+
+/**
+** Adds a prop3D to the world of the application
+**/
+void wxMaracasSurfaceRenderingManagerData::setProp3D(vtkProp3D* prop3D){
+ _prop3D = prop3D;
+}
+/**
+** Changes the opacity in a prop3D
+**/
+void wxMaracasSurfaceRenderingManagerData::changeOpacity(int value){
+ std::cout<<"chage op"<<value<<std::endl;
+ vtkActor* actor = (vtkActor*)this->_prop3D;
+ actor->GetProperty()->SetOpacity((double)value/100.0);
+
+
+
+}
+void wxMaracasSurfaceRenderingManagerData::changeColor(double red, double green, double blue){
+ std::cout<<"chage col"<<red<<green<<blue<<std::endl;
+ vtkActor* actor = (vtkActor*)this->_prop3D;
+ actor->GetProperty()->SetColor(red,green,blue);
+}
+/**
+** Check if the variables are setted correctly
+**/
+void wxMaracasSurfaceRenderingManagerData::checkInvariant(){
+
+}
+/**
+** get the prop3D
+**/
+vtkProp3D* wxMaracasSurfaceRenderingManagerData::getProp3D(){
+ return this->_prop3D;
+}
+/**
+** return the id from the daat
+**/
+int wxMaracasSurfaceRenderingManagerData::getId(){
+ return _id;
+}
+/**
+** set data id
+**/
+void wxMaracasSurfaceRenderingManagerData::setId(int propid){
+ _id = propid;
+}
+
+/**
+** Get the filanme
+**/
+std::string wxMaracasSurfaceRenderingManagerData::getDataname(){
+ return _dataname;
+}
+/**
+** Set the filanme
+**/
+void wxMaracasSurfaceRenderingManagerData::setDataname(std::string dataname){
+ _dataname = dataname;
+}
+
--- /dev/null
+#ifndef WXMARACASSURFACERENDERINGMANAGERDATA_H_
+#define WXMARACASSURFACERENDERINGMANAGERDATA_H_
+
+#include "vtkProp3D.h"
+#include "vtkRenderer.h"
+#include "vtkSTLReader.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkActor.h"
+#include "vtkProperty.h"
+
+
+
+class wxMaracasSurfaceRenderingManagerData {
+
+public:
+ wxMaracasSurfaceRenderingManagerData(vtkProp3D* _prop3Dvect, std::string dataname="");
+ ~wxMaracasSurfaceRenderingManagerData();
+
+ /**
+ ** Adds a prop3D to the world of the application
+ **/
+ void setProp3D(vtkProp3D* prop3D);
+ /**
+ ** Changes the opacity in a prop3D
+ **/
+ void changeOpacity(int value);
+ /**
+ ** Check if the variables are setted correctly
+ **/
+ void checkInvariant();
+ /**
+ ** get the prop3D
+ **/
+ vtkProp3D* getProp3D();
+ /**
+ ** return the id from the daat
+ **/
+ int getId();
+ /**
+ ** set data id
+ **/
+ void setId(int propid);
+ /**
+ ** Get the filanme
+ **/
+ std::string getDataname();
+ /**
+ ** Set the filanme
+ **/
+ void setDataname(std::string dataname);
+
+ /**
+ ** creates the image
+ **/
+ void contourExtractor(int isovalue);
+
+ /**
+ ** Changes the color of the actor
+ **/
+ void changeColor(double red, double green, double blue);
+
+protected:
+ /**
+ * Prop 3D (data actor)
+ */
+ vtkProp3D* _prop3D;
+ /**
+ * Dataname given by the user (ex. filename)
+ **/
+ std::string _dataname;
+
+
+private:
+
+ /*
+ * id of the data
+ */
+ int _id;
+
+
+};
+
+#endif /*WXMARACASSURFACERENDERINGMANAGERDATA_H_*/
--- /dev/null
+
+#include "wxMaracasSurfaceRenderingManagerDataMhd.h"
+
+wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname)
+: wxMaracasSurfaceRenderingManagerData(NULL, dataname)
+{
+
+ this->setVtkImageData(imagedata);
+ _dataname = dataname;
+
+ _maxgreylevel = getMaxLevel(imagedata);
+ _prop3D=NULL;
+
+ _cubesFilter = vtkMarchingCubes::New();
+ _cleanFilter = vtkCleanPolyData::New();
+ _dataMapper = vtkPolyDataMapper::New();
+ vtkActor* dataActor = vtkActor::New();
+
+ _cubesFilter->SetInput(this->_imagedata);
+ _cubesFilter->ComputeGradientsOn ();
+ _cubesFilter->ComputeScalarsOn ();
+ _cubesFilter->SetNumberOfContours( 1 );
+ _cleanFilter->SetInput ( _cubesFilter->GetOutput() );
+ _dataMapper->SetInput(_cleanFilter->GetOutput());
+ _dataMapper->ScalarVisibilityOff();
+ _dataMapper->ImmediateModeRenderingOn();
+ dataActor->SetMapper(_dataMapper);
+
+ this->_prop3D = dataActor;
+
+ this->changeIsoValue(this->_maxgreylevel);
+
+
+}
+
+wxMaracasSurfaceRenderingManagerDataMhd::~wxMaracasSurfaceRenderingManagerDataMhd(){
+ _cubesFilter->Delete();
+ _cleanFilter->Delete();
+ _dataMapper->Delete();
+}
+
+
+/**
+** changes the isovalue in a prop3D
+**/
+void wxMaracasSurfaceRenderingManagerDataMhd::changeIsoValue(double value){
+
+
+ _cubesFilter->SetValue(0,value);
+ _cubesFilter->Update();
+ _cleanFilter->Update();
+ _dataMapper->Update();
+
+
+
+}
+int wxMaracasSurfaceRenderingManagerDataMhd::getMaxGreyLevel(){
+ return _maxgreylevel;
+}
+
+/**
+ ** Get's the max grey level of the image
+ **/
+int wxMaracasSurfaceRenderingManagerDataMhd::getMaxLevel(vtkImageData* img){
+
+ int ext[6], i, j, k,max=0;
+ img->GetExtent(ext);
+
+ for(i = ext[0]; i < ext[1];i++){
+ for(j = ext[2]; j < ext[3];j++){
+ for(k = ext[4]; k < ext[5];k++){
+ unsigned short* ptr = (unsigned short*)img->GetScalarPointer(i,j,k);
+ int temp = (int)*ptr;
+ if(temp > max){
+ max = temp;
+ }
+ }
+ }
+ }
+ return max;
+
+
+}
+
+/**
+** Sets the VTK image data
+**/
+
+void wxMaracasSurfaceRenderingManagerDataMhd::setVtkImageData(vtkImageData* imagedata){
+ _imagedata = imagedata;
+}
+
--- /dev/null
+#ifndef WXMARACASSURFACERENDERINGMANAGERDATAMHD_H_
+#define WXMARACASSURFACERENDERINGMANAGERDATAMHD_H_
+
+
+#include "wxMaracasSurfaceRenderingManagerData.h"
+
+#include "vtkMetaImageReader.h"
+#include "vtkMarchingCubes.h"
+#include "vtkCleanPolyData.h"
+#include "vtkImageData.h"
+
+class wxMaracasSurfaceRenderingManagerDataMhd : public wxMaracasSurfaceRenderingManagerData {
+
+public:
+
+ wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname="");
+ ~wxMaracasSurfaceRenderingManagerDataMhd();
+
+
+ /**
+ ** Adds a prop3D to the world of the application
+ **/
+ void setVtkImageData(vtkImageData* imagedata);
+
+ /**
+ ** changes the isovalue in a prop3D
+ **/
+ void changeIsoValue(double value);
+ /**
+ ** Check if the variables are setted correctly
+ **/
+ void checkInvariant();
+
+ /**
+ ** Returns the grey max level of the image
+ **/
+
+ int getMaxGreyLevel();
+
+ /**
+ ** creates the image
+ **/
+ void contourExtractor(int isovalue);
+
+private:
+
+ vtkImageData* _imagedata;
+ int _maxgreylevel;
+
+ /**
+ ** to the image render
+ **/
+ vtkMarchingCubes* _cubesFilter;
+ vtkCleanPolyData* _cleanFilter;
+ vtkPolyDataMapper* _dataMapper;
+
+ /**
+ ** Get's the max grey level of the image
+ **/
+ int getMaxLevel(vtkImageData* img);
+
+
+
+};
+
+#endif /*WXMARACASSURFACERENDERINGMANAGERDATAMHD_H_*/
--- /dev/null
+#ifndef WXMARACASSURFACERENDERINGPANEL_H_
+#define WXMARACASSURFACERENDERINGPANEL_H_
+
+#include "wx/wx.h"
+
+class wxMaracasSurfaceRenderingPanel : public wxPanel{
+public:
+ wxMaracasSurfaceRenderingPanel(wxWindow* parent, int propid)
+ : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
+ createPanel();
+ _propid = propid;
+ }
+ //virtual ~wxMaracasSurfaceRenderingPanel();
+ virtual void createPanel(){
+ show = false;
+ /*wxBoxSizer* sizerButtons = new wxBoxSizer(wxVERTICAL);
+
+ wxButton* b = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
+ wxDefaultValidator, wxString(_T("-")));
+ Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingPanel::onActionButtonPressedHide);
+ wxButton* b1 = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
+ wxDefaultValidator, wxString(_T("x")));
+ Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingPanel::onActionButtonPressedEliminate);
+
+ sizerButtons->Add(b, wxFIXED_MINSIZE);
+ sizerButtons->Add(b1, wxFIXED_MINSIZE);*/
+
+ sizercontrols = new wxBoxSizer(wxVERTICAL);
+
+ wxBoxSizer* sizerpanel = new wxBoxSizer(wxHORIZONTAL);
+
+ //sizerpanel->Add(sizerButtons,wxGROW);
+ sizerpanel->Add(sizercontrols,wxGROW);
+
+ this->SetSizer(sizerpanel, true);
+ this->SetAutoLayout( true );
+ }
+
+ /**
+ ** Adds a new control to the panel (sizer, radiob, etc)
+ **/
+ virtual void addControl(wxWindow* win){
+ if(sizercontrols!=NULL){
+ sizercontrols->Add(win, wxGROW);
+ }
+ }
+
+ /**
+ ** Adds a new control to the panel (sizer, radiob, etc)
+ **/
+ virtual void addControl(wxSizer* sizer){
+ if(sizercontrols!=NULL){
+ sizercontrols->Add(sizer, wxGROW);
+ }
+ }
+
+ /**
+ ** Hides or show the controls in the panel
+ **/
+ virtual void onActionButtonPressedHide( wxCommandEvent& event ){
+ wxList list = sizercontrols->GetChildren();
+ int i;
+ for(i=0; i<list.size();i++){
+ sizercontrols->Show(i,show);
+ }
+ show = !show;
+ sizercontrols->Layout();
+ this->Layout();
+ }
+
+ /**
+ ** The user must implement this function to remove the panel from the
+ **/
+ //virtual void onActionButtonPressedEliminate( wxCommandEvent& event )=0;
+
+ /**
+ ** The user must implement this function to add the necessary controls to the panel
+ **/
+ virtual void createControls( )=0;
+
+ /**
+ ** returns the id of the panel
+ **/
+ int getPropId(){
+ return _propid;
+ }
+
+private:
+ wxBoxSizer* sizercontrols;
+ bool show;
+protected:
+ int _propid;
+
+};
+
+#endif /*WXMARACASSURFACERENDERINGPANEL_H_*/
--- /dev/null
+#include "wxMaracasSurfaceRenderingProp3D.h"
+
+#include <wx/colordlg.h>
+#include "wxMaracasSurfaceRendering.h"
+#include <OpenImage.xpm>
+#include "Color.xpm"
+/**
+** Implementation of viewProp3D
+**/
+
+wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent,int propid)
+:wxMaracasSurfaceRenderingPanel(parent, propid){
+ createControls();
+}
+
+wxMaracasSurfaceRenderingProp3D::~wxMaracasSurfaceRenderingProp3D(){
+ //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false);
+ wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid);
+}
+
+void wxMaracasSurfaceRenderingProp3D::createControls(){
+
+ wxFlexGridSizer* sizersurfprop = new wxFlexGridSizer(1,1,1);
+
+ wxString choices[2];
+ choices[0] = wxString(_T("On"));
+ choices[1] = wxString(_T("Off"));
+ checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
+ Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange);
+ checkbox->SetValue(true);
+
+ sizersurfprop->Add(checkbox,wxFIXED_MINSIZE);
+
+ //this->addControl(checkbox);
+
+ wxBitmap bitmap(Color_xpm);
+ _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
+ Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onColorChange);
+ sizersurfprop->Add(_colorchoose,wxFIXED_MINSIZE);
+
+ //sizercolor->Add(checkbox,wxFIXED_MINSIZE);
+ //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
+ //this->addControl(sizercolor);
+
+
+ wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity")));
+ opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);
+ Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onOpacityRelease);
+ wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1);
+ sizeropacity->Add(label,wxFIXED_MINSIZE);
+ sizeropacity->Add(opacity,wxFIXED_MINSIZE);
+
+ sizersurfprop->Add(sizeropacity,wxFIXED_MINSIZE);
+
+ /**wxBitmap bitmap1(OpenImage_xpm);
+ _viewimage = new wxBitmapButton(this, -1, bitmap1, wxDefaultPosition, wxSize(30,30));
+ Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onViewImage);
+ sizersurfprop->Add(_viewimage,wxFIXED_MINSIZE); */
+
+ //this->addControl(sizeropacity);
+ this->addControl(sizersurfprop);
+
+}
+void wxMaracasSurfaceRenderingProp3D::onCheckBoxChange(wxCommandEvent& event){
+ wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+}
+void wxMaracasSurfaceRenderingProp3D::onColorChange(wxCommandEvent& event){
+ wxColourDialog* colourdiag = new wxColourDialog(this);
+ if(colourdiag->ShowModal()==wxID_OK){
+ wxColour colour = colourdiag->GetColourData().GetColour();
+ _colorchoose->SetBackgroundColour(colour);
+
+ double r = (double)(colour.Red())/255.0;
+ double g = (double)(colour.Green())/255.0;
+ double b = (double)(colour.Blue())/255.0;
+
+ wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b);
+ }
+ delete colourdiag;
+}
+/*void wxMaracasSurfaceRenderingProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){
+
+}*/
+
+void wxMaracasSurfaceRenderingProp3D::onOpacityRelease(wxScrollEvent& event ){
+
+ wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
+
+}
+
+void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){
+
+ //if(mwxwidget->ShowModal()==wxID_OK){
+
+ // mwxwidget->Show(false);
+ //}
+}
+
--- /dev/null
+#ifndef WXMARACASSURFACERENDERINGPROP3D_H_
+#define WXMARACASSURFACERENDERINGPROP3D_H_
+
+#include "wxMaracasSurfaceRenderingPanel.h"
+
+class wxMaracasSurfaceRenderingProp3D : public wxMaracasSurfaceRenderingPanel{
+public:
+ wxMaracasSurfaceRenderingProp3D(wxWindow* parent, int propid);
+ ~wxMaracasSurfaceRenderingProp3D();
+ virtual void createControls();
+ void onOpacityRelease(wxScrollEvent& event );
+ void onCheckBoxChange(wxCommandEvent& event);
+ void onColorChange(wxCommandEvent& event);
+ void onViewImage(wxCommandEvent& event);
+
+
+private:
+ wxCheckBox* checkbox;
+ wxSlider* opacity;
+ wxBitmapButton* _colorchoose;
+ wxBitmapButton* _viewimage;
+
+
+};
+
+#endif /*WXMARACASSURFACERENDERINGPROP3D_H_*/
--- /dev/null
+#include "wxMaracasSurfaceRenderingProp3DMHD.h"
+
+#include "wxMaracasSurfaceRendering.h"
+#include <OpenImage.xpm>
+/**
+** SurfaceRenderingProp3DMHD implementation
+**/
+wxMaracasSurfaceRenderingProp3DMHD::wxMaracasSurfaceRenderingProp3DMHD(wxWindow* parent, int propid)
+: wxMaracasSurfaceRenderingProp3D(parent, propid)
+{
+
+}
+wxMaracasSurfaceRenderingProp3DMHD::~wxMaracasSurfaceRenderingProp3DMHD(){
+ //this->Show(false);
+ //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false);
+}
+void wxMaracasSurfaceRenderingProp3DMHD::createControls(int maxisovalue){
+
+ wxFlexGridSizer* sizer = new wxFlexGridSizer(1,1,1);
+
+ wxStaticText* label = new wxStaticText(this, -1, wxString(_T("IsoValue")));
+ sizer->Add(label, wxFIXED_MINSIZE);
+ //this->addControl(label);
+ isovalue = new wxSlider(this, -1,maxisovalue,0,maxisovalue,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);
+ sizer->Add(isovalue, wxFIXED_MINSIZE);
+ //this->addControl(isovalue);
+
+ wxBitmap bitmap(OpenImage_xpm);
+ _viewimage = new wxBitmapButton(this, -1, bitmap, wxDefaultPosition, wxSize(30,30));
+ Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3DMHD::onViewImage);
+ sizer->Add(_viewimage,wxFIXED_MINSIZE);
+
+ this->addControl(sizer);
+ Connect(isovalue->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3DMHD::onIsoValueRelease);
+
+
+
+}
+
+void wxMaracasSurfaceRenderingProp3DMHD::onIsoValueRelease(wxScrollEvent& event ){
+
+ wxMaracasSurfaceRendering::getInstance()->changeIsoValue(this->getPropId(), isovalue->GetValue()/1.0);
+
+}
+
+void wxMaracasSurfaceRenderingProp3DMHD::onViewImage(wxCommandEvent& event){
+
+ //if(mwxwidget->ShowModal()==wxID_OK){
+
+ // mwxwidget->Show(false);
+ //}
+}
+
--- /dev/null
+#ifndef WXMARACASSURFACERENDERINGPROP3DMHD_H_
+#define WXMARACASSURFACERENDERINGPROP3DMHD_H_
+
+#include "wxMaracasSurfaceRenderingProp3D.h"
+
+class wxMaracasSurfaceRenderingProp3DMHD : public wxMaracasSurfaceRenderingProp3D{
+public:
+ wxMaracasSurfaceRenderingProp3DMHD(wxWindow* parent, int propid);
+ ~wxMaracasSurfaceRenderingProp3DMHD();
+ void onIsoValueRelease(wxScrollEvent& event );
+ void createControls(int maxisovalue);
+ void onViewImage(wxCommandEvent& event);
+
+private:
+ wxSlider* isovalue;
+ wxBitmapButton* _viewimage;
+ int _propid;
+
+};
+
+#endif /*WXMARACASSURFACERENDERINGPROP3DMHD_H_*/