当前位置: 首页>>代码示例>>Python>>正文


Python FileSaver.saveAsPng方法代码示例

本文整理汇总了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  
开发者ID:jrminter,项目名称:OSImageAnalysis,代码行数:33,代码来源:autoProcImage.py

示例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")
开发者ID:Xeonus,项目名称:SemesterProject,代码行数:32,代码来源:plotfeatureVector.py

示例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()
开发者ID:jrminter,项目名称:OSImageAnalysis,代码行数:31,代码来源:makePngWithScaleBar.py

示例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")
开发者ID:Xeonus,项目名称:SemesterProject,代码行数:32,代码来源:PCAMatrixIterFIX.py

示例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 )

开发者ID:jrminter,项目名称:OSImageAnalysis,代码行数:31,代码来源:makePngWithSbAZtecTifOneMag.py


注:本文中的ij.io.FileSaver.saveAsPng方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。