| 1839 | } |
| 1840 | |
| 1841 | inline TOutputpixel operator()(const TDestinationPixel& existingDestinationValue, const TSourcePixel& existingSourceValue) |
| 1842 | { |
| 1843 | if (existingSourceValue == this->m_SourceLabel) |
| 1844 | { |
| 1845 | if (mitk::MultiLabelSegmentation::OverwriteStyle::IgnoreLocks == this->m_OverwriteStyle) |
| 1846 | { |
| 1847 | return this->m_NewDestinationLabel; |
| 1848 | } |
| 1849 | else |
| 1850 | { |
| 1851 | if (existingDestinationValue == m_DestinationBackground) |
| 1852 | { |
| 1853 | if (!m_DestinationBackgroundLocked) |
| 1854 | { |
| 1855 | return this->m_NewDestinationLabel; |
| 1856 | } |
| 1857 | } |
| 1858 | else |
| 1859 | { |
| 1860 | auto labelFinding = this->m_DestinationLabels.find(existingDestinationValue); |
| 1861 | if (labelFinding==this->m_DestinationLabels.end() || !labelFinding->second->GetLocked()) |
| 1862 | { |
| 1863 | return this->m_NewDestinationLabel; |
| 1864 | } |
| 1865 | } |
| 1866 | } |
| 1867 | } |
| 1868 | else if (mitk::MultiLabelSegmentation::MergeStyle::Replace == this->m_MergeStyle |
| 1869 | && existingSourceValue == this->m_SourceBackground |
| 1870 | && existingDestinationValue == this->m_NewDestinationLabel |
| 1871 | && (mitk::MultiLabelSegmentation::OverwriteStyle::IgnoreLocks == this->m_OverwriteStyle |
| 1872 | || !this->m_DestinationBackgroundLocked)) |
| 1873 | { |
| 1874 | return this->m_DestinationBackground; |
| 1875 | } |
| 1876 | |
| 1877 | return existingDestinationValue; |
| 1878 | } |
| 1879 | |
| 1880 | private: |
| 1881 | ConstLabelMapType m_DestinationLabels; |