pw = cal.pixelWidth if bVerbose: print(pw) if u == scaUm: if (pw <= 0.02): barW = 0.10 # bar width, microns elif (pw < 0.06): barW = 1.0 # bar width, microns else: barW = 10.0 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 (bSetGrayLevels == True): bd = orig.getBitDepth() if(bd==16): IJ.setMinAndMax(foo, gLo, gHi) IJ.run(foo, "RGB Color", "") IJ.run(foo, "Add Scale Bar", strBar) foo.close() if (bSetGrayLevels == True): bd = orig.getBitDepth() if(bd==16): IJ.setMinAndMax(orig, gLo, gHi) else: sArgSat = "saturated=%.2f" % gSatFac IJ.run(orig, "Enhance Contrast", sArgSat) if(bDoTiltCorrect == True):