本文整理汇总了Python中ij.io.FileSaver.saveAsPng方法的典型用法代码示例。如果您正苦于以下问题:Python FileSaver.saveAsPng方法的具体用法?Python FileSaver.saveAsPng怎么用?Python FileSaver.saveAsPng使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.io.FileSaver
的用法示例。
在下文中一共展示了FileSaver.saveAsPng方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: autoProcAZtecImage
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsPng [as 别名]
def autoProcAZtecImage(fwMicrons, wrkDir, barWid=0.1, barHt=9, barFnt=24, barCol="Black", barLoc="Lower Right"):
imp = IJ.getImage()
fName = imp.getShortTitle()
wid = imp.getWidth()
argThree = "distance=%g known=%f pixel=1 unit=um" % (wid, fwMicrons)
IJ.run(imp, "Set Scale...", argThree)
IJ.run(imp, "Enhance Contrast", "saturated=0.35")
fs = FileSaver(imp)
if path.exists(wrkDir) and path.isdir(wrkDir):
print "folder exists:", wrkDir
tifName = fName + ".tif"
tifPath = path.join(wrkDir, tifName)
print(tifPath)
if fs.saveAsTiff(tifPath):
print "Tif saved successfully at ", tifPath
IJ.run(imp, "RGB Color", "")
# dummy to get things set
foo = imp.duplicate()
s2 = "width=%g height=%g font=%g color=%s location=[%s] bold" % (barWid, barHt, barFnt, barCol, barLoc)
IJ.run(foo, "Add Scale Bar", s2)
# explicitly save preferences
Prefs.savePreferences()
foo.changes = False
foo.close()
IJ.run(imp, "Add Scale Bar", s2)
fs = FileSaver(imp)
pngName = fName + ".png"
pngPath = path.join(wrkDir, pngName)
if fs.saveAsPng(pngPath):
print "png saved successfully at ", pngPath
示例2: featureVector
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsPng [as 别名]
import sys
sys.path.append("/Users/berthola/Desktop/Fiji Scripts")
from matrixoperator import Matrix
from javax.media.j3d import Transform3D
from javax.vecmath import Point3d
from ij.io import FileSaver
from profilingFixedCoordinates import getDendriticProfiles
from profilingFixedCoordinates import getNodeCoordinates
from machine_ import featureVector
good = featureVector(72481, 99481, 50)
bad = featureVector(83160, 99481, 50)
plot = Plot("histogram", "y-coordinates", "count",range(0, 50), good)
plot.setLimits(0.0, 50.0, 0, 60000000.0)
plot.show()
fs=FileSaver(plot.getImagePlus())
fs.saveAsPng(System.getProperty("user.home") + "/Desktop/Histotest/y" + "good.png")
plot = Plot("histogram", "y-coordinates", "count",range(0, 50), bad)
plot.setLimits(0.0, 50.0, 0, 60000000.0)
plot.show()
fs=FileSaver(plot.getImagePlus())
fs.saveAsPng(System.getProperty("user.home") + "/Desktop/Histotest/y" + "bad.png")
示例3: print
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsPng [as 别名]
IJ.open(imgPath);
IJ.run("Properties...", "channels=1 slices=1 frames=1 unit=um pixel_width=0.03143555 pixel_height=0.03144531 voxel_depth=1.0000000");
orig = IJ.getImage();
ti = orig.getShortTitle();
pngPath = homDir + relDir + "/" + ti + ".png"
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
IJ.run(orig, "RGB Color", "")
# dummy to get things set
foo = orig.duplicate()
IJ.run(foo, "Add Scale Bar", strBar)
# explicitly save preferences
Prefs.savePreferences()
foo.changes = False
foo.close()
IJ.run(orig, "Add Scale Bar", strBar)
print(pngPath)
fs = FileSaver(orig)
if fs.saveAsPng(pngPath):
print "png saved successfully at ", pngPath
time.sleep(sleepTime)
orig.close()
示例4: range
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsPng [as 别名]
for i in range(0, len(pca)):
if pca[i] <= binright and pca[i] >= binleft:
counter += 1
histovector.append(counter)
counter=0
binleft+=length
binright+=length
#histomirror=histovector.reverse()
print "The histogram vector is:", histovector
"""
#Plot center
from java.awt import Color
from ini.trakem2.display import Display3D
Display3D.addFatPoint("eigen center", tree.getLayerSet(), center.get(0, 0), center.get(0, 1), center.get(0, 2), 10, Color.red)
"""
plot = Plot("histogram", "bins", "count", range(iterations), histovector)
plot.show()
fs=FileSaver(plot.getImagePlus())
fs.saveAsPng(System.getProperty("user.home") + "/Desktop/Histotest/pcaleft" + str(ID) + ".png")
histovector.reverse()
plot = Plot("histogram", "bins", "count", range(iterations), histovector)
plot.show()
fs=FileSaver(plot.getImagePlus())
fs.saveAsPng(System.getProperty("user.home") + "/Desktop/Histotest/pcaright" + str(ID) + ".png")
示例5: FileSaver
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsPng [as 别名]
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):
orig = jmg.correctForeshortening(orig, tiltDeg)
IJ.run(orig, "RGB Color", "")
IJ.run(orig, "Add Scale Bar", strBar)
orig.show()
outPth = sPngPath + strWrk + ".png"
fs = FileSaver(orig)
if fs.saveAsPng(outPth):
print "png saved successfully at ", outPth
time.sleep(1)
# orig.close()
IJ.run("Close All")
toc = time.time()
elapsed = toc - tic
print("analyzed %g images" % i)
print("completed in %g sec" % elapsed )