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


Python FileSaver.saveAsTiff方法代码示例

本文整理汇总了Python中ij.io.FileSaver.saveAsTiff方法的典型用法代码示例。如果您正苦于以下问题:Python FileSaver.saveAsTiff方法的具体用法?Python FileSaver.saveAsTiff怎么用?Python FileSaver.saveAsTiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.io.FileSaver的用法示例。


在下文中一共展示了FileSaver.saveAsTiff方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makeStack

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
def makeStack(stackDir, stackName = "stack"):
    IJ.run("Image Sequence...", "open="+stackDir+" file = (\"img_.*\") sort")
    imp = IJ.getImage()
    #IJ.run("8-bit")
    fs = FileSaver(imp)
    print "Saving stack"
    fs.saveAsTiff(stackDir + "/" +stackName+".tif")
开发者ID:jsegert,项目名称:Bio119_root_tracking,代码行数:9,代码来源:applyThreshold_.py

示例2: bSaveStack

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
def bSaveStack(imp, fullPath):
	fs = FileSaver(imp)
	#print 'bSaveStack()', fullPath, 'nslices=', imp.getNSlices()
	bPrintLog('bSaveStack():' + fullPath + ' slices=' + str(imp.getNSlices()), 1)
	if imp.getNSlices()>1:
		fs.saveAsTiffStack(fullPath)
	else:
		fs.saveAsTiff(fullPath)
开发者ID:cudmore,项目名称:bob-fiji-plugins,代码行数:10,代码来源:bAlignBatch_v7_1.py

示例3: straighten

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
def straighten(stackName):
    '''
    IJ.run("Set Measurements...", "area mean min center redirect=None decimal=3")
    IJ.open(stackName)
    imp = IJ.getImage()
    stack = imp.getImageStack()

    for i in xrange(1, imp.getNSlices()+1):
        image = ImagePlus(str(i), stack.getProcessor(i))
        xvals = []
        yvals = []
        maxvals = []
        j = 0

        for k in xrange(0, 512, 2):
            IJ.makeRectangle(k, 0, 4, 512)
            IJ.run("Measure")
            table = RT.getResultsTable()

            x = table.getValue("XM", 0)
            y = table.getValue("YM", 0)
            #maxi = IJ.getResult("Max")
            table = []

            xvals.append(k)
            yvals.append(y)
            #maxvals.append(maxi)

            #if maxvals[j] == 0 and j > 0:
                #yvals[j] = yvals[j-1]

            j += 1

        print "xvals:", xvals
        print "yvals:", yvals
        mr = MR()
        IJ.run("Make Selection...", "freeline, "+str(xvals)+" ,"+ str(yvals))

        #IJ.runMacro("makeSelection...", "freeline, "+str(xvals)+" ,"+ str(yvals));

        #IJ.run("makeSelection(\"freeline\", xvals, yvals);")
        #IJ.run("Straighten...", "line = 80")
    '''
    IJ.open(stackName)
    imp = IJ.getImage()
    stack = imp.getImageStack()
    print imp.getNSlices()
    for i in range(1, imp.getNSlices()+1):
        image = ImagePlus(str(i), stack.getProcessor(i))
        IJ.runMacroFile("/Users/juliansegert/repos/Bio119_root_tracking/straightenOneImage.ijm")
        newImp = WM.getCurrentImage()
    	fs = FileSaver(newImp)
    	fs.saveAsTiff("/Users/juliansegert/Documents/Roots/Four_root_image_stacks/Pos01/"+str(i)+".tif")
    	newImp.close()    
开发者ID:jsegert,项目名称:Bio119_root_tracking,代码行数:56,代码来源:applyThreshold_.py

示例4: applyFilter

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
def applyFilter(stackName):
    imp = IJ.openImage(stackName)
    stack = imp.getImageStack()

    for i in xrange(1, imp.getNSlices()+1):
        image = ImagePlus(str(i), stack.getProcessor(i))
        IJ.run(image, "Auto Threshold", "method=Li white")

        #IJ.run(image, "Analyze Particles...", "size= 1000-Infinity circularity=0.00-1.00 show=Masks in_situ")
    imp2 = ImagePlus("Threshold", stack)
    fs = FileSaver(imp2)
    print "Saving filtered stack"
    fs.saveAsTiff(stackName[:-4] + "-filtered(Li).tif")
开发者ID:jsegert,项目名称:Bio119_root_tracking,代码行数:15,代码来源:applyThreshold_.py

示例5: autoProcAZtecImage

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [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

示例6: run

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
def run():
	msg = "<html>"
	
	wm = WindowManager
	wcount = wm.getWindowCount()
	if wcount == 0:
		msg += "No windows open, nothing to do.<br/>"
		IJ.showMessage(PluginTitle, msg)
		return
	msg += "Number of open windows: " + str(wcount) + "<br/>"

	# let the User choose a directory to store the files
	target = DirectoryChooser("Choose target directory").getDirectory()
	if target is None:
		# User canceled the dialog
		msg += "<br/>No directory chosen, aborting.<br/>"
		IJ.showMessage(PluginTitle, msg)
		return
	msg += "Selected '" + target + "'as destination folder.<br/>"
	
	# determine padding width for filenames
	pad = len(str(wcount))

	for i in range(wcount):
		# image ID lists start with 1 instead of 0, so for convenience:
		wid = i + 1
		imp = wm.getImage(wid)
		imgid = wm.getNthImageID(wid)
		#print "window id:", wid, ", imageID:", wm.getNthImageID(wid)
		
		# Construct filename
		filename = 'tile_' + str(wid).zfill(pad) + '.tif'
		filepath = target + '/' + filename
		fs = FileSaver(imp)
		if imp.getImageStackSize() > 1:
			if not fs.saveAsTiffStack(filepath):
				IJ.error("<html>Error saving current image, stopping.")
				return
		else:
			if not fs.saveAsTiff(filepath):
				IJ.error("<html>Error saving current image, stopping.")
				return
	
	msg += "<br/>Successfully saved " + str(wcount) + " files.<br/>"
	IJ.showMessage(PluginTitle, msg)
开发者ID:KaiSchleicher,项目名称:imcf-toolbox,代码行数:47,代码来源:Save_all_images.py

示例7: saveTif

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
	def saveTif(self, allowOverwrite=1):
		#make output folder
		if not os.path.isdir(self.dstFolder):
			os.makedirs(self.dstFolder)

		#ch1
		if self.imp_ch1:
			#savePath = self.dstFolder + self.enclosingFolderName + '_ch1.tif' #save into new folder
			if os.path.isfile(self.savePath_ch1) and not allowOverwrite:
				print bPrintLog('File Exists NOT Saving: ' + savePath, 3)
			else:
				fs = FileSaver(self.imp_ch1)
				bPrintLog('Saving: ' + self.savePath_ch1, 3)
				if self.imp_ch1.getNSlices()>1:
					fs.saveAsTiffStack(self.savePath_ch1)
				else:
					fs.saveAsTiff(self.savePath_ch1)
			
		#ch2
		if self.imp_ch2:
			#save into new folder
			#savePath = self.dstFolder + self.enclosingFolderName + '_ch2.tif' #save into new folder
			if os.path.isfile(self.savePath_ch2) and not allowOverwrite:
				bPrintLog('File Exists NOT Saving: ' + self.savePath_ch2, 3)
			else:
				fs = FileSaver(self.imp_ch2)
				bPrintLog('Saving: ' + self.savePath_ch2, 3)
				if self.imp_ch2.getNSlices()>1:
					fs.saveAsTiffStack(self.savePath_ch2)
				else:
					fs.saveAsTiff(self.savePath_ch2)
	
		#ch3
		if self.imp_ch3:
			#save into new folder
			#savePath = self.dstFolder + self.enclosingFolderName + '_ch3.tif' #save into new folder
			if os.path.isfile(self.savePath_ch3) and not allowOverwrite:
				bPrintLog('File Exists NOT Saving: ' + self.savePath_ch3, 3)
			else:
				fs = FileSaver(self.imp_ch3)
				bPrintLog('Saving: ' + self.savePath_ch3, 3)
				if self.imp_ch3.getNSlices()>1:
					fs.saveAsTiffStack(self.savePath_ch3)
				else:
					fs.saveAsTiff(self.savePath_ch3)
开发者ID:cudmore,项目名称:bob-fiji-plugins,代码行数:47,代码来源:bPrairie2tif.v0.0_.py

示例8: saveMaxProject

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
	def saveMaxProject(self, destFolder=''):
		# ch1
		if self.imp_ch1:
			# make max project
			zp = ZProjector(self.imp_ch1)
			zp.setMethod(ZProjector.MAX_METHOD)
			zp.doProjection()
			zimp = zp.getProjection()

			# save
			fs = FileSaver(zimp)
			bPrintLog('saveMaxProject():' + self.savePathMax_ch1, 3)
			fs.saveAsTiff(self.savePathMax_ch1)
		# ch2
		if self.imp_ch2:
			# make max project
			zp = ZProjector(self.imp_ch2)
			zp.setMethod(ZProjector.MAX_METHOD)
			zp.doProjection()
			zimp = zp.getProjection()

			# save
			fs = FileSaver(zimp)
			bPrintLog('saveMaxProject():' + self.savePathMax_ch2, 3)
			fs.saveAsTiff(self.savePathMax_ch2)
		# ch1
		if self.imp_ch3:
			# make max project
			zp = ZProjector(self.imp_ch3)
			zp.setMethod(ZProjector.MAX_METHOD)
			zp.doProjection()
			zimp = zp.getProjection()

			# save
			fs = FileSaver(zimp)
			bPrintLog('saveMaxProject():' + self.savePathMax_ch3, 3)
			fs.saveAsTiff(self.savePathMax_ch3)
开发者ID:cudmore,项目名称:bob-fiji-plugins,代码行数:39,代码来源:bPrairie2tif.v0.0_.py

示例9: print

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
tifName = fName + ".tif"
tifPath = os.path.join(fPath, tifName)


print(fName)
imp.changes = False
wid = imp.getWidth()
mu = IJ.micronSymbol
scaUni	= mu + "m"
argThree = "distance=%g known=%f pixel=1 unit=%s" % (wid, fwMicrons, scaUni)
IJ.run(imp, "Set Scale...", argThree)
IJ.run(imp, "Enhance Contrast", "saturated=0.35")

fs = FileSaver(imp)
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)
imp.setTitle(fName)
fs = FileSaver(imp) 
pngName = fName + ".png"
开发者ID:jrminter,项目名称:OSImageAnalysis,代码行数:33,代码来源:autoProcImageVer2.py

示例10: FileSaver

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
			strUnits = mu + "m"
			fScaleX /= 1000.
			fScaleY /= 1000.	
			
		imp = IJ.openImage(strPath)
		cal = imp.getCalibration()
		cal.setXUnit(strUnits)
		cal.setYUnit(strUnits)
		cal.pixelWidth = fScaleX
		cal.pixelHeight = fScaleY
		imp.show()
		time.sleep(1)

		imp.changes = False
		fs = FileSaver(imp)
		if fs.saveAsTiff(strPath):
			print "Tif saved successfully at ", strPath
		
		
		imp.close()
		
		print(strUnits)
		# print(row[3])



print("done")



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

示例11: run

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]

#.........这里部分代码省略.........

			#try usinf ImageStack
			#myImageStack = imp.getImageStack()
			
			#eventuallly just call imp.getProp(str) which Returns the value from the "Info"
			
			#in the future IJ.openImagehavewant to have option to scale down to 512X512
			#run("Scale...", "x=- y=- z=1.0 width=512 height=512 depth=196 interpolation=Bilinear average process create title=20131007_a144_008_ch1-1.tif");

			msgStr = "      Original Image is: " + str(imp.width) + " X " + str(imp.height) + " X " + str(imp.getNSlices())
			print msgStr
			IJ.log(msgStr)
			if imp.getBitDepth() == 16:
				msgStr = "      Converting to 8-bit..."
				print msgStr
				IJ.log(msgStr)
				IJ.run("8-bit")

				if numberOfChannels == 2:
					msgStr = "      deinterleaving"
					print msgStr
					IJ.run("Deinterleave", "how=2"); #makes 2 window
					
					#
					#ch2
					imp2 = IJ.getImage()
					fs = FileSaver(imp2)
					msgStr = "      ch2: Saving deinterleaved 8bit File to: " + outPath2
					print msgStr
					IJ.log(msgStr)

					numSlices = imp2.getNSlices() 
					if (numSlices>1):
						fs.saveAsTiffStack(outPath2)
					else:
						fs.saveAsTiff(outPath2)
						
					#max, ch2
					if (numSlices>1):
						maxCmdParams = 'start=1' + ' stop=' + str(numSlices) + ' projection=[Max Intensity]'
						IJ.run("Z Project...", maxCmdParams)
						#impMax2 = IJ.getImage()
						
					print "      Saving 8bit Max File to", outMaxPath2
					impMax2 = IJ.getImage()
					fs = FileSaver(impMax2)
					fs.saveAsTiff(outMaxPath2)
					
					impMax2.changes = 0
					impMax2.close()
					
					numSaved += 1
					imp2.changes = 0
					imp2.close()
					
					#
					#ch1
					imp1 = IJ.getImage()
					fs = FileSaver(imp1)
					msgStr = "      ch1: Saving deinterleaved 8bit File to" + outPath1
					print msgStr
					
					numSlices = imp1.getNSlices() 
					if (numSlices>1):
						fs.saveAsTiffStack(outPath1)
					else:
开发者ID:cudmore,项目名称:bob-fiji-plugins,代码行数:70,代码来源:Batch_Covert_To_8_Bit_v3_.py

示例12: import_and_straighten

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
def import_and_straighten(imgDir):
    """
    Core function. Opens images in given directory in series and calls a straightening function.
    Thresholds using weka if stddev of pixel intensities is too high (bright field), otherwise uses
    histogram based segmentation.
    """
    targetWidth = 800 #adjustable
    make_directory(imgDir)
    index = "000000000"
    filename = imgDir + "/img_" + index + "__000.tif"
    if path.exists(filename):
        weka = Weka_segmentor(IJ.openImage(filename))
    while path.exists(filename):
        IJ.run("Set Measurements...", "mean standard min center redirect=None decimal=3")
        IJ.run("Clear Results")
        imp = IJ.openImage(filename)
        imp.show()
        IJ.run("Rotate 90 Degrees Left")
        IJ.run("Measure")
        table = RT.getResultsTable()
        stddev = RT.getValue(table, "StdDev", 0)

        if stddev < 20:
            segmented = weka.getThreshold(imp)
            segmented.show()
            IJ.run("8-bit")
            IJ.run("Invert")
            imp.close()
            imp = segmented

        else:
            IJ.run(imp, "Auto Threshold", "method=Li white") #threshold

        imp = preProcess_(imp)

        #straighten_roi_rotation()
        coords = run_straighten()

        newImp = IJ.getImage()
        """
        fs = FileSaver(newImp)
        fs.saveAsTiff(imgDir + "/straightened" + "/img_" + index + "__000-straight.tif")
        """

        IJ.run("Image Padder", "pad_right="+str(targetWidth - newImp.getWidth()))
        paddedImp = IJ.getImage()
        fs = FileSaver(paddedImp)
        fs.saveAsTiff(imgDir + "/binary" + "/img_" + index + "__000-padded.tif")

        IJ.runMacro("while (nImages>0) {selectImage(nImages);close();}")

        #use same centerline for original greyscale image
        imp = IJ.openImage(filename)
        imp.show()
        IJ.run("Rotate 90 Degrees Left")
        IJ.run("8-bit")
        IJ.runMacro("makeLine("+coords+")")
        IJ.run("Straighten...", "line = 80")
        newImp = IJ.getImage()
        IJ.run("Image Padder", "pad_right="+str(targetWidth - newImp.getWidth()))
        paddedImp = IJ.getImage()
        IJ.run("8-bit")
        fs = FileSaver(paddedImp)
        fs.saveAsTiff(imgDir + "/greyscale" + "/img_" + index + "__000-padded.tif")
        IJ.runMacro("while (nImages>0) {selectImage(nImages);close();}")

        index = to_9_Digits(str(int(index)+1))
        filename = filename = imgDir + "/img_" + index + "__000.tif"
开发者ID:jsegert,项目名称:Bio119_root_tracking,代码行数:70,代码来源:Straighten+Root+Stack_.py

示例13: FileSaver

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
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")
开发者ID:jrminter,项目名称:OSImageAnalysis,代码行数:32,代码来源:calOxfordImg.py

示例14: runOneTif

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]

#.........这里部分代码省略.........
	madeAverage = 0

	
	# if numSlices is not divisable by gNumToAverage then chop a few slices off bottom/end
	if b_sequence.startswith('TSeries'):
		if globalOptions['gNumToAverage'] > 1:
			numToRemove = numSlices % globalOptions['gNumToAverage']
			if numToRemove > 0:
				bPrintLog('Removing bottom slices: ' + str(numToRemove), 3)
				# run("Slice Remover", "first=3 last=5 increment=1");
				removeArgs = 'first=' + str(numSlices-numToRemove+1) + ' last=' + str(numSlices) + ' increment=1'
				IJ.run('Slice Remover', removeArgs)
				numSlices = imp.getNSlices()
				bPrintLog('numSlices: ' + str(numSlices), 3)
				
			#fix this: if stack is really short this will not be taken
			if (numSlices > globalOptions['gNumToAverage']):
				bPrintLog('Taking average of ' + str(globalOptions['gNumToAverage']) + ' slices from ' + str(numSlices), 3)
				stackRegParams = 'projection=[Average Intensity] group=' + str(globalOptions['gNumToAverage'])
				IJ.run('Grouped Z Project...', stackRegParams) # makes window AVG_
		
				madeAverage = 1
				
				avgWindow = 'AVG_' + impWin
				avgImp = WindowManager.getImage(avgWindow)
				avgSlices = avgImp.getNSlices()
	
				# Grouped Z PRoject swaps slices for frames?
				tmpSlices = avgImp.getNSlices()
				tmpFrames = avgImp.getNFrames()
				if tmpFrames > 1:
					newSlices = tmpFrames
					newFrames = tmpSlices
					nChannels = 1
					bPrintLog('Swaping frames for slices after grouped z',3)
					bPrintLog('newSlices=' + str(newSlices) + ' newFrames='+str(newFrames), 4)
					avgImp.setDimensions(nChannels, newSlices, newFrames)
				
				infoStr += 'gNumToAverage=' + str(globalOptions['gNumToAverage']) + '\n'
				# I want to adjust the framePeriod, prairie would be 'b_framePeriod'
				avgImp.setProperty("Info", infoStr)
		else:
			avgImp = imp
			avgSlices = numSlices
		
	else:
		bPrintLog('Not taking average of sequence: ' + b_sequence,3)
		avgImp = imp
		avgSlices = numSlices

		
	if globalOptions['medianFilter']>0:
		bPrintLog('Running median filter: ' + str(globalOptions['medianFilter']), 3)
		medianArgs = 'radius=' + str(globalOptions['medianFilter']) + ' stack'
		IJ.run(avgImp, "Median...", medianArgs);
		infoStr += 'bMedianFilter=' + str(globalOptions['medianFilter']) + '\n'
		avgImp.setProperty("Info", infoStr)

	# convert to 8 bit
	# 1) read bit depth from header (e.g. 2^13)
	# 2) do math on image and convert to 8-bit
	# run("Divide...", "value=32 stack");
	if globalOptions['gConvertToEightBit']:
		bPrintLog('converting to 8-bit by dividing image down and then convert to 8-bit with ImageConverter.setDoScaling(False)', 3)
		bitDepth = 2^13
		divideBy = bitDepth / 2^8
		# divide the 13 bit image down to 8 bit
		#run("Divide...", "value=32 stack");
		bPrintLog('divideBy:' + str(divideBy), 3)
		divideArgs = 'value=' + str(divideBy) + ' stack'
		IJ.run(avgImp, "Divide...", divideArgs);
		# convert to 8-bit will automatically scale, to turn this off use
		# eval("script", "ImageConverter.setDoScaling(false)"); 
		ImageConverter.setDoScaling(False)
		# run("8-bit");
		bPrintLog('converting to 8-bit with setDoScaling False', 3)
		IJ.run(avgImp, "8-bit", '');
	
	bPrintLog('Saving stack with ' + str(avgSlices) + ' slices:' + dstTifPath, 3)
	fs = FileSaver(avgImp)
	if avgSlices>1:
		fs.saveAsTiffStack(dstTifPath)
	else:
		fs.saveAsTiff(dstTifPath)

	if madeAverage:
		avgImp.changes = 0
		avgImp.close()
	
	imp.changes = 0
	imp.close()
	
	# end body
	#
	
	# why was this here
	#imp.changes = 0
	#imp.close()

	return 1
开发者ID:cudmore,项目名称:bob-fiji-plugins,代码行数:104,代码来源:bAverageFrames_.py

示例15: FileSaver

# 需要导入模块: from ij.io import FileSaver [as 别名]
# 或者: from ij.io.FileSaver import saveAsTiff [as 别名]
# testHeadlessCrop_.py
#
# load and crop an image in headless mode
from org.python.core import codecs
codecs.setDefaultEncoding('utf-8')

import os
from ij import IJ
from ij.io import FileSaver

gitDir = os.environ['GIT_HOME']
relImg = "/OSImageAnalysis/images"
imgPath = gitDir + relImg + "/latex.tif"

delta = 32
imp = IJ.openImage(imgPath)
name = imp.getShortTitle()
w = imp.getWidth()
h = imp.getHeight()
imp.setRoi(delta,delta,w-(2*delta),h-(2*delta))
IJ.run(imp,"Crop","")

imgPath = gitDir + relImg + "/%s-cr.tif" % name

fs = FileSaver(imp) 
fs.saveAsTiff(imgPath) 



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


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