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

Method SetSegmentation

Modules/SegmentationUI/src/QmitkMultiLabelTreeModel.cpp:776–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774
775
776void QmitkMultiLabelTreeModel::SetSegmentation(mitk::MultiLabelSegmentation* segmentation)
777{
778 if (m_Segmentation != segmentation)
779 {
780 // Keep the old segmentation alive until observer guards are properly reset in AddObserver().
781 // Without this, the assignment below may drop the last reference to the old segmentation,
782 // destroying it before AddObserver() can unregister the old observers. That leads to
783 // dangling pointers in the ITKEventObserverGuard's WeakPointer and a crash in Lock()
784 auto previousSegmentation = m_Segmentation;
785
786 this->m_Segmentation = segmentation;
787 this->AddObserver();
788
789 this->UpdateInternalTree();
790 }
791}
792
793
794/**Helper function that adds a labek into the item tree. Passes back the new created instance iten*/

Callers 10

GetterSetterTestMethod · 0.80
AddingLabelTestMethod · 0.80
AddingLayerTestMethod · 0.80
RenameGroupTestMethod · 0.80
RemovingLabelTestMethod · 0.80
RemovingLayerTestMethod · 0.80
ModifyLabelNameTestMethod · 0.80
ModifyLabelTestMethod · 0.80
InitializeMethod · 0.80
from_jsonFunction · 0.80

Calls 2

AddObserverMethod · 0.95
UpdateInternalTreeMethod · 0.95

Tested by 9

GetterSetterTestMethod · 0.64
AddingLabelTestMethod · 0.64
AddingLayerTestMethod · 0.64
RenameGroupTestMethod · 0.64
RemovingLabelTestMethod · 0.64
RemovingLayerTestMethod · 0.64
ModifyLabelNameTestMethod · 0.64
ModifyLabelTestMethod · 0.64
InitializeMethod · 0.64