// Create new group box QtWidgetObject* AtenTreeGuiDialog::addGroup(TreeGuiWidget* widget, QString label) { QtWidgetObject* qtwo = widgetObjects_.add(); QGroupBox *group = new QGroupBox(label); QGridLayout *layout = addLayout(group); qtwo->set(widget, group, NULL, layout); group->setEnabled(widget->enabled()); group->setVisible(widget->visible()); group->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); return qtwo; }
QDockWidget* VisualizationWorkstationExtensionPlugin::getDockWidget() { _dockWidget = new QDockWidget("Cancer detection visualization"); QUiLoader loader; QFile file(":/VisualizationWorkstationExtensionPlugin_ui/VisualizationWorkstationExtensionPlugin.ui"); file.open(QFile::ReadOnly); QWidget* content = loader.load(&file, _dockWidget); file.close(); _likelihoodCheckBox = content->findChild<QCheckBox*>("LikelihoodCheckBox"); QDoubleSpinBox* spinBox = content->findChild<QDoubleSpinBox*>("OpacitySpinBox"); spinBox->setValue(_opacity); QDoubleSpinBox* windowSpinBox = content->findChild<QDoubleSpinBox*>("WindowSpinBox"); windowSpinBox->setValue(_window); QDoubleSpinBox* levelSpinBox = content->findChild<QDoubleSpinBox*>("LevelSpinBox"); levelSpinBox->setValue(_level); QSpinBox* channelSpinBox = content->findChild<QSpinBox*>("ChannelSpinBox"); channelSpinBox->setValue(_foregroundChannel); _segmentationCheckBox = content->findChild<QCheckBox*>("SegmentationCheckBox"); QPushButton* openResultButton = content->findChild<QPushButton*>("OpenResultPushButton"); QComboBox* LUTBox = content->findChild<QComboBox*>("LUTComboBox"); LUTBox->setEditable(false); for (std::map<std::string, pathology::LUT>::const_iterator it = pathology::ColorLookupTables.begin(); it != pathology::ColorLookupTables.end(); ++it) { LUTBox->addItem(QString::fromStdString(it->first)); } LUTBox->setCurrentText("Normal"); connect(_likelihoodCheckBox, SIGNAL(toggled(bool)), this, SLOT(onEnableLikelihoodToggled(bool))); connect(_segmentationCheckBox, SIGNAL(toggled(bool)), this, SLOT(onEnableSegmentationToggled(bool))); connect(spinBox, SIGNAL(valueChanged(double)), this, SLOT(onOpacityChanged(double))); connect(windowSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onWindowValueChanged(double))); connect(levelSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onLevelValueChanged(double))); connect(channelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onChannelChanged(int))); connect(openResultButton, SIGNAL(clicked()), this, SLOT(onOpenResultImageClicked())); connect(LUTBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onLUTChanged(const QString&))); _dockWidget->setEnabled(false); // Not used for know QGroupBox* segmentationGroupBox = content->findChild<QGroupBox*>("SegmentationGroupBox"); segmentationGroupBox->setVisible(false); return _dockWidget; }
BlurDialog::BlurDialog(cv::Mat& img, QWidget *parent) : QDialog(parent) { img.copyTo(image); pimage = &img; if (pimage->channels()==3) { cvtColor(*pimage, gray_image, CV_RGB2GRAY); } else { pimage->copyTo(gray_image); } opt = OPT_HOMOGENEOUS; ksize = 1; /* QRadioButton */ QGroupBox *radioGroup = new QGroupBox("Blur Operation", this); homogeneousBtn = new QRadioButton("Homogeneous"); guassianBtn = new QRadioButton("Guassian"); medianBtn = new QRadioButton("Median"); bilateralBtn = new QRadioButton("Bilateral"); guidedBtn = new QRadioButton("Guided"); QHBoxLayout *radioLayout = new QHBoxLayout(); radioLayout->addWidget(homogeneousBtn); radioLayout->addWidget(guassianBtn); radioLayout->addWidget(medianBtn); radioLayout->addWidget(bilateralBtn); radioLayout->addWidget(guidedBtn); radioGroup->setLayout(radioLayout); radioGroup->setVisible(true); homogeneousBtn->setChecked(true); connect(guassianBtn, SIGNAL(clicked()), this, SLOT(setGuassianOpt())); connect(homogeneousBtn, SIGNAL(clicked()), this, SLOT(setHomogeneousOpt())); connect(medianBtn, SIGNAL(clicked()), this, SLOT(setMedianOpt())); connect(bilateralBtn, SIGNAL(clicked()), this, SLOT(setBilateralOpt())); connect(guidedBtn, SIGNAL(clicked()), this, SLOT(setGuidedOpt())); /* QSlider */ ksizeLabel = new QLabel(tr("KernelSize(2n+1)")); ksizeSlider = new QSlider(Qt::Horizontal); ksizeSlider->setRange(0,cvRound(cv::min(img.cols,img.rows)/4)); ksizeSlider->setValue(0); ksizeSBox = new QSpinBox(); ksizeSBox->setRange(0,cvRound(cv::min(img.cols,img.rows)/4)); ksizeSBox->setValue(0); connect(ksizeSlider, SIGNAL(valueChanged(int)), this, SLOT(ksizeChanged(int))); connect(ksizeSlider, SIGNAL(valueChanged(int)), ksizeSBox, SLOT(setValue(int))); connect(ksizeSBox, SIGNAL(valueChanged(int)), this, SLOT(ksizeChanged(int))); connect(ksizeSBox, SIGNAL(valueChanged(int)), ksizeSlider, SLOT(setValue(int))); QHBoxLayout *ksizeLayout = new QHBoxLayout(); ksizeLayout->addWidget(ksizeLabel); ksizeLayout->addWidget(ksizeSlider); ksizeLayout->addWidget(ksizeSBox); /* Button actions */ okButton = new QPushButton(tr("&Ok")); okButton->setDefault(true); okButton->setEnabled(true); connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked())); closeButton = new QPushButton(tr("&Close")); connect(closeButton, SIGNAL(clicked()), this, SLOT(closeClicked())); QHBoxLayout *bntLayout = new QHBoxLayout(); bntLayout->addWidget(okButton); bntLayout->addWidget(closeButton); bntLayout->addStretch(); QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->addWidget(radioGroup); mainLayout->addLayout(ksizeLayout); mainLayout->addLayout(bntLayout); setLayout(mainLayout); setWindowTitle(tr("Blur Operation")); setFixedHeight(sizeHint().height()); }
QWidget *ProblemDialog::createControlsGeneral() { logMessage("ProblemDialog::createControlsGeneral()"); // equations lblEquationPixmap = new QLabel(""); lblEquationPixmap->setMinimumHeight(50); // problem cmbProblemType = new QComboBox(); cmbPhysicField = new QComboBox(); txtName = new QLineEdit(""); dtmDate = new QDateTimeEdit(); dtmDate->setDisplayFormat("dd.MM.yyyy"); dtmDate->setCalendarPopup(true); cmbAdaptivityType = new QComboBox(); txtAdaptivitySteps = new QSpinBox(this); txtAdaptivitySteps->setMinimum(1); txtAdaptivitySteps->setMaximum(100); txtAdaptivityTolerance = new SLineEditDouble(1, true); txtAdaptivityTolerance->setBottom(0.0); cmbMatrixSolver = new QComboBox(); // mesh txtNumberOfRefinements = new QSpinBox(this); txtNumberOfRefinements->setMinimum(0); txtNumberOfRefinements->setMaximum(5); txtPolynomialOrder = new QSpinBox(this); txtPolynomialOrder->setMinimum(1); txtPolynomialOrder->setMaximum(10); cmbMeshType = new QComboBox(); // harmonic txtFrequency = new SLineEditDouble(); // transient cmbAnalysisType = new QComboBox(); txtTransientTimeStep = new ValueLineEdit(); txtTransientTimeTotal = new ValueLineEdit(); txtTransientInitialCondition = new ValueLineEdit(); lblTransientSteps = new QLabel("0"); // linearity cmbLinearityType = new QComboBox(); txtLinearityNonlinearitySteps = new QSpinBox(this); txtLinearityNonlinearitySteps->setMinimum(1); txtLinearityNonlinearitySteps->setMaximum(100); txtLinearityNonlinearityTolerance = new SLineEditDouble(1); connect(txtTransientTimeStep, SIGNAL(editingFinished()), this, SLOT(doTransientChanged())); connect(txtTransientTimeTotal, SIGNAL(editingFinished()), this, SLOT(doTransientChanged())); connect(cmbPhysicField, SIGNAL(currentIndexChanged(int)), this, SLOT(doPhysicFieldChanged(int))); connect(cmbAdaptivityType, SIGNAL(currentIndexChanged(int)), this, SLOT(doAdaptivityChanged(int))); connect(cmbAnalysisType, SIGNAL(currentIndexChanged(int)), this, SLOT(doAnalysisTypeChanged(int))); connect(cmbLinearityType, SIGNAL(currentIndexChanged(int)), this, SLOT(doLinearityTypeChanged(int))); fillComboBox(); int minWidth = 130; // table QGridLayout *layoutTable = new QGridLayout(); layoutTable->setColumnMinimumWidth(0, minWidth); layoutTable->setColumnStretch(1, 1); layoutTable->addWidget(new QLabel(tr("Date:")), 2, 0); layoutTable->addWidget(dtmDate, 2, 1); layoutTable->addWidget(new QLabel(tr("Physic field:")), 3, 0); layoutTable->addWidget(cmbPhysicField, 3, 1); layoutTable->addWidget(new QLabel(tr("Problem type:")), 4, 0); layoutTable->addWidget(cmbProblemType, 4, 1); layoutTable->addWidget(new QLabel(tr("Type of analysis:")), 5, 0); layoutTable->addWidget(cmbAnalysisType, 5, 1); layoutTable->addWidget(new QLabel(tr("Adaptivity:")), 6, 0); layoutTable->addWidget(cmbAdaptivityType, 6, 1); layoutTable->addWidget(new QLabel(tr("Linearity:")), 7, 0); layoutTable->addWidget(cmbLinearityType, 7, 1); layoutTable->addWidget(new QLabel(tr("Linear solver:")), 8, 0); layoutTable->addWidget(cmbMatrixSolver, 8, 1); // harmonic analysis QGridLayout *layoutHarmonicAnalysis = new QGridLayout(); layoutHarmonicAnalysis->setColumnMinimumWidth(0, minWidth); layoutHarmonicAnalysis->addWidget(new QLabel(tr("Frequency (Hz):")), 0, 0); layoutHarmonicAnalysis->addWidget(txtFrequency, 0, 1); QGroupBox *grpHarmonicAnalysis = new QGroupBox(tr("Harmonic analysis")); grpHarmonicAnalysis->setLayout(layoutHarmonicAnalysis); // harmonic analysis QGridLayout *layoutTransientAnalysis = new QGridLayout(); layoutTransientAnalysis->setColumnMinimumWidth(0, minWidth); layoutTransientAnalysis->setColumnStretch(1, 1); layoutTransientAnalysis->addWidget(new QLabel(tr("Time step (s):")), 0, 0); layoutTransientAnalysis->addWidget(txtTransientTimeStep, 0, 1); layoutTransientAnalysis->addWidget(new QLabel(tr("Total time (s):")), 1, 0); layoutTransientAnalysis->addWidget(txtTransientTimeTotal, 1, 1); layoutTransientAnalysis->addWidget(new QLabel(tr("Initial condition:")), 2, 0); layoutTransientAnalysis->addWidget(txtTransientInitialCondition, 2, 1); layoutTransientAnalysis->addWidget(new QLabel(tr("Steps:")), 3, 0); layoutTransientAnalysis->addWidget(lblTransientSteps, 3, 1); QGroupBox *grpTransientAnalysis = new QGroupBox(tr("Transient analysis")); grpTransientAnalysis->setLayout(layoutTransientAnalysis); // harmonic analysis QGridLayout *layoutMesh = new QGridLayout(); layoutMesh->setColumnMinimumWidth(0, minWidth); layoutMesh->setColumnStretch(1, 1); layoutMesh->addWidget(new QLabel(tr("Mesh type:")), 0, 0); layoutMesh->addWidget(cmbMeshType, 0, 1); layoutMesh->addWidget(new QLabel(tr("Number of refinements:")), 1, 0); layoutMesh->addWidget(txtNumberOfRefinements, 1, 1); layoutMesh->addWidget(new QLabel(tr("Polynomial order:")), 2, 0); layoutMesh->addWidget(txtPolynomialOrder, 2, 1); QGroupBox *grpMesh = new QGroupBox(tr("Mesh parameters")); grpMesh->setLayout(layoutMesh); // adaptivity QGridLayout *layoutAdaptivity = new QGridLayout(); layoutAdaptivity->setColumnMinimumWidth(0, minWidth); layoutAdaptivity->setColumnStretch(1, 1); layoutAdaptivity->addWidget(new QLabel(tr("Adaptivity steps:")), 0, 0); layoutAdaptivity->addWidget(txtAdaptivitySteps, 0, 1); layoutAdaptivity->addWidget(new QLabel(tr("Adaptivity tolerance (%):")), 1, 0); layoutAdaptivity->addWidget(txtAdaptivityTolerance, 1, 1); QGroupBox *grpAdaptivity = new QGroupBox(tr("Adaptivity")); grpAdaptivity->setLayout(layoutAdaptivity); // linearity QGridLayout *layoutLinearity = new QGridLayout(); layoutLinearity->setColumnMinimumWidth(0, minWidth); layoutLinearity->setColumnStretch(1, 1); layoutLinearity->addWidget(new QLabel(tr("Nonlin. tolerance (%):")), 0, 0); layoutLinearity->addWidget(txtLinearityNonlinearityTolerance, 0, 1); layoutLinearity->addWidget(new QLabel(tr("Nonlin. steps:")), 1, 0); layoutLinearity->addWidget(txtLinearityNonlinearitySteps, 1, 1); QGroupBox *grpLinearity = new QGroupBox(tr("Linearity")); grpLinearity->setLayout(layoutLinearity); grpLinearity->setVisible(Util::config()->showExperimentalFeatures); // left QVBoxLayout *layoutLeft = new QVBoxLayout(); layoutLeft->addLayout(layoutTable); // layoutLeft->addWidget(grpAdaptivity); layoutLeft->addStretch(); // layoutLeft->addWidget(grpLinearity); layoutLeft->addWidget(grpMesh); // right QVBoxLayout *layoutRight = new QVBoxLayout(); layoutRight->addWidget(grpHarmonicAnalysis); layoutRight->addWidget(grpTransientAnalysis); // layoutRight->addWidget(grpMesh); layoutRight->addWidget(grpAdaptivity); layoutRight->addWidget(grpLinearity); layoutRight->addStretch(); // both QHBoxLayout *layoutPanel = new QHBoxLayout(); layoutPanel->addLayout(layoutLeft); layoutPanel->addLayout(layoutRight); // name QGridLayout *layoutName = new QGridLayout(); layoutName->setColumnMinimumWidth(0, minWidth); layoutName->setColumnStretch(1, 1); layoutName->addWidget(new QLabel(tr("Name:")), 0, 0); layoutName->addWidget(txtName, 0, 1); // equation QGridLayout *layoutEquation = new QGridLayout(); layoutEquation->setColumnMinimumWidth(0, minWidth); layoutEquation->setColumnStretch(1, 1); layoutEquation->addWidget(new QLabel(tr("Equation:")), 0, 0); layoutEquation->addWidget(lblEquationPixmap, 0, 1, 1, 1, Qt::AlignLeft); QVBoxLayout *layoutProblem = new QVBoxLayout(); layoutProblem->addLayout(layoutName); layoutProblem->addLayout(layoutEquation); layoutProblem->addLayout(layoutPanel); QWidget *widMain = new QWidget(); widMain->setLayout(layoutProblem); return widMain; }