コード例 #1
0
ファイル: SummedAreaTable.java プロジェクト: xen-0/dawnsci
 /**
  * private static final so that compiler will inline it
  *
  * @param box
  * @return coords
  */
 private static final int[] createCoords(IRectangularROI box) {
   return new int[] {
     box.getIntPoint()[0],
     box.getIntPoint()[1],
     box.getIntPoint()[0] + box.getIntLength(0),
     box.getIntPoint()[1] + box.getIntLength(1)
   };
 }
コード例 #2
0
 public void setROI(IROI ROI) {
   // this.setLenPt(ROI);
   firePropertyChange("ROI", this.ROI, this.ROI = ROI);
   IRectangularROI bounds = ROI.getBounds();
   int[] len = bounds.getIntLengths();
   int[] pt = bounds.getIntPoint();
   int[][] lenpt = new int[2][];
   lenpt[0] = len;
   lenpt[1] = pt;
   firePropertyChange("ROI", this.ROI, this.ROI = ROI);
   firePropertyChange("lenpt", this.lenpt, this.lenpt = lenpt);
 }
コード例 #3
0
ファイル: SummedAreaTable.java プロジェクト: xen-0/dawnsci
 /**
  * @param box
  * @return mean from the summed area table
  */
 public double getBoxMean(IRectangularROI box) throws Exception {
   if (box.getIntLength(0) % 2 == 0) throw new Exception("Box first dim is not odd!");
   if (box.getIntLength(1) % 2 == 0) throw new Exception("Box second dim is not odd!");
   int[] coords = createCoords(box);
   int[] bx = getBox(coords);
   return getBoxSumInternal(sum, coords, shape) / (bx[0] * bx[1]);
 }
コード例 #4
0
ファイル: SummedAreaTable.java プロジェクト: xen-0/dawnsci
  /**
   * Give a point point, this will return the sum of a box around it. The box should really be an
   * odd number such that the point is in the center
   *
   * @param box
   * @return the sum of a box around point of shape box
   * @throws Exception
   */
  public double getBoxSum(IRectangularROI box) throws Exception {

    if (box.getIntLength(0) % 2 == 0) throw new Exception("Box first dim is not odd!");
    if (box.getIntLength(1) % 2 == 0) throw new Exception("Box second dim is not odd!");

    return getBoxSumInternal(sum, createCoords(box), shape);
  }
コード例 #5
0
ファイル: SummedAreaTable.java プロジェクト: xen-0/dawnsci
  /**
   * Get the variance for a given box.
   *
   * <p>(1/n)(S2 - S1^2/n)
   *
   * <p>Where: S1 is sum of box ( D+A-B-C of sum ) S2 is sum^2 of box ( D+A-B-C of sum ) n is number
   * of pixels box covers
   *
   * @param box
   * @return variance
   * @throws Exception
   */
  public double getBoxFanoFactor(IRectangularROI box) throws Exception {

    if (box.getIntLength(0) % 2 == 0) throw new Exception("Box first dim is not odd!");
    if (box.getIntLength(1) % 2 == 0) throw new Exception("Box second dim is not odd!");

    if (sum2 == null) createSummedTable(image, true);
    int[] coords = createCoords(box);
    return getBoxFanoFactor(getBox(coords), coords);
  }