| 1772 | * @pre every label in the vector has a unique value.*/ |
| 1773 | using ConstLabelMapType = std::map<mitk::MultiLabelSegmentation::LabelValueType, mitk::Label::ConstPointer>; |
| 1774 | ConstLabelMapType ConvertLabelVectorToMap(const mitk::ConstLabelVector& labelV) |
| 1775 | { |
| 1776 | ConstLabelMapType result; |
| 1777 | for (auto label : labelV) |
| 1778 | { |
| 1779 | const auto value = label->GetValue(); |
| 1780 | auto finding = result.find(value); |
| 1781 | if (finding != result.end()) mitkThrow() << "Operation failed. Cannot convert label vector into label map, because at least one label value is not unique. Violating label value: " << value; |
| 1782 | result.insert(std::make_pair(value, label)); |
| 1783 | } |
| 1784 | |
| 1785 | return result; |
| 1786 | } |
| 1787 | |
| 1788 | |
| 1789 | /** Functor class that implements the label transfer and is used in conjunction with the itk::BinaryFunctorImageFilter. |
no test coverage detected