Ejemplo n.º 1
0
strPath = strImgRoot + strRel
umPerPx = 0.0368365
strUmPerPx = str(umPerPx)

strCal = "channels=1 slices=1 frames=1 unit=micron pixel_width="
strCal += strUmPerPx
strCal += " pixel_height="
strCal += strUmPerPx
strCal += "  voxel_depth=1.0000000 frame=[0 sec] origin=0,0"

# print strPath

for file in os.listdir(strPath):
  print file
  sFile = os.path.join(strPath, file)
  imp = IJ.openImage(sFile)
  imp.show()
  IJ.run(imp, "Properties...", strCal)
  IJ.run("16-bit")
  imp.show()
  strRpt = Tools.split(imp.getTitle(), ".")[0] + "-ij.csv"
  strCmd = "min=200 max=999999 top/bottom=5 lo=0.25 med=0.50 hi=0.75 log=0 path="
  strCmd += strRptPath + " report=" + strRpt
  IJ.run("Analyze Line", strCmd)
  IJ.selectWindow(imp.getTitle())
  strImgOut =  strPngPath + Tools.split(imp.getTitle(), ".")[0] + ".png"
  IJ.saveAs("PNG", strImgOut)
  IJ.run("Close")


  #filelist = os.listdir(filedir)
  for root, directories, filenames in os.walk(filedir):
    print directories
    for filename in filenames:	
      if filename.lower().endswith('.lif'):
        print filedir
        print "..." + filename
        filebase = splitext(filename)[0]
        imps = getImps(os.path.join(filedir, filename))
        printInfo(imps)	
        for (counter, item) in enumerate(imps):
          #outimp = zproj(item)
          outimp = makeComposite(item)
          #outimp.show()
          #outname = filedir + filebase + "/" + "s" + str(counter) + ".tif"
          subname = ijtool.split(item.getTitle(), " - ")[1]
          #outname = filedir + filebase + "/" + subname + "_ZP.tif"
          outdir = os.path.join(filedir, "processed")
          outname = os.path.join(outdir, filebase + "_" + subname + "_" + str(counter) + "_Composite")
          print outname
          if not os.path.isdir(outdir):
            os.mkdir(outdir)
          fs = FileSaver(outimp)
          fs.saveAsTiffStack(outname+".tif")
          fs.saveAsJpeg(outname+".jpg")
          

#outimp = zproject(filepath)
#outimp.show()

Ejemplo n.º 3
0
import os

strGitHome = os.environ['GIT_HOME']
strImgDir = "/OSImageAnalysis/ImageJ/Analyze_Line/std/"
umPerPx = 0.0368365

# should not need to change below here...
strImage = strGitHome + strImgDir + "line.tif"
strUmPerPx = str(umPerPx)
strRptPath = strGitHome + strImgDir

strCal = "channels=1 slices=1 frames=1 unit=micron pixel_width="
strCal += strUmPerPx
strCal += " pixel_height="
strCal += strUmPerPx
strCal += "  voxel_depth=1.0000000 frame=[0 sec] origin=0,0"

imp = IJ.openImage(strImage)
IJ.run(imp, "Properties...", strCal)
imp.show()
IJ.run("16-bit")
imp.show()

strRpt = Tools.split(imp.getTitle(), ".")[0] + "-ij.csv"
strCmd = "min=200 max=999999 top/bottom=5 lo=0.25 med=0.50 hi=0.75 log=0 path="
strCmd += strRptPath + " report=" + strRpt

IJ.run("Analyze Line", strCmd)