| 134 | } |
| 135 | |
| 136 | void QmitkMonaiLabelToolGUI::OnModelChanged(const QString &modelName) |
| 137 | { |
| 138 | auto tool = this->GetConnectedToolAs<mitk::MonaiLabelTool>(); |
| 139 | if (nullptr == tool) |
| 140 | { |
| 141 | return; |
| 142 | } |
| 143 | m_Controls->labelListLabel->clear(); |
| 144 | mitk::MonaiModelInfo model = tool->GetModelInfoFromName(modelName.toStdString()); |
| 145 | if (model.IsInteractive()) |
| 146 | { |
| 147 | this->WriteStatusMessage("Interactive model selected. Please press SHIFT + click on the render windows.\n"); |
| 148 | m_Controls->previewButton->setEnabled(false); |
| 149 | this->DisplayWidgets(false); |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | this->WriteStatusMessage("Auto-segmentation model selected. Please click on Preview.\n"); |
| 154 | m_Controls->previewButton->setEnabled(true); |
| 155 | this->DisplayWidgets(true); |
| 156 | } |
| 157 | auto selectedModel = m_Controls->modelBox->currentText().toStdString(); |
| 158 | for (const auto &modelObject : tool->GetInfoParameters()->models) |
| 159 | { |
| 160 | if (modelObject.name == selectedModel) |
| 161 | { |
| 162 | auto requestObject = std::make_unique<mitk::MonaiLabelRequest>(); |
| 163 | requestObject->model = modelObject; |
| 164 | requestObject->hostName = tool->GetInfoParameters()->hostName; |
| 165 | requestObject->port = tool->GetInfoParameters()->port; |
| 166 | if (modelObject.IsInteractive()) // set only if interactive model |
| 167 | { |
| 168 | tool->m_RequestParameters = std::move(requestObject); |
| 169 | } |
| 170 | QStringList supportedLabels; |
| 171 | for (const auto &label : modelObject.labels) |
| 172 | { |
| 173 | supportedLabels << QString::fromStdString(label.first); |
| 174 | } |
| 175 | m_Controls->labelListLabel->setText(supportedLabels.join(QStringLiteral(", "))); |
| 176 | break; |
| 177 | } |
| 178 | } |
| 179 | tool->MonaiStatusEvent += |
| 180 | mitk::MessageDelegate1<QmitkMonaiLabelToolGUI, const bool>(this, &QmitkMonaiLabelToolGUI::StatusMessageListener); |
| 181 | } |
| 182 | |
| 183 | void QmitkMonaiLabelToolGUI::OnFetchBtnClicked() |
| 184 | { |
nothing calls this directly
no test coverage detected