MCPcopy Create free account
hub / github.com/MITK/MITK / OnFetchBtnClicked

Method OnFetchBtnClicked

Modules/SegmentationUI/src/QmitkMonaiLabelToolGUI.cpp:183–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void QmitkMonaiLabelToolGUI::OnFetchBtnClicked()
184{
185 m_Controls->previewButton->setEnabled(false);
186 m_Controls->labelListLabel->clear();
187 auto reply = QMessageBox::question(this, "Confirm", ::CONFIRM_QUESTION_TEXT, QMessageBox::Yes | QMessageBox::No);
188 if (reply == QMessageBox::No)
189 {
190 MITK_INFO << "Didn't went ahead with Monai Label inferencing";
191 return;
192 }
193 auto tool = this->GetConnectedToolAs<mitk::MonaiLabelTool>();
194 if (nullptr == tool)
195 {
196 return;
197 }
198 QString urlString = m_Controls->urlBox->text();
199 QUrl url(urlString);
200 if (url.isValid() && !url.isLocalFile() && !url.hasFragment() && !url.hasQuery()) // sanity check
201 {
202 std::string hostName = url.host().toStdString();
203 int port = url.port();
204 try
205 {
206 tool->FetchOverallInfo(hostName, port);
207 bool allowAllModels = m_Preferences->GetBool("monailabel allow all models", false);
208 this->PopulateUI(allowAllModels);
209 auto timeout_sec = std::make_unsigned_t<int>(m_Preferences->GetInt("monailabel timeout", 180));
210 tool->SetTimeout(timeout_sec);
211 }
212 catch (const mitk::Exception &e)
213 {
214 m_Controls->appBox->clear();
215 m_Controls->modelBox->clear();
216 MITK_ERROR << e.GetDescription();
217 this->WriteErrorMessage(e.GetDescription());
218 }
219 }
220 else
221 {
222 std::string invalidURLMessage = "Invalid URL entered: " + urlString.toStdString();
223 MITK_ERROR << invalidURLMessage;
224 this->ShowErrorMessage(invalidURLMessage);
225 }
226}
227
228void QmitkMonaiLabelToolGUI::OnPreviewBtnClicked()
229{

Callers

nothing calls this directly

Calls 10

PopulateUIMethod · 0.95
WriteErrorMessageMethod · 0.95
ShowErrorMessageMethod · 0.95
textMethod · 0.80
FetchOverallInfoMethod · 0.80
GetBoolMethod · 0.80
setEnabledMethod · 0.45
clearMethod · 0.45
GetIntMethod · 0.45
GetDescriptionMethod · 0.45

Tested by

no test coverage detected