(int count, double outSpacing)
| 708 | } |
| 709 | |
| 710 | void makePolygon(int count, double outSpacing) { |
| 711 | int[] x = new int[4]; |
| 712 | int[] y = new int[4]; |
| 713 | Calibration cal = imp.getCalibration(); |
| 714 | double cx = cal.pixelWidth; //corrects preview for x calibration |
| 715 | double cy = cal.pixelHeight; //corrects preview for y calibration |
| 716 | x[0] = (int)gx1; |
| 717 | y[0] = (int)gy1; |
| 718 | x[1] = (int)gx2; |
| 719 | y[1] = (int)gy2; |
| 720 | double dx = gx2 - gx1; |
| 721 | double dy = gy2 - gy1; |
| 722 | double nrm = Math.sqrt(dx*dx + dy*dy)/outSpacing; |
| 723 | double xInc = -(dy/(cx*nrm)); //cx scales the x increment |
| 724 | double yInc = (dx/(cy*nrm)); //cy scales the y increment |
| 725 | x[2] = x[1] + (int)(xInc*count); |
| 726 | y[2] = y[1] + (int)(yInc*count); |
| 727 | x[3] = x[0] + (int)(xInc*count); |
| 728 | y[3] = y[0] + (int)(yInc*count); |
| 729 | imp.setRoi(new PolygonRoi(x, y, 4, PolygonRoi.FREEROI)); |
| 730 | } |
| 731 | |
| 732 | int getOutputStackSize(double inSpacing, double outSpacing, int count) { |
| 733 | Roi roi = imp.getRoi(); |
no test coverage detected