Exemplo n.º 1
0
 orig = ImagePlus(fi)
 strName = os.path.basename(fi)
 strName = strName.split('.')[0]
 lStr =  strName.split('-')
 l = len(lStr)
 strNum = lStr[l-1]
 iNum = int(strNum)
 orig.setTitle(strNum)
 if i == 1:
   # a hack to get the scale bars to work reliably
   foo = orig.duplicate()
   IJ.run(foo, "RGB Color", "")
   IJ.run(foo, "Add Scale Bar", strBar)
 iZero = jmg.findI0(orig, maxSearchFrac=0.5, chAvg=5)
 # print(iZero)
 rt = jmg.anaParticlesWatershed(orig, minPx=30)
 nMeas = rt.getCounter()
 
 nCols = rt.getLastColumn()
 lArea   = rt.getColumn(rt.getColumnIndex("Area"))
 lMode   = rt.getColumn(rt.getColumnIndex("Mode"))
 # lPeri   = rt.getColumn(rt.getColumnIndex("Perim."))
 # lMaj    = rt.getColumn(rt.getColumnIndex("Major"))
 # lMin    = rt.getColumn(rt.getColumnIndex("Minor"))
 lCirc   = rt.getColumn(rt.getColumnIndex("Circ."))
 # lFeretX = rt.getColumn(rt.getColumnIndex("FeretX"))
 # lFeretY = rt.getColumn(rt.getColumnIndex("FeretY"))
 lAspRat = rt.getColumn(rt.getColumnIndex("AR"))
 lRound  = rt.getColumn(rt.getColumnIndex("Round"))
 lSolid  = rt.getColumn(rt.getColumnIndex("Solidity"))
 for j in range(len(lArea)):
Exemplo n.º 2
0
jmg.ensureDir(sRptPath)
sRptCsvPath = sRptPath + sampID + ".csv"
sRptImgPath = sRptPath + "png/"
jmg.ensureDir(sRptImgPath)


orig = ImagePlus(sImgPath)
strName = os.path.basename(sImgPath)
strName = strName.split('.')[0]
orig.setTitle(strName)
# orig.show()
iZero = jmg.findI0(orig, maxSearchFrac=0.5, chAvg=5)
print(iZero)

# [ana, rt] = anaParticles(orig, minSize, maxSize, minCirc, bHeadless=bHeadless)
rt = jmg.anaParticlesWatershed(orig)
orig.show()
nMeas = rt.getCounter()
print("%d particles detected in image %d" % (nMeas,1) )
nCols = rt.getLastColumn()

if bVerbose == True:
  for j in range(nCols+1):
    print(rt.getColumnHeading(j))


print("Area     = %d" % rt.getColumnIndex("Area"))
print("Mean     = %d" % rt.getColumnIndex("Mean"))
print("Mode     = %d" % rt.getColumnIndex("Mode"))
print("Perim.   = %d" % rt.getColumnIndex("Perim."))
print("Major    = %d" % rt.getColumnIndex("Major"))
Exemplo n.º 3
0
  i += 1
  orig = ImagePlus(fi)
  orig = jmg.calibImageDirect(orig, umPerPx, units=-6)
  strName = orig.getShortTitle()
  strNum = strName.split('IMAGE')[1]
  iNum = int(strNum)
  strName = "%s-%02d" % (sampID, iNum ) 
  orig.setTitle(strName)
  orig.show()
  if i == 1:
    # a hack to get the scale bars to work reliably
    foo = orig.duplicate()
    IJ.run(foo, "RGB Color", "")
    IJ.run(foo, "Add Scale Bar", strBar)

  rt = jmg.anaParticlesWatershed(orig, strThrMeth="method=Otsu white", bFillHoles=True, minPx=minArea, maxPx=maxArea, minCirc=minCirc, maxAR=maxAR)
  nMeas = rt.getCounter()
  
  nCols = rt.getLastColumn()
  lArea   = rt.getColumn(rt.getColumnIndex("Area"))
  lMode   = rt.getColumn(rt.getColumnIndex("Mode"))
  # lPeri   = rt.getColumn(rt.getColumnIndex("Perim."))
  # lMaj    = rt.getColumn(rt.getColumnIndex("Major"))
  # lMin    = rt.getColumn(rt.getColumnIndex("Minor"))
  lCirc   = rt.getColumn(rt.getColumnIndex("Circ."))
  # lFeretX = rt.getColumn(rt.getColumnIndex("FeretX"))
  # lFeretY = rt.getColumn(rt.getColumnIndex("FeretY"))
  lAspRat = rt.getColumn(rt.getColumnIndex("AR"))
  lRound  = rt.getColumn(rt.getColumnIndex("Round"))
  lSolid  = rt.getColumn(rt.getColumnIndex("Solidity"))
  k = 0
Exemplo n.º 4
0
    for r in ra:
        i += 1
        rLab = "%d" % i
        r.setName(rLab)
        imp = addRoiToOverlay(imp, r, labCol=labCol, linCol=linCol)
    # let's put a PointRoi outside the image to get the overlays all the same color
    r = PointRoi(-10, -10)
    imp = addRoiToOverlay(imp, r, labCol=labCol, linCol=linCol)
    # clear the roi manager and return the results table
    rm.reset()
    rm.close()
    if bDebug == False:
        wrk.changes = False
        wrk.close()
    imp.setTitle(title)
    return rt


closeRW = False

IJ.run("Blobs (25K)")
ori = IJ.getImage()
myRT = jmg.anaParticlesWatershed(ori)

myRT.show("Results")

if closeRW:
    myRT.getResultsWindow().close(False)
else:
    myRT.show("Results")
Exemplo n.º 5
0
from org.python.core import codecs
codecs.setDefaultEncoding('utf-8')
import os
import glob
import time

from math import sqrt
from ij import IJ
from ij import ImagePlus
import jmFijiGen as jmg

orig = IJ.getImage()
orig.setTitle("orig")
print(orig.getShortTitle())
iZero = jmg.findI0(orig, maxSearchFrac=0.5, chAvg=5)
print(iZero)
rt = jmg.anaParticlesWatershed(orig, strThrMeth="method=Otsu white", bFillHoles=True, minPx=7, maxPx=150)
nMeas = rt.getCounter()
print(nMeas)