- Timestamp:
- 01/19/12 12:54:08 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/flow-cytometry/src/main/java/loci/apps/flow/FlowCytometry.java
r7863 r7868 39 39 import ij.ImagePlus; 40 40 import ij.ImageStack; 41 import ij.WindowManager; 41 42 import ij.gui.ImageWindow; 43 import ij.measure.Measurements; 42 44 import ij.measure.ResultsTable; 43 45 import ij.plugin.filter.Analyzer; 46 import ij.plugin.filter.GaussianBlur; 47 import ij.plugin.filter.ParticleAnalyzer; 44 48 import ij.plugin.frame.RoiManager; 49 import ij.process.AutoThresholder; 45 50 import ij.process.ByteProcessor; 46 51 import ij.process.ImageProcessor; … … 194 199 nSlices++; 195 200 } 196 197 201 202 198 203 /* 199 204 public static void showImageForBrightfield(int width, int height, byte[] imageData) { … … 253 258 } 254 259 } 255 */260 */ 256 261 public static void showImage(int width, int height, byte[] imageData) { 257 262 //bp = new ByteProcessor(width,height,imageData, … … 633 638 return micronAreas; 634 639 } 635 640 636 641 //ajeet 637 public static int[] getBFParticleAreas(){ 638 IJ.runPlugIn("flow bfParticleAreas", null); 639 640 RoiManager rm = RoiManager.getInstance(); 641 int lenghtOfRoiTable =rm.getRoisAsArray().length; 642 public static int[] getBFParticleAreas(){ 643 ImagePlus img = WindowManager.getCurrentImage(); 644 // IJ.runPlugIn("bf ParticleAreasPlugin", null); 645 ImageProcessor imgProc = img.getProcessor(); 646 647 imgProc.findEdges(); 648 imgProc.findEdges(); 649 650 GaussianBlur gb = new GaussianBlur(); 651 gb.blur(imgProc, 5); 652 653 AutoThresholder thresh = new AutoThresholder(); 654 thresh.getThreshold(AutoThresholder.Method.valueOf("Minimum"), imgProc.getHistogram()); 655 656 RoiManager rm = new RoiManager(true); 657 ResultsTable rt = new ResultsTable(); 658 img = new ImagePlus("thresholdedImage", imgProc); 659 ParticleAnalyzer pa = new ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER | ParticleAnalyzer.CLEAR_WORKSHEET | ParticleAnalyzer.EXCLUDE_EDGE_PARTICLES | ParticleAnalyzer.INCLUDE_HOLES, Measurements.AREA, rt, 0, Double.POSITIVE_INFINITY, 0, 1); 660 int lenghtOfRoiTable = 0; 661 662 if (pa.analyze(img)){ 663 lenghtOfRoiTable = rm.getRoisAsArray().length; 664 642 665 int[] retVal = new int[lenghtOfRoiTable]; 666 double[] temp = rt.getColumnAsDoubles(0); 643 667 644 668 for (int i = 0; i < lenghtOfRoiTable; i++){ 645 retVal[i] = Integer.parseInt(IJ.runMacro("getResults(\"Area\", i)", null));669 retVal[i]=(int)temp[i]; 646 670 } 647 671 672 rm.dispose(); 673 rt.reset(); 674 img.flush(); 675 img.close(); 676 648 677 return retVal; 649 678 } 650 679 680 rm.dispose(); 681 rt.reset(); 682 img.flush(); 683 img.close(); 684 685 return null; 686 687 688 } 689 651 690 652 691 private static boolean addParticle(Particle particle) {
Note: See TracChangeset
for help on using the changeset viewer.