code: function (filter) {
          if (!this.image) return null;
  
          var i, j, points, len, plen, c,
              image = this.image,
              dx = image.globalOffset.x + Math.round(this.layer.map.minPx.x),
              dy = image.globalOffset.y + Math.round(this.layer.map.minPx.y),
              contours = MagicWand.traceContours(image),
              result = [];
  
          if (this.layer.simplifyTolerant > 0) contours = MagicWand.simplifyContours(contours, this.layer.simplifyTolerant, this.layer.simplifyCount);
          len = contours.length;
          for (i = 0; i < len; i++) {
              c = contours[i];
              points = c.points;
              plen = points.length;
              c.initialCount = c.initialCount || plen;
              if (filter && filter(c) === false) continue;
              for (j = 0; j < plen; j++) {
                  points[j].x += dx;
                  points[j].y += dy;
              }
              result.push(contours[i]);
          }
          return result;
      }
docs: Method: getContours
  Return contours of image (binary mask) by filter