Changeset 7973
- Timestamp:
- 04/15/12 03:57:42 (8 years ago)
- Location:
- trunk/projects/flow-cytometry/src/main/java/loci/apps/flow
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/flow-cytometry/src/main/java/loci/apps/flow/Find_Particle_Areas.java
r7972 r7973 228 228 229 229 public static float[] inWiscScanMode(ImagePlus imageToAnalyze, boolean isIntensity, boolean excludeOnEdge, double threshMin, int minSize){ 230 float[] summedPixelAreasArray; 230 float[] summedPixelAreasArray; 231 Interpreter.batchMode=true; 231 232 try{ 232 233 //if image is of intensity, do related calculations, else do brightfield calculations … … 244 245 IJ.run(imageToAnalyze, "Gaussian Blur...", "sigma=5"); 245 246 246 IJ.run PlugIn(imageToAnalyze, "Auto Threshold", "method=Minimum white");247 IJ.run(imageToAnalyze, "Auto Threshold", "method=Minimum white"); 247 248 248 249 if(excludeOnEdge) IJ.run(imageToAnalyze, "Analyze Particles...", "size="+minSize+"-Infinity circularity=0.00-1.00 show=Masks display exclude clear include add"); … … 254 255 if(resTab.getCounter()>0){ 255 256 //get the values under the column "Area" 257 imageToAnalyze.close(); 256 258 return summedPixelAreasArray = resTab.getColumn(resTab.getColumnIndex("Area")); 257 259 } -
trunk/projects/flow-cytometry/src/main/java/loci/apps/flow/FlowCyto.java
r7972 r7973 9 9 import ij.macro.Interpreter; 10 10 import ij.measure.ResultsTable; 11 import ij.plugin.Duplicator; 11 12 import ij.plugin.frame.RoiManager; 12 13 import ij.process.ByteProcessor; … … 29 30 private static double pixelMicronSquared; 30 31 private static byte[] dummyData; 32 private static Duplicator dup; 33 private static float sumIntensityAreasHolder; 31 34 32 35 … … 74 77 impIN=new ImagePlus(); 75 78 imp=new ImagePlus(); 79 dup = new Duplicator(); 76 80 // s_Date = new java.text.SimpleDateFormat("MM.dd.yyyy hh:mm:ss").format(new java.util.Date()); 77 81 byte[] r = new byte[256]; … … 223 227 if(isIntensityImage){ 224 228 try{ 225 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode( impIN, true, excludeOnEdge, thresholdMin, sizeMin);229 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(impIN, nSlicesIN, nSlicesIN), true, excludeOnEdge, thresholdMin, sizeMin); 226 230 227 231 //-----------------------FOR DEBUG PURPOSES--------------------// … … 230 234 231 235 }catch(Exception e){ 232 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode( imp, true, excludeOnEdge, thresholdMin, sizeMin);236 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(imp, nSlices, nSlices), true, excludeOnEdge, thresholdMin, sizeMin); 233 237 234 238 //-----------------------FOR DEBUG PURPOSES--------------------// … … 240 244 else { 241 245 try{ 242 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode( impBF, false, excludeOnEdge, thresholdMin, sizeMin);246 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(impBF, nSlicesBF, nSlicesBF), false, excludeOnEdge, thresholdMin, sizeMin); 243 247 244 248 //-----------------------FOR DEBUG PURPOSES--------------------// … … 247 251 248 252 }catch(Exception e){ 249 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode( imp, false, excludeOnEdge, thresholdMin, sizeMin);253 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(imp, nSlices, nSlices), false, excludeOnEdge, thresholdMin, sizeMin); 250 254 251 255 //-----------------------FOR DEBUG PURPOSES--------------------// … … 293 297 294 298 @SuppressWarnings("static-access") 295 public static float getSumOfParticleAreas(boolean isIntensityImage, boolean excludeOnEdge, double thresholdMin, int sizeMin){299 public static boolean getRatioBoolean(boolean isIntensityImage, boolean excludeOnEdge, double thresholdMin, int sizeMin, float compareTOLow, float compareTOHigh){ 296 300 297 301 //-----------------------FOR DEBUG PURPOSES--------------------// … … 299 303 IJ.log("Pixel areas summing method started on slice "+nSlicesIN+" at \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 300 304 //-------------------------------------------------------------// 301 float summedPixelAreas=0; 305 302 306 float[] summedPixelAreasArray; 303 307 Interpreter.batchMode=true; … … 306 310 if(isIntensityImage){ 307 311 try{ 308 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(impIN, true, excludeOnEdge, thresholdMin, sizeMin); 312 sumIntensityAreasHolder=0; 313 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(impIN, nSlicesIN, nSlicesIN), true, excludeOnEdge, thresholdMin, sizeMin); 314 for(int i=0; i<summedPixelAreasArray.length; i++){ 315 sumIntensityAreasHolder+=summedPixelAreasArray[i]; 316 } 309 317 310 318 //-----------------------FOR DEBUG PURPOSES--------------------// 311 319 IJ.log("plugin finished on intensity image "+nSlicesIN+" in \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 312 320 //-------------------------------------------------------------// 321 //-----------------------FOR DEBUG PURPOSES--------------------// 322 IJ.log("_"); 323 //-------------------------------------------------------------// 324 325 return false; 313 326 314 327 }catch(Exception e){ 315 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(imp, true, excludeOnEdge, thresholdMin, sizeMin); 328 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(imp, nSlices, nSlices), true, excludeOnEdge, thresholdMin, sizeMin); 329 for(int i=0; i<summedPixelAreasArray.length; i++){ 330 sumIntensityAreasHolder+=summedPixelAreasArray[i]; 331 } 316 332 317 333 //-----------------------FOR DEBUG PURPOSES--------------------// 318 334 IJ.log("plugin finished on ISLET DEFAULT image "+nSlicesIN+" in \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 319 335 //-------------------------------------------------------------// 320 336 //-----------------------FOR DEBUG PURPOSES--------------------// 337 IJ.log("_"); 338 //-------------------------------------------------------------// 339 340 return false; 321 341 } 322 342 } 323 343 else { 324 try{ 325 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(impBF, false, excludeOnEdge, thresholdMin, sizeMin); 326 327 //-----------------------FOR DEBUG PURPOSES--------------------// 328 IJ.log("plugin finished on brightfield image "+nSlicesBF+" in \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 329 //-------------------------------------------------------------// 344 try{ 345 float sumBFPixelAreas=0; 346 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(impBF, nSlicesBF, nSlicesBF), false, excludeOnEdge, thresholdMin, sizeMin); 347 for(int i=0; i<summedPixelAreasArray.length; i++){ 348 sumBFPixelAreas+=summedPixelAreasArray[i]; 349 } 350 if((sumBFPixelAreas!=0) && ((sumIntensityAreasHolder/sumBFPixelAreas) >= compareTOLow) && ((sumIntensityAreasHolder/sumBFPixelAreas) <= compareTOHigh)){ 351 352 //-----------------------FOR DEBUG PURPOSES--------------------// 353 IJ.log("plugin finished -TRUE- on brightfield ratio image "+nSlicesBF+" in \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 354 //-------------------------------------------------------------// 355 //-----------------------FOR DEBUG PURPOSES--------------------// 356 IJ.log("_"); 357 //-------------------------------------------------------------// 358 359 return true; 360 } 330 361 331 362 }catch(Exception e){ 332 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(imp, false, excludeOnEdge, thresholdMin, sizeMin); 333 334 //-----------------------FOR DEBUG PURPOSES--------------------// 335 IJ.log("plugin finished on ISLET DEFAULT image "+nSlicesIN+" in \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 336 //-------------------------------------------------------------// 363 float sumBFPixelAreas=0; 364 summedPixelAreasArray=Find_Particle_Areas.inWiscScanMode(dup.run(imp, nSlices, nSlices), false, excludeOnEdge, thresholdMin, sizeMin); 365 for(int i=0; i<summedPixelAreasArray.length; i++){ 366 sumBFPixelAreas+=summedPixelAreasArray[i]; 367 } 368 if((sumBFPixelAreas!=0) && ((sumIntensityAreasHolder/sumBFPixelAreas) >= compareTOLow) && ((sumIntensityAreasHolder/sumBFPixelAreas) <= compareTOHigh)){ 369 370 //-----------------------FOR DEBUG PURPOSES--------------------// 371 IJ.log("plugin finished TRUE on ISLET DEFAULT image "+nSlicesIN+" in \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 372 //-------------------------------------------------------------// 373 //-----------------------FOR DEBUG PURPOSES--------------------// 374 IJ.log("_"); 375 //-------------------------------------------------------------// 376 377 return true; 378 } 337 379 338 380 } 339 381 } 340 341 for(int i=0; i<summedPixelAreasArray.length; i++){ 342 summedPixelAreas+=summedPixelAreasArray[i]; 343 } 382 344 383 }catch (Exception e){ 345 384 IJ.log("Problem in getting particle areas"); 346 385 IJ.log(e.getMessage()); 347 386 } 348 387 349 388 //-----------------------FOR DEBUG PURPOSES--------------------// 350 IJ.log("p ixel areas sum calculatedin \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms");389 IJ.log("plugin finished FALSE on brightfield ratio image "+nSlicesBF+" in \t \t \t"+ ((System.nanoTime() - initialTime)/1000000) +"ms"); 351 390 //-------------------------------------------------------------// 352 391 //-----------------------FOR DEBUG PURPOSES--------------------// 353 392 IJ.log("_"); 354 393 //-------------------------------------------------------------// 355 356 return summedPixelAreas;394 395 return false; 357 396 } 358 397
Note: See TracChangeset
for help on using the changeset viewer.