本文整理汇总了Python中ij.io.FileSaver.saveAsJpeg方法的典型用法代码示例。如果您正苦于以下问题:Python FileSaver.saveAsJpeg方法的具体用法?Python FileSaver.saveAsJpeg怎么用?Python FileSaver.saveAsJpeg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.io.FileSaver
的用法示例。
在下文中一共展示了FileSaver.saveAsJpeg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SaveToZip
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsJpeg [as 别名]
def SaveToZip(zf, ip, baseDir, counter):
fs = FileSaver(ip)
fs.setJpegQuality(75)
fs.saveAsJpeg(baseDir + "/tmp.jpeg")
zipName = str(counter) + ".jpeg"
zf.write(baseDir + "/tmp.jpeg", arcname=zipName)
os.remove(baseDir + "/tmp.jpeg")
示例2: process
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsJpeg [as 别名]
def process(srcDir, dstDir, nameContains, currentDir, fileName, keepDirectories, anneBoleyn, overOut):
print "Opening", fileName
saveDir = currentDir.replace(srcDir, dstDir) if keepDirectories else dstDir
head, tail = os.path.splitext(fileName)
imps = BF.openImagePlus(os.path.join(currentDir, fileName))
for imp in imps:
if not anneBoleyn:
print "Now showing image..."
imp.show()
IJ.run(imp, "Blue", "")
fs = FileSaver(imp)
if not os.path.exists(saveDir):
os.makedirs(saveDir)
if not overOut:
if os.path.exists(saveDir + "\\" + head + ".jpg"):
print "This JPG exists already and will not be overwritten. Moving on..."
else:
print "Saving to", os.path.join(saveDir, head + ".jpg")
fs.saveAsJpeg(os.path.join(saveDir, head + ".jpg"))
imp.close()
示例3: splitext
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsJpeg [as 别名]
#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()
示例4: range
# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsJpeg [as 别名]
elif chosenData == 8:
#sourceFolder = 'I:\\NewDatasets\\Zeiss\\20160426\\red\\partiallyNormalized\\cropped_spim_TL'
sourceFolder = 'I:\\NewDatasets\\Zeiss\\20160426\\red\\test_cropped_spim_TL'
outputFolder = 'I:\\SegmentationResults\\MIPsRawData\\20160426\\MIP_small_cropped_t'
startT = 3
endT = 23
appendix = '_Angle1.tif'
for i in range(startT, endT+1):
if i < 10:
digit = '00' + str(i)
elif i < 100:
digit = '0' + str(i)
elif i < 1000:
digit = str(i)
imagePath = sourceFolder + digit + appendix
outputPath = outputFolder + digit + '.jpg'
# open image file
print 'Opening image', imagePath
imp = IJ.openImage( imagePath )
zp = ZProjector(imp)
zp.setMethod( ZProjector.MAX_METHOD )
zp.doProjection()
MIPimp = zp.getProjection()
fs = FileSaver( MIPimp )
fs.saveAsJpeg( outputPath )
print 'Done'