public Master(IBitmap reference) { Reference = reference; var m = new int[reference.Width * reference.Height]; m.Fill(-1); var l = new List <VectorInt2>(); var cc = 0; foreach (var position in reference.TruePositions()) { l.Add(position); m[reference.ToLinearSpace(position)] = cc++; } MapOut = l.ToImmutableList(); MapIn = m.ToImmutableArray(); }