public WormSkeleton(WormClusterSkeleton wcs, WormPixelMatcher wpm) throws NotWormException { super(wcs.image, wcs.dt, wcs.w, wcs.h); if (wcs.getBasePoints().size() != 2) { System.out.println("NUM WORMS: " + wcs.numWorms); System.out.println("NUM BASE POINTS: " + wcs.getBasePoints()); throw new NotWormException("Wrong amount of base points. Must be exactly two"); } else { ArrayList<Integer> bp = wcs.getBasePoints(); this.basePoints = new int[2]; this.basePoints[0] = bp.get(0); this.basePoints[1] = bp.get(1); } this.skPoints = new ArrayList<Integer>(wcs.getSkPoints()); this.isSkPoint = new boolean[wpm.getH() * wpm.getW()]; this.isSkPoint = SkeletonUtils.listToMatrix(wpm.getH() * wpm.getW(), wcs.getSkPoints()); this.wpm = wpm; }
public WormSkeleton( EvPixels image, int[] dt, int w, int h, ArrayList<Integer> basePoints, ArrayList<Integer> skPoints, WormPixelMatcher wpm) throws NotWormException { super(image, dt, w, h); if (basePoints.size() != 2) throw new NotWormException("Wrong amount of base points. Must be exactly two"); else { this.basePoints = new int[2]; this.basePoints[0] = basePoints.get(0); this.basePoints[1] = basePoints.get(1); } this.skPoints = new ArrayList<Integer>(skPoints); this.isSkPoint = new boolean[wpm.getH() * wpm.getW()]; this.isSkPoint = SkeletonUtils.listToMatrix(wpm.getH() * wpm.getW(), skPoints); this.wpm = wpm; }