1. Image Region Decomposition
    1. Flattened Image
    2. Basic Regions
    3. Remove tiny islands
    4. Reduced Regions

Image Region Decomposition

Flattened Image

Code from SegmentStyle.scala:175 executed in 712.94 seconds (0.433 gc):

    SegmentUtil.flattenColors(image_tensor,
      topology,
      affinity.wrap((graphEdges: util.List[Array[Int]], innerResult: util.List[Array[Double]]) =>
        adjust(graphEdges, innerResult, degree(innerResult), 0.5)), 3, solver)

Logging:

    Connectivity Statistics: IntSummaryStatistics{count=450000, sum=3323155, min=1, average=7.384789, max=20}
    Connectivity Histogram: {
      "1" : 2444,
      "2" : 2721,
      "3" : 2977,
      "4" : 6896,
      "5" : 16406,
      "6" : 122413,
      "7" : 110798,
      "8" : 79784,
      "9" : 51004,
      "10" : 28803,
      "11" : 14599,
      "12" : 6708,
      "13" : 2819,
      "14" : 1081,
      "15" : 361,
      "16" : 135,
      "17" : 40,
      "18" : 9,
      "19" : 1,
      "20" : 1
    }
    Spatial Distance Statistics: DoubleSummaryStatistics{count=3323155, sum=5610151.003414, min=0.000000, average=1.688200, max=7.810250}
    Spatial Distance Histogram: {
      "0" : 449011,
      "1" : 1134514,
      "2" : 1235916,
      "3" : 410756,
      "4" : 59218,
      "5" : 13806,
      "6" : 11578,
      "7" : 6454,
      "8" : 1902
    }
    Color Distance Statistics: DoubleSummaryStatistics{count=3323155, sum=52263.264999, min=0.000000, average=0.015727, max=0.099804}
    

Returns:

Result

Basic Regions

Code from SegmentStyle.scala:194 executed in 0.17 seconds (0.000 gc):

    paintWithRandomColors(topology_simple, image_tensor, pixelMap, graph)

Returns:

Result

Remove tiny islands

Code from SegmentStyle.scala:199 executed in 0.30 seconds (0.000 gc):

    var projection1 = removeTinyInclusions(pixelMap, graph, 4)
    graph = graph.project(projection1).assertSymmetric()
    pixelMap = pixelMap.map(projection1(_))
    val activeRows = graph.activeRows()
    graph = graph.select(activeRows).assertSymmetric()
    var projection2 = activeRows.zipWithIndex.toMap
    pixelMap = pixelMap.map(projection2.get(_).getOrElse(0))
    paintWithRandomColors(topology_simple, image_tensor, pixelMap, graph)

Returns:

Result

Reduced Regions

Code from SegmentStyle.scala:211 executed in 15.67 seconds (0.043 gc):

    val regionAssembler = volumeEntropy(graph, pixelMap, image_tensor, topology_simple).reduceTo(5000)
    graph = graph.project(regionAssembler.getProjection)
    pixelMap = regionAssembler.getPixelMap
    val activeRows = graph.activeRows()
    graph = graph.select(activeRows).assertSymmetric()
    val projection = activeRows.zipWithIndex.toMap
    pixelMap = pixelMap.map(projection.get(_).getOrElse(0))
    paintWithRandomColors(topology_simple, image_tensor, pixelMap, graph)

Returns:

Result

Code from SegmentStyle.scala:231 executed in 97.73 seconds (0.298 gc):

    RegionAssembler.epidemic(graph, pixelMap, image_tensor, topology_simple,
      seedMarks.map(t => t._1.asInstanceOf[Integer] -> t._2.asInstanceOf[Integer]).asJava
    ).reduceTo(1).regions.asScala.flatMap(region =>
      region.original_regions.asScala.map(_.toInt -> region.marks)
    ).toMap.filter(_._2.size() == 1).mapValues(_.asScala.head.toInt)

Returns:

    Map(2163 -> 1, 645 -> 1, 892 -> 1, 69 -> 1, 2199 -> 1, 3021 -> 1, 1322 -> 1, 1665 -> 1, 1036 -> 1, 2822 -> 1, 2630 -> 1, 3873 -> 1, 4188 -> 1, 1586 -> 1, 1501 -> 1, 4201 -> 1, 2452 -> 1, 809 -> 1, 4560 -> 0, 4447 -> 1, 3962 -> 1, 1879 -> 1, 1337 -> 1, 1718 -> 1, 2094 -> 1, 3944 -> 1, 1411 -> 1, 629 -> 1, 3883 -> 1, 2612 -> 1, 4094 -> 1, 1024 -> 1, 1469 -> 1, 365 -> 1, 2744 -> 1, 1369 -> 1, 4835 -> 0, 138 -> 0, 2889 -> 1, 1823 -> 1, 1190 -> 1, 1168 -> 0, 2295 -> 1, 2306 -> 1, 4571 -> 1, 3053 -> 1, 4101 -> 0, 4450 -> 1, 3345 -> 1, 760 -> 0, 4005 -> 1, 4464 -> 1, 2341 -> 1, 101 -> 1, 2336 -> 1, 3008 -> 1, 2109 -> 1, 4824 -> 0, 2131 -> 1, 1454 -> 1, 4909 -> 0, 2031 -> 1, 1633 -> 1, 2778 -> 1, 2072 -> 1, 4262 -> 1, 3661 -> 1, 4062 -> 1, 1767 -> 1, 3399 -> 1, 1995 -> 1, 2263 -> 1, 3930 -> 1, 4169 -> 1, 479 -> 1, 4899 -> 0, 3798 -> 1, 1559 -> 1, 1105 -> 1, 347 -> 1, 3666 -> 1, 4729 -> 1, 4022 -> 1, 1729 -> 1, 3434 -> 1, 3167 -> 1, 2412 -> 1, 2876 -> 1, 1237 -> 1, 846 -> 1, 4183 -> 1, 909 -> 1, 2921 -> 1, 4290 -> 1, 3477 -> 1, 3698 -> 1, 333 -> 1, 628 -> 1, 3979 -> 1, 1031 -> 1, 249 -> 1, 2463 -> 1, 3397 -> 1, 1899 -> 1, 893 -> 1, 1840 -> 1, 3581 -> 1, 4852 -> 0, 1315 -> 1, 3863 -> 1, 3830 -> 1, 2787 -> 1, 2595 -> 1, 518 -> 1, 1850 -> 1, 2499 -> 1, 2427 -> 1, 2480 -> 1, 3969 -> 1, 1083 -> 1, 962 -> 1, 1982 -> 1, 468 -> 1, 2559 -> 1, 3449 -> 1, 4015 -> 1, 234 -> 1, 2544 -> 1, 941 -> 1, 0 -> 0, 3927 -> 1, 1179 -> 1, 2331 -> 1, 4682 -> 0, 777 -> 1, 3566 -> 1, 555 -> 0, 4728 -> 1, 666 -> 1, 4877 -> 0, 1818 -> 1, 1295 -> 1, 1956 -> 1, 1950 -> 1, 4992 -> 0, 88 -> 1, 1549 -> 1, 2280 -> 1, 1554 -> 1, 4904 -> 0, 1110 -> 1, 3172 -> 1, 1686 -> 1, 481 -> 1, 4166 -> 1, 352 -> 1, 2250 -> 1, 2363 -> 1, 1855 -> 1, 3680 -> 1, 1200 -> 1, 2077 -> 1, 4043 -> 1, 3534 -> 1, 4931 -> 1, 1750 -> 1, 3185 -> 1, 408 -> 1, 977 -> 1, 170 -> 1, 3681 -> 1, 1211 -> 1, 3990 -> 1, 4714 -> 0, 523 -> 1, 4037 -> 1, 1158 -> 1, 2309 -> 1, 2512 -> 1, 582 -> 1, 2976 -> 1, 762 -> 1, 4376 -> 1, 3072 -> 1, 1924 -> 1, 1005 -> 1, 2210 -> 1, 2117 -> 1, 2940 -> 1, 1596

...skipping 49734 bytes...

     3812 -> 1, 3494 -> 1, 442 -> 0, 4345 -> 1, 871 -> 1, 4501 -> 1, 1505 -> 1, 1399 -> 1, 4271 -> 1, 3918 -> 1, 2270 -> 1, 1621 -> 1, 4088 -> 1, 1120 -> 0, 4221 -> 1, 501 -> 1, 4363 -> 1, 2372 -> 1, 369 -> 0, 607 -> 1, 2138 -> 1, 3341 -> 1, 4674 -> 0, 3753 -> 1, 4533 -> 1, 3901 -> 1, 90 -> 1, 111 -> 1, 3013 -> 1, 3526 -> 1, 3960 -> 1, 1331 -> 1, 254 -> 1, 227 -> 1, 1606 -> 1, 3474 -> 1, 3528 -> 1, 2754 -> 1, 4335 -> 1, 322 -> 1, 4826 -> 1, 486 -> 1, 4655 -> 0, 2672 -> 1, 2879 -> 1, 2640 -> 1, 803 -> 1, 3437 -> 1, 3950 -> 1, 4779 -> 0, 3580 -> 1, 3461 -> 1, 1320 -> 1, 337 -> 1, 122 -> 1, 4520 -> 1, 4274 -> 1, 2321 -> 1, 4642 -> 0, 1653 -> 1, 3227 -> 1, 469 -> 1, 1944 -> 1, 4702 -> 0, 1367 -> 1, 940 -> 1, 4627 -> 1, 4584 -> 1, 1962 -> 1, 2563 -> 1, 3924 -> 1, 2881 -> 1, 3626 -> 1, 354 -> 1, 4891 -> 0, 83 -> 1, 935 -> 1, 1945 -> 1, 3212 -> 1, 3299 -> 1, 1009 -> 1, 4723 -> 0, 4555 -> 1, 923 -> 1, 3096 -> 1, 3854 -> 1, 2206 -> 1, 4784 -> 0, 1737 -> 1, 1681 -> 1, 2887 -> 1, 4949 -> 0, 4767 -> 0, 1184 -> 1, 3405 -> 1, 2074 -> 1, 309 -> 1, 2690 -> 1, 1463 -> 1, 659 -> 1, 2998 -> 1, 1565 -> 1, 543 -> 1, 2018 -> 1, 2866 -> 1, 4161 -> 1, 2832 -> 1, 4547 -> 0, 2436 -> 1, 1848 -> 1, 2059 -> 1, 215 -> 1, 2438 -> 1, 2238 -> 1, 4752 -> 0, 1037 -> 1, 4742 -> 0, 2297 -> 1, 4313 -> 1, 775 -> 1, 560 -> 1, 3443 -> 1, 1416 -> 1, 639 -> 1, 3432 -> 1, 2615 -> 1, 1769 -> 1, 4977 -> 1, 4423 -> 1, 4908 -> 0, 1917 -> 1, 755 -> 1, 676 -> 1, 2453 -> 1, 4056 -> 1, 3052 -> 1, 3637 -> 1, 4863 -> 0, 3316 -> 1, 2170 -> 1, 2834 -> 1, 2351 -> 1, 4189 -> 1, 491 -> 1, 1088 -> 1, 2993 -> 1, 3200 -> 1, 2191 -> 1, 1204 -> 0, 1449 -> 1, 1812 -> 1, 2106 -> 1, 222 -> 1, 2087 -> 1, 3933 -> 1, 3553 -> 1, 4459 -> 1, 592 -> 1, 4858 -> 0, 1468 -> 1, 3047 -> 1, 2470 -> 1, 496 -> 1, 3721 -> 1, 454 -> 1, 4174 -> 1, 1069 -> 1, 364 -> 1, 3296 -> 1, 4940 -> 0, 708 -> 1, 232 -> 1, 1912 -> 1, 2980 -> 1, 3035 -> 1, 3575 -> 1, 882 -> 1, 4552 -> 0, 2177 -> 1, 100 -> 1, 4298 -> 1, 2655 -> 1, 4002 -> 1, 1014 -> 1, 1417 -> 1, 1870 -> 1, 3669 -> 1, 4734 -> 0, 972 -> 1, 2771 -> 1)

Selection mask