| 401 | } |
| 402 | |
| 403 | void mitk::MultiLabelSegmentationVtkMapper3D::Update(mitk::BaseRenderer *renderer) |
| 404 | { |
| 405 | auto localStorage = m_LSH.GetLocalStorage(renderer); |
| 406 | const auto* node = this->GetDataNode(); |
| 407 | |
| 408 | if (nullptr == localStorage || nullptr == node) |
| 409 | { |
| 410 | return; |
| 411 | } |
| 412 | |
| 413 | bool visible = true; |
| 414 | node->GetVisibility(visible, renderer, "visible"); |
| 415 | |
| 416 | bool hide3Dvisualize = false; |
| 417 | node->GetBoolProperty("org.mitk.multilabel.3D.hide", hide3Dvisualize, renderer); |
| 418 | |
| 419 | const auto pref3DRendering = nullptr != localStorage->m_SegPreferences ? localStorage->m_SegPreferences->GetBool("activate 3D rendering", true) : true; |
| 420 | const auto changed3DRendering = pref3DRendering != localStorage->m_3DRenderingPreference; |
| 421 | localStorage->m_3DRenderingPreference = pref3DRendering; |
| 422 | |
| 423 | // The "opacity factor" is a global preference (no MTime), so detect a change by |
| 424 | // comparing against the value baked into the current LUT. m_LastOpacityFactor is |
| 425 | // refreshed in UpdateLookupTable, which the matching isLookupModified check in |
| 426 | // GenerateDataForRenderer forces to run once this flag opens the regeneration gate. |
| 427 | const auto changedOpacityFactor = GetOpacityFactor(localStorage->m_SegPreferences) != localStorage->m_LastOpacityFactor; |
| 428 | |
| 429 | // Detect a change in the resolved smoothing state so a preference flip |
| 430 | // (without any per-node property change) still triggers re-extraction. |
| 431 | // m_LastSmoothed reflects the smoothing of the cached polydata, so it is only |
| 432 | // updated after a successful re-extraction in GenerateDataForRenderer. Reading |
| 433 | // it before the early-return paths below is intentional: comparing the resolved |
| 434 | // request against the cache is the correct staleness check, and on the unhide |
| 435 | // frame the visibility-property MTime independently triggers GenerateDataForRenderer |
| 436 | // (its inner visibilityChanged path forces all groups to refresh). |
| 437 | const auto changedSmoothed = ResolveSmoothed(node, renderer) != localStorage->m_LastSmoothed; |
| 438 | |
| 439 | if (!visible |
| 440 | || hide3Dvisualize |
| 441 | || !pref3DRendering) |
| 442 | { |
| 443 | // Nothing to see. Clear the actor. We regenerate its contents later if necessary. |
| 444 | localStorage->m_Actors = vtkSmartPointer<vtkPropAssembly>::New(); |
| 445 | return; |
| 446 | } |
| 447 | |
| 448 | auto *segmentation = dynamic_cast<mitk::MultiLabelSegmentation *>(node->GetData()); |
| 449 | |
| 450 | if (segmentation == nullptr || segmentation->IsInitialized() == false) |
| 451 | { |
| 452 | // Nothing to see. Clear the actor. We regenerate its contents later if necessary. |
| 453 | localStorage->m_Actors = vtkSmartPointer<vtkPropAssembly>::New(); |
| 454 | return; |
| 455 | } |
| 456 | |
| 457 | // Calculate time step of the segmentation data for the specified renderer (integer value) |
| 458 | this->CalculateTimeStep(renderer); |
| 459 | |
| 460 | // Check if time step is valid |
no test coverage detected