예제 #1
0
labId = "qm-04513"
smpId = "RAD-2015-0148Y-HCl-xs"

datDir	 = edsDir + "/Oxford/" + ePrjDir + "/reports/" + labId + "-" + smpId
sTifPath = datDir + "/tif/"

bSetMinMax = False
gMin =  1000
gMax = 11400
fwUnits = 28.9


units = IJ.micronSymbol + "m"

imp = IJ.getImage()
imp = jmg.calibImage(imp, fwUnits, units=-6)
if(bSetMinMax == True):
	IJ.setMinAndMax(gMin, gMax)
imp.updateAndRepaintWindow()

ti = imp.getShortTitle()
fi = sTifPath + ti + ".tif"
fs = FileSaver(imp)
imp.changes = False
print(fi)
if fs.saveAsTiff(fi):
	print "Tif saved successfully at ", fi  


print("done")
query = sTifPath + "*.tif"
lFiles = glob.glob(query)
i = 0
for fi in lFiles:
	i += 1
	fi = fi.replace("\\", "/")
	orig = ImagePlus(fi)
	strName = os.path.basename(fi)
	print(strName)
	orig.setTitle(strName)
	strWrk = strName.split('.')[0]
	lStr = strWrk.split('-')
	l = len(lStr)
	if (i <= nLo):
		jmg.calibImage(orig, fwLo, units=-6)
	else:
		jmg.calibImage(orig, fwHi, units=-6)
	strBar = "width=%g height=%g font=%g color=%s location=[%s] bold" % (barW, barH, barF, barC, barL)
	# a hack to get the scale bars to work reliably
	foo = orig.duplicate()
	if lStr[l-1][0:2] == "an":
		IJ.run(orig, "Enhance Contrast", sSat)
		IJ.run(orig, "RGB Color", "")
		IJ.run(orig, "Add Scale Bar", strBar)
		orig.show()
	else:
		IJ.run(orig, "Gamma...", sGamma)
		IJ.run(orig, "Enhance Contrast", sSat)
		IJ.run(orig, "RGB Color", "")
		IJ.run(orig, "Add Scale Bar", strBar)
예제 #3
0
# calibImage_.py
#
# Apply a calibration to an image from the full width
#
#  Modifications
#   Date      Who  Ver                       What
# ----------  --- ------  -------------------------------------------------
# 2014-10-15  JRM 0.1.00  Get'er done

from org.python.core import codecs
codecs.setDefaultEncoding('utf-8')

import os
import jmFijiGen as jmg
from ij import IJ
from ij import WindowManager

# full width in microns
fw = 57.9

impCal = WindowManager.getCurrentImage()
impCal = jmg.calibImage(impCal, fw, units=-6)
impCal.show()




query = sTifPath + "*.tif"
lFiles = glob.glob(query)
i = 0
for fi in lFiles:
	i += 1
	fi = fi.replace("\\", "/")
	orig = ImagePlus(fi)
	strName = os.path.basename(fi)
	print(strName)
	orig.setTitle(strName)
	strWrk = strName.split('.')[0]
	lStr = strWrk.split('-')
	l = len(lStr)
	jmg.calibImage(orig, fwImg, units=-6)
	# save the calibrated image
	fs = FileSaver(orig)
	print(fi)
	if fs.saveAsTiff(fi):
		print "Tif saved successfully at ", fi  

	strBar = "width=%g height=%g font=%g color=%s location=[%s] bold" % (barW, barH, barF, barC, barL)
	# a hack to get the scale bars to work reliably
	if (bSetMinMax==True):
		orig.show()
		IJ.setMinAndMax(gMin, gMax)
	else:
		IJ.run(orig, "Enhance Contrast", sSat)
		
	if(bDoTiltCorrect == True):
예제 #5
0
# testCalibImage_.py
#
# Test calibration of the image using calibImage in jmFijiGen.py
# Modifications
#   Date      Who  Ver                       What
# ----------  --- ------  -------------------------------------------------
# 2014-10-10  JRM 0.1.00  initial prototype development using bugs

from org.python.core import codecs
codecs.setDefaultEncoding('utf-8')

import os
import glob
import time
from ij import IJ
from ij import ImagePlus
from ij import WindowManager
import jmFijiGen as jmg

gitDir  = os.environ['GIT_HOME']
relImg  = "/OSImageAnalysis/images/EC-bse-10kV.png"
fw      = 4.45 # microns. Can read this from AZtec details dialog for image.

imgPath = gitDir + relImg
print(imgPath)

raw = IJ.openImage(imgPath)

raw = jmg.calibImage(raw, fw, units=-6)
raw.show()