| 213 | } |
| 214 | |
| 215 | void QmitknnInteractiveToolGUI::InitializeUI(QBoxLayout* mainLayout) |
| 216 | { |
| 217 | auto wrapperWidget = new QWidget(this); |
| 218 | mainLayout->addWidget(wrapperWidget); |
| 219 | m_Ui->setupUi(wrapperWidget); |
| 220 | |
| 221 | SetIcon(m_Ui->settingsButton, "Gear"); |
| 222 | SetIcon(m_Ui->resetButton, "Reset"); |
| 223 | SetIcon(m_Ui->undoButton, "Undo"); |
| 224 | SetIcon(m_Ui->positiveButton, "Positive"); |
| 225 | SetIcon(m_Ui->negativeButton, "Negative"); |
| 226 | |
| 227 | connect(m_Ui->initializeButton, &QPushButton::toggled, this, &Self::OnInitializeButtonToggled); |
| 228 | connect(m_Ui->settingsButton, &QPushButton::clicked, this, &Self::OnSettingsButtonClicked); |
| 229 | connect(m_Ui->resetButton, &QPushButton::clicked, this, &Self::OnResetInteractionsButtonClicked); |
| 230 | connect(m_Ui->undoButton, &QPushButton::clicked, this, &Self::OnUndoButtonClicked); |
| 231 | |
| 232 | this->InitializePromptType(); |
| 233 | this->InitializeInteractorButtons(); |
| 234 | |
| 235 | m_Ui->autoRefineCheckBox->setChecked(this->GetTool()->GetAutoRefine()); |
| 236 | connect(m_Ui->autoRefineCheckBox, &QCheckBox::toggled, this, &Self::OnAutoRefineCheckBoxToggled); |
| 237 | |
| 238 | m_Ui->autoZoomCheckBox->setChecked(this->GetTool()->GetAutoZoom()); |
| 239 | connect(m_Ui->autoZoomCheckBox, &QCheckBox::toggled, this, &Self::OnAutoZoomCheckBoxToggled); |
| 240 | |
| 241 | this->GetTool()->ConfirmCleanUpEvent += mitk::MessageDelegate1<QmitknnInteractiveToolGUI, bool>( |
| 242 | this, &QmitknnInteractiveToolGUI::OnConfirmCleanUp); |
| 243 | |
| 244 | this->GetTool()->PreviewUpdatedEvent += mitk::MessageDelegate<QmitknnInteractiveToolGUI>( |
| 245 | this, &QmitknnInteractiveToolGUI::OnPreviewUpdated); |
| 246 | |
| 247 | this->GetTool()->DeactivatedEvent += mitk::MessageDelegate<QmitknnInteractiveToolGUI>( |
| 248 | this, &QmitknnInteractiveToolGUI::OnToolDeactivated); |
| 249 | |
| 250 | this->GetTool()->SessionEndedEvent += mitk::MessageDelegate<QmitknnInteractiveToolGUI>( |
| 251 | this, &QmitknnInteractiveToolGUI::OnSessionEnded); |
| 252 | |
| 253 | this->GetTool()->SessionExpiredEvent += mitk::MessageDelegate<QmitknnInteractiveToolGUI>( |
| 254 | this, &QmitknnInteractiveToolGUI::OnSessionExpired); |
| 255 | |
| 256 | // Drives the remote keep-alive heartbeat. Started on a successful remote |
| 257 | // initialization (see OnInitializeButtonToggled) and stopped on session end |
| 258 | // or expiry. |
| 259 | m_HeartbeatTimer = new QTimer(this); |
| 260 | connect(m_HeartbeatTimer, &QTimer::timeout, this, &Self::OnHeartbeatTimeout); |
| 261 | |
| 262 | this->UpdateModelLicenseDisplay(std::nullopt); |
| 263 | |
| 264 | Superclass::InitializeUI(mainLayout); |
| 265 | |
| 266 | // TODO: Once we agree on a common shortcut concept, the confirm binding |
| 267 | // should be moved to the base class. |
| 268 | |
| 269 | auto confirmButton = this->GetConfirmSegmentationButton(); |
| 270 | |
| 271 | BindShortcut(this, RESET_KEY, m_Ui->resetButton, "Press %1 to reset all interactions"); |
| 272 | BindShortcut(this, UNDO_KEY, m_Ui->undoButton, "Press %1 to undo the last interaction"); |
nothing calls this directly
no test coverage detected