1 #include "qtsurfacerendererpanel.h"
2 #include "ui_qtsurfacerendererpanel.h"
4 #include "qfiledialog.h"
6 #include "qcolordialog.h"
7 #include "qmessagebox.h"
11 #include "OpenImage.xpm"
13 QtSurfaceRendererPanel::QtSurfaceRendererPanel(QWidget *parent) :
15 ui(new Ui::QtSurfaceRendererPanel)
20 this->ui->pushButtonColorChooser->setIcon(QIcon(Color_xpm));
21 this->ui->pushButtonSave->setIcon(QIcon(Save_xpm));
22 this->ui->pushButtonOpen->setIcon(QIcon(OpenImage_xpm));
25 QtSurfaceRendererPanel::~QtSurfaceRendererPanel()
29 void QtSurfaceRendererPanel::setImageData(vtkImageData* img){
30 double *range =img->GetScalarRange();
32 this->ui->horizontalSliderMinIso->setRange(range[0], range[1]);
34 this->ui->horizontalSliderMaxIso->setRange(range[0], range[1]);
36 wxMaracasSurfaceRenderingManager::setImageData(img);
39 void QtSurfaceRendererPanel::on_OpacitySlider_valueChanged(int value)
43 this->ui->lineEditOpacity->setText(QString::number(value));
46 this->changeOpacity(0, value);
49 QMessageBox::critical(this, tr("Volume Rendering"), tr(e), QMessageBox::Ok);
53 void QtSurfaceRendererPanel::on_pushButtonColorChooser_clicked()
55 QColorDialog* qcolor = new QColorDialog(this);
61 QColor color = qcolor->selectedColor();
63 int r = 0, g = 0, b = 0;
64 color.getRgb(&r, &g, &b);
68 this->changeColor(0, r/255.0, g/255.0 ,b/255.0);
71 QMessageBox::critical(this, tr("Surface Rendering"), tr(e), QMessageBox::Ok);
78 void QtSurfaceRendererPanel::on_checkBox_clicked(bool checked)
80 this->addRemoveActor(0, checked);
82 this->ui->checkBoxBoundingBox->setCheckState(Qt::Unchecked);
83 this->on_checkBoxBoundingBox_clicked(false);
87 void QtSurfaceRendererPanel::on_horizontalSliderMaxIso_valueChanged(int value)
90 this->ui->lineEditMaxIso->setText(QString::number(value));
93 void QtSurfaceRendererPanel::on_horizontalSliderMinIso_valueChanged(int value)
95 this->ui->lineEditMinIso->setText(QString::number(value));
98 void QtSurfaceRendererPanel::on_horizontalSliderMaxIso_sliderReleased()
103 void QtSurfaceRendererPanel::on_horizontalSliderMinIso_sliderReleased()
108 void QtSurfaceRendererPanel::onIsoValueChanged(){
109 this->changeIsoValue(0, this->ui->horizontalSliderMinIso->value(), this->ui->horizontalSliderMaxIso->value());
112 void QtSurfaceRendererPanel::on_pushButtonSave_clicked()
114 QString filename = QFileDialog::getSaveFileName(this,
115 tr("Save Mesh File"),
117 tr("Mesh files (*.stl *.ply)") );
119 if( !filename.isNull() ){
120 //filename.append(".stl");
121 this->saveProp3DSTL(0, filename.toStdString().c_str());
126 void QtSurfaceRendererPanel::on_checkBoxBoundingBox_clicked(bool checked)
128 this->enableBoundingBox(0, checked);
132 void QtSurfaceRendererPanel::on_pushButtonOpen_clicked(bool checked)
137 void QtSurfaceRendererPanel::on_pushButtonOpen_clicked()
139 QString filename = QFileDialog::getOpenFileName(this, tr("Load Mesh File"), QDir::currentPath(), tr("Mesh files (*.stl *.ply)"));
141 if(!filename.isNull()){
142 this->loadProp3DSTL(filename.toStdString().c_str());