srecord noeq G22_RegionToSSIs(IImageRegion region) { L ssis; L get() { if (region == null) null; ssis = new L; Rect r = region.bounds(); int x1 = r.x1(), y1 = r.y1(), y2 = r.y2(), h = y2-y1, w = r.w; new L growingSSIs; for (int y = y1; y < y2; y++) { reMutable y; L streaks = genericStreaks(w, x -> region.contains(x1+x, y)); truncateList(growingSSIs, l(streaks)); for (range : dropFirst(streaks, l(growingSSIs))) { SSI ssi = new SSI(y); ssi.color(region.color()); int[] data = new[h*2]; l(streaks); growingSSIs.add(ssi); int i = (y-y1)*2; data[i] = x1+range.start; data[i+1] = x1+range.end; } ssi.data(data); ret ssi; } swappable IntRange selectHorizontalPart(L parts) { ret first(parts); } }