import analysers.AnalysisPlugin; import ij.IJ; import java.awt.Color; import java.awt.geom.Ellipse2D; import util.Cell; /** * Highlights dividing cells using a circle of randomly selected colour. * * @version 01-Mar-2011 * @author mike */ public class HighlightDivisions extends AnalysisPlugin{ private int dividings=0; @Override public void analyze(Cell clickedCell) { dividings = 0; // TrackedCell.clearTrackingFlag(cells); // IJ.log("list of "+cells.size()); for(Cell c: cells){ highlightCell(c); } IJ.log("Highlighted "+dividings+" divisions"); } @Override public void setup() { IJ.showMessage("Highlights cells which divide"); } @Override public void cellClicked(Cell currentCell) { do{ // currentCell.setBeingTracked(true); highlightCell(currentCell); currentCell = currentCell.getNextCell(); }while(currentCell!=null); } private void highlightCell(Cell currentCell) { Cell d = currentCell.getDaughterCell(); if (d != null) { IJ.log("Frame: " + currentCell.getFrame()+" x:"+currentCell.getX()+" y:"+currentCell.getY()); dividings++; Color col = new Color((float) Math.random(), (float) Math.random(), (float) Math.random()); screen.addToFrame(currentCell.getFrame(), new Ellipse2D.Float((int) currentCell.getX() - 5, (int) currentCell.getY() - 5, 10, 10), col, 5); } } @Override public String getName() { return "Highlight Dividing Cells"; } }