/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import analysers.AnalysisPlugin; import ij.IJ; import util.Cell; /** * Compile using, e.g. * javac -cp /Users/mike/java/libraries/ij.jar:/Users/mike/java/libraries/LineageTracker_1.0.2.jar CountCells.java * @version March 21, 2011 * @author Mike Downey */ public class CountCells extends AnalysisPlugin { int[] cellsInFrame; /** * Called when the 'Setup Analysis' button is clicked */ @Override public void setup() { IJ.showMessage("Displays numbers of cells in each frame"); } @Override public void analyze(Cell currentCell) { countCells(); IJ.log("Frame, Cells"); for (int i = 0; i < cellsInFrame.length; i++) { IJ.log(Integer.toString(i + 1) + " , " + cellsInFrame[i]); } } private void countCells() { cellsInFrame = new int[exp.getFrames()]; for (Cell c : cells) { cellsInFrame[c.getFrame() - 1]++; } } @Override public void cellClicked(Cell currentCell) { int frame = currentCell.getFrame(); countCells(); IJ.log("Frame " + frame + " contains " + cellsInFrame[frame - 1] + " cells"); } @Override public String getName() { return "Count Cells"; } }