| 649 | |
| 650 | |
| 651 | void mitk::MultiLabelSegmentation::SetActiveLabel(LabelValueType label) |
| 652 | { |
| 653 | // The active label is soft selection state that UI/async model churn can |
| 654 | // request for a value that was just removed. Accepting such a value would |
| 655 | // either leave m_ActiveLabelValue referring to a label that no longer |
| 656 | // exists or throw in GetGroupIndexOfLabel below, so it is ignored, keeping |
| 657 | // the previous selection, and reported instead of being fatal. |
| 658 | if (UNLABELED_VALUE != label && !this->ExistLabel(label)) |
| 659 | { |
| 660 | MITK_WARN << "Ignored request to activate a label that does not exist. Invalid label value: " << label; |
| 661 | return; |
| 662 | } |
| 663 | |
| 664 | if (m_ActiveLabelValue != label) |
| 665 | { |
| 666 | bool eventNeeded = false; |
| 667 | if (UNLABELED_VALUE == m_ActiveLabelValue || UNLABELED_VALUE == label || !this->ExistLabel(m_ActiveLabelValue)) |
| 668 | { |
| 669 | eventNeeded = true; |
| 670 | } |
| 671 | else if (this->GetGroupIndexOfLabel(m_ActiveLabelValue) != this->GetGroupIndexOfLabel(label)) |
| 672 | { |
| 673 | eventNeeded = true; |
| 674 | } |
| 675 | |
| 676 | m_ActiveLabelValue = label; |
| 677 | Modified(); |
| 678 | |
| 679 | if (eventNeeded) |
| 680 | { |
| 681 | AfterChangeLayerEvent.Send(); |
| 682 | } |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | void mitk::MultiLabelSegmentation::ClearGroupImage(GroupIndexType groupID) |
| 687 | { |