コード例 #1
0
  public void run(String arg) {
    if (IJ.versionLessThan("1.49d")) return;

    if (!showDialog()) return;

    SaveDialog sd = new SaveDialog("Save as Bricks...", "", "");
    basename = sd.getFileName();
    directory = sd.getDirectory();
    if (basename == null || directory == null) return;

    build_bricks();
  }
コード例 #2
0
ファイル: MyDialogs.java プロジェクト: baowuji/quickpalm
  public boolean checkBeads() {
    rmanager = RoiManager.getInstance();
    if (IJ.versionLessThan("1.26i")) return false;
    else if (rmanager == null) {
      IJ.error("Add bead ROIs to the RoiManager first (select region then press [t]).");
      return false;
    }

    nrois = rmanager.getCount();
    if (nrois == 0) {
      IJ.error("Add bead ROIs to the RoiManager first (select region then press [t]).");
      return false;
    }
    rois = rmanager.getRoisAsArray();
    return true;
  }
コード例 #3
0
ファイル: CTN_.java プロジェクト: angeqyang/ImageJ-plugins
  public int setup(String arg, ImagePlus imp) {
    // IJ.register(Average_Oversampled.class);

    if (IJ.versionLessThan("1.32c")) return DONE;

    if (this.pre) { // before finding means

      imp.unlock();
      this.imp = imp;
      this.nslices = imp.getNSlices();
      this.width = imp.getWidth();
      this.height = imp.getHeight();
      this.slicecols = new float[nslices][width];
      this.pre = false;
      return (DOES_ALL + DOES_STACKS + FINAL_PROCESSING);

    } else { // find SD after finding means of columns
      float sum; // sum of pixel values column
      float avg; // average pixel value of a column
      double devsum; // sum of deviations
      double devavg; // standard deviation
      double[] columns = new double[width]; // x-axis of plot
      double[] sdevs = new double[width]; // y-axis of plot

      for (int i = 0; i < width; i += 1) {
        sum = 0; // reset with each column
        avg = 0; // reset with each column
        devsum = 0; // reset with each column
        devavg = 0; // reset with each column
        columns[i] = i; // building x-axis

        for (int s = 0; s < nslices; s += 1) { // sum of column means
          sum = sum + slicecols[s][i];
        }
        avg = sum / nslices; // mean of one column across all slices

        for (int s = 0; s < nslices; s += 1) { // standard deviation
          devsum = devsum + Math.pow((slicecols[s][i] - avg), 2); // square diff
        }
        devavg = Math.sqrt(devsum / nslices);

        sdevs[i] = devavg; // building y-axis
      }

      Plot plot = new Plot("Average SD by Column", "Columns", "Standard Deviation", columns, sdevs);
      plot.show();

      // calculate CTN
      double ctn;
      double sdevssum = 0;
      for (double sd : sdevs) {
        sdevssum = sdevssum + sd;
      }
      ctn = sdevssum / width;

      // display CTN on results table
      ResultsTable rt = ResultsTable.getResultsTable();
      // rt.incrementCounter();
      rt.addValue("Column Temporal Noise", ctn);
      rt.show("Results");

      this.pre = false;

      return DONE;
    }
  }