| 840 | } |
| 841 | |
| 842 | void mitk::MultiLabelSegmentation::RemoveLabel(LabelValueType pixelValue) |
| 843 | { |
| 844 | GroupIndexType groupID = 0; |
| 845 | { |
| 846 | std::lock_guard<std::shared_mutex> guard(m_LabelNGroupMapsMutex); |
| 847 | if (m_LabelMap.find(pixelValue) == m_LabelMap.end()) return; |
| 848 | |
| 849 | groupID = this->GetGroupIndexOfLabel(pixelValue); |
| 850 | |
| 851 | //first erase the pixel content (also triggers a LabelModified event) |
| 852 | this->EraseLabel(pixelValue); |
| 853 | this->RemoveLabelFromMap(pixelValue); |
| 854 | |
| 855 | |
| 856 | if (m_ActiveLabelValue == pixelValue) |
| 857 | { |
| 858 | this->SetActiveLabel(0); |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | this->InvokeEvent(LabelRemovedEvent(pixelValue)); |
| 863 | this->InvokeEvent(LabelsChangedEvent({ pixelValue })); |
| 864 | this->InvokeEvent(GroupModifiedEvent(groupID)); |
| 865 | } |
| 866 | |
| 867 | void mitk::MultiLabelSegmentation::RemoveLabelFromMap(LabelValueType pixelValue) |
| 868 | { |