#include <wx/colordlg.h>
#include "wxMaracasMultipleVolumeRendererView.h"
+#include <OpenImage.xpm>
#include "Color.xpm"
+//#include <vtkImageCast.h>
/**
** Implementation of viewProp3D
**/
wxMaracasMultipleVolumeRendererPanel::~wxMaracasMultipleVolumeRendererPanel(){
//wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
wxMaracasMultipleVolumeRendererView::getInstance()->deleteVolume(_propid);
+ delete mwxwidget;
}
void wxMaracasMultipleVolumeRendererPanel::createControls(vtkImageData* img){
Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange);
checkbox->SetValue(true);
- sizerirmprop->Add(checkbox,wxFIXED_MINSIZE);
-
- //this->addControl(checkbox);
+ sizerirmprop->Add(checkbox,wxFIXED_MINSIZE);
- wxBitmap bitmap(Color_xpm);
- _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
- Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange);
- sizerirmprop->Add(_colorchoose,wxFIXED_MINSIZE);
+ //wxBitmap bitmap(Color_xpm);
+ //_colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
+ //Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange);
+
+ mwxwidget = new HistogramDialogComboBox(this);
+ mwxwidget->setImageData(img);
+ //mwxwidget->PushEventHandler(this);
+ 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"));
+ //_frame = new wxFrame(this, 10, _T("Configure Transfer Functions"));
- wxButton* button1 = new wxButton(_frame,20,_T("OK"));
+ /*wxButton* button1 = new wxButton(_frame,20,_T("OK"));
Connect(button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onOK);
wxButton* button2 = new wxButton(_frame,30,_T("Cancel") );
Connect(button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCancel);
wxButton* button3 = new wxButton(_frame,40,_T("Update"));
- Connect(button3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onUpdate);
+ Connect(button3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onUpdate); */
+ /*mwxwidget->erasePointsTransferenceFunction();
+ double range[2];
+ img->GetScalarRange(range);
+ double max = range[1];
- mwxwidget = new HistogramWidget(_frame, -1);
-
- mwxwidget->initializeHistogram(img);
- mwxwidget->Refresh();
-
- wxBoxSizer* boxSizer0 = new wxBoxSizer(wxHORIZONTAL);
+
+ //X
+ mwxwidget->addPointToTransferenceFunction(max * 0/2,0.0);
+ mwxwidget->addPointToTransferenceFunction(max * 1/2,100.0);
+ mwxwidget->addPointToTransferenceFunction(max * 2/2,100.0);
+
+ mwxwidget->addColorPoint(max*0/4,(int)(0.0*255),(int)(0.0*255),(int)(0.0*255));
+ mwxwidget->addColorPoint(max*1/4,(int)(1.0*255),(int)(0.0*255),(int)(0.0*255));
+ mwxwidget->addColorPoint(max*2/4,(int)(0.0*255),(int)(0.0*255),(int)(1.0*255));
+ mwxwidget->addColorPoint(max*3/4,(int)(0.0*255),(int)(1.0*255),(int)(0.0*255));
+ mwxwidget->addColorPoint(max*4/4,(int)(0.0*255),(int)(0.0*255),(int)(0.2*255)); */
+
+ /*wxBoxSizer* boxSizer0 = new wxBoxSizer(wxHORIZONTAL);
boxSizer0->Add(mwxwidget, 4, wxGROW);
wxBoxSizer* boxSizer = new wxBoxSizer(wxHORIZONTAL);
_frame->SetSizer(boxsizer2);
_frame->Refresh();
- _frame->Update();
-
+ _frame->Update();*/
+ //mwxwidget->SetFunctions(wxMaracasMultipleVolumeRendererView::getInstance()->GetTransferFunction(getPropId()),
+ // wxMaracasMultipleVolumeRendererView::getInstance()->GetColorFunction(getPropId()));
+ mwxwidget->Refresh();
}
void wxMaracasMultipleVolumeRendererPanel::onOK(wxCommandEvent& event){
updateVolume();
- _frame->Show(false);
+ //_frame->Show(false);
}
void wxMaracasMultipleVolumeRendererPanel::onCancel(wxCommandEvent& event){
- _frame->Show(false);
+ //_frame->Show(false);
}
void wxMaracasMultipleVolumeRendererPanel::onUpdate(wxCommandEvent& event){
updateVolume();
wxMaracasMultipleVolumeRendererView::getInstance()->SetValuesPointsFunction(this->_propid, greylevel, values);
}
-void wxMaracasMultipleVolumeRendererPanel::onColorChange(wxCommandEvent& event){
- _frame->Show(true);
+void wxMaracasMultipleVolumeRendererPanel::onColorChange(wxCommandEvent& event){
+
+ //if(mwxwidget->ShowModal()==wxID_OK){
+ updateVolume();
+ // mwxwidget->Show(false);
+ //}
+}
+
+void wxMaracasMultipleVolumeRendererPanel::onViewImage(wxCommandEvent& event){
+
}
void wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange(wxCommandEvent& event){
wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());