/** * AperturePhotometry_ is an ImageJ plugin to find & measure stars in a CCD image. * Uses class ApPhot, a subclass of StarField. * Glen Cowan, RHUL Physics Department * November, 2004 */ import ij.*; import ij.process.*; import ij.gui.*; import ij.plugin.filter.*; import java.awt.*; import java.awt.image.*; import java.util.*; import java.math.*; import java.io.*; public class AperturePhotometry_ implements PlugInFilter { ImagePlus imp; // make imp available to run method public int setup(String arg, ImagePlus imp) { this.imp = imp; return DOES_ALL; // claim to work on all image types } public void run(ImageProcessor ip) { // Set global parameters double starThreshold = IJ.getNumber("Enter star threshold (ADU)", 10000); SFPar.setStarThreshold(starThreshold); double gain = IJ.getNumber("Enter gain (e-/ADU)", 2.3); SFPar.setGain(gain); // Create ApPhot object from image, find clusters and peaks ApPhot ap = new ApPhot(starThreshold); SFUtil.setStarFieldFromIJ(ap, imp, ip); // initialize from current image ap.fillClusterVec(); // find clusters of pixels over threshold ap.trimClusterVec(3); // eliminate clusters below minimum size ap.findPeaks(); // find local maxima in clusters ap.checkPeaks(); SFUtil.showClusterMap(ap); // display clusters in a new RGB image // From clusters form stars, set apertures and measure ap.fillStarVec(); double dMin = ap.getMinDist(); IJ.write("Smallest distance between star pair = " + dMin); double apRadius = IJ.getNumber("Enter signal aperture radius", dMin/2); double bckRInner = 1.5*apRadius; double bckROuter = 2.5*apRadius; ap.fillApVec(apRadius, bckRInner, bckROuter); SFUtil.showStarMap(ap); // display stars in a new RGB image ap.measureAps(); ap.subtractBck(); // Comput magnitude difference between airs of stars IJ.write("i, j, mi-mj, sigma(mi-mj)..."); int numStars = (ap.getStarVec()).size(); for (int i=0; i