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

Method Equal

Modules/Multilabel/src/mitkLabelSetImage.cpp:1628–1720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1626}
1627
1628bool mitk::Equal(const mitk::MultiLabelSegmentation &leftHandSide,
1629 const mitk::MultiLabelSegmentation &rightHandSide,
1630 ScalarType eps,
1631 bool verbose)
1632{
1633 bool returnValue = true;
1634
1635 /* MultiLabelSegmentation members */
1636
1637 MITK_INFO(verbose) << "--- MultiLabelSegmentation Equal ---";
1638
1639 // m_LookupTable;
1640 const mitk::LookupTable* lhsLUT = leftHandSide.GetLookupTable();
1641 const mitk::LookupTable* rhsLUT = rightHandSide.GetLookupTable();
1642
1643 returnValue = *lhsLUT == *rhsLUT;
1644 if (!returnValue)
1645 {
1646 MITK_INFO(verbose) << "Lookup tables not equal.";
1647 return returnValue;
1648 ;
1649 }
1650
1651 // number groups
1652 returnValue = leftHandSide.GetNumberOfGroups() == rightHandSide.GetNumberOfGroups();
1653 if (!returnValue)
1654 {
1655 MITK_INFO(verbose) << "Number of groups not equal.";
1656 return false;
1657 }
1658
1659 // total number labels
1660 returnValue = leftHandSide.GetTotalNumberOfLabels() == rightHandSide.GetTotalNumberOfLabels();
1661 if (!returnValue)
1662 {
1663 MITK_INFO(verbose) << "Total number of labels not equal.";
1664 return false;
1665 }
1666
1667 // active group
1668 returnValue = leftHandSide.GetActiveLayer() == rightHandSide.GetActiveLayer();
1669 if (!returnValue)
1670 {
1671 MITK_INFO(verbose) << "Active group not equal.";
1672 return false;
1673 }
1674
1675 if (leftHandSide.GetTotalNumberOfLabels() != rightHandSide.GetTotalNumberOfLabels())
1676 {
1677 MITK_INFO(verbose) << "Number of labels are not equal.";
1678 return false;
1679 }
1680
1681 for (unsigned int groupIndex = 0; groupIndex < leftHandSide.GetNumberOfGroups(); groupIndex++)
1682 {
1683 if (4 == leftHandSide.GetDimension())
1684 {
1685 MITK_INFO(verbose) << "Can not compare image data for 4D images - skipping check.";

Callers

nothing calls this directly

Calls 12

GetNumberOfGroupsMethod · 0.80
GetActiveLayerMethod · 0.80
GetLabelValuesByGroupMethod · 0.80
EqualFunction · 0.50
GetLookupTableMethod · 0.45
GetDimensionMethod · 0.45
GetGroupImageMethod · 0.45
sizeMethod · 0.45
GetLabelMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected