Move SSD truth cell id set to typed Kotlin

ober

bf3fc32ed11406236a40aebf17f87bc4cad9bcbc

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index 35b3c5c..a0c462c 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -486,6 +486,7 @@
                 ssdSessionFindGroupById ssdSessionSelectedGroup
                 ssdSessionSelectedGroupId ssdSessionRelativeGroupId
                 ssdSessionCellIdsForGroupId
+                ssdSessionCellIdSet
                 ssdSessionFindCellById ssdSessionCellsByIds
                 ssdSessionBBoxForCellIds ssdSessionRecomputeGroup
                 appendUniqueCellIdsToGroup
@@ -741,6 +742,12 @@
             (if (nullable-null? group)
               (mutable-list-empty String)
               (SsdGroup-cellIds (nullable-get group)))))
+        (def (ssdSessionCellIdSet (session : SsdSession)) : (MutableSet String)
+          (for/fold ((ids (mutable-set-empty String)))
+                    ((i (in-range (int32 0) (list-size (SsdSession-cells session)))))
+            (begin
+              (mutable-set-add! ids (SsdCell-id (list-ref (SsdSession-cells session) i)))
+              ids)))
         (def (ssdSessionCellsByIds (session : SsdSession)
                                    (ids : (List String))) : (MutableList SsdCell)
           (for/fold ((out (mutable-list-empty SsdCell)))
@@ -5962,7 +5969,7 @@
 	       "        val truth = loadTruth(session) ?: return"
 	       "        session.ssdArea = jsonRect(truth.optJSONArray(\"ssd_area\"))"
 	       "        val groups = truth.optJSONArray(\"groups\") ?: JSONArray()"
-       "        val cellIds = session.cells.map { it.id }.toMutableSet()"
+       "        val cellIds = ssdSessionCellIdSet(session)"
        "        for (i in 0 until groups.length()) {"
        "            val (group, truthCells) = ssdGroupFromTruthJson(groups.getJSONObject(i))"
        "            remapAndAddTruthCells(session, group, truthCells, cellIds)"