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


Python ResultsTable.addValue方法代码示例

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


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

示例1: writeCSV

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import addValue [as 别名]
def writeCSV(filePath, results, header):
	""" Write a table as an csv file """
	rt = ResultsTable()
	for i in range(len(results[1])): 
		rt.incrementCounter()
		for j in range(len(results)):
			rt.addValue(str(header[j]), results[j][i])
	rt.show("Results")
	rt.saveAs(filePath); 
开发者ID:mbarbie1,项目名称:fiji-registration-plugins,代码行数:11,代码来源:registration_v5.py

示例2: open_Octopus_file

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import addValue [as 别名]

#.........这里部分代码省略.........
		if targetfile:
			filenums.append( int(targetfile.group(1)) )

	# sort the file numbers
	sorted_filenums = sorted(filenums)

	# make a file stats string
	file_stats_str = file_stem + '\n' + str(fi.width) +'x' + str(fi.height) + 'x' + \
		str(len(sorted_filenums)) +' ('+str(bit_depth)+'-bit)\n' + file_timestamp


	# now open a dialog to let the user set options
	dlg = GenericDialog("Load Octopus Stream (v"+__version__+")")
	dlg.addMessage(file_stats_str)
	dlg.addStringField("Title: ", file_stem)
	dlg.addNumericField("Start: ", 1, 0);
	dlg.addNumericField("End: ", len(sorted_filenums), 0)
	dlg.addCheckbox("Open headers", True)
	dlg.addCheckbox("Contiguous stream?", False)
	dlg.addCheckbox("8-bit unsigned", bit_depth==8)
	dlg.showDialog()

	# if we cancel the dialog, exit here
	if dlg.wasCanceled():
		return

	# set some params
	file_title = dlg.getNextString()
	file_start = dlg.getNextNumber()
	file_end = dlg.getNextNumber()
	DISPLAY_HEADER = bool( dlg.getNextBoolean() )

	# check the ranges
	if file_start > file_end: 
		file_start, file_end = file_end, file_start
	if file_start < 1: 
		file_start = 1
	if file_end > len(sorted_filenums): 
		file_end = len(sorted_filenums) 

	# now set these to the actual file numbers in the stream
	file_start = sorted_filenums[int(file_start)-1]
	file_end = sorted_filenums[int(file_end)-1]

	files_to_open = [n for n in sorted_filenums if n>=file_start and n<=file_end]

	# if we've got too many, truncate the list
	if (len(files_to_open) * fi.nImages * fi.width * fi.height) > (MAX_FRAMES_TO_IMPORT*512*512):
		dlg = GenericDialog("Warning")
		dlg.addMessage("This may use a lot of memory. Continue?")
		dlg.showDialog()
		if dlg.wasCanceled(): return False

	IJ.log( "Opening file: " + op.getDirectory() + op.getFileName() )
	IJ.log( file_stats_str + "\nFile range: " + str(files_to_open[0]) + \
		"-" + str(files_to_open[-1]) +"\n" )

	# make a results table for the metadata
	# NOTE: horrible looping at the moment, but works
	if DISPLAY_HEADER:
		rt = ResultsTable()

	# ok now we can put the files together into the stack
	for i in files_to_open:

		# open the original .dat file and get the stack
		fi.fileName = get_Octopus_filename( op.getDirectory(), file_stem, i)
		
		if os.path.isfile( fi.fileName ):
			fo = FileOpener(fi)
			imp = fo.open(False).getStack() 
	
			# put the slices into the stack
			for im_slice in xrange( imp.getSize() ):
				ip = imp.getProcessor( im_slice+1 )
				if bit_depth == 8:
					bi = ip.getBufferedImage()
				else:
					bi = ip.get16BitBufferedImage() 
				stack.addSlice( file_title,  ip )


			if DISPLAY_HEADER:
				header = get_Octopus_header(op.getDirectory(), file_stem, i)
				for n in xrange(len(header['N'])):
					rt.incrementCounter()
					for k in header.keys():
						rt.addValue(k, parse_header( header[k][n] ) )

		else:
			break

	# done!
	output = ImagePlus('Octopus ('+file_stem+')', stack)
	output.show()

	if DISPLAY_HEADER:
		rt.show("Octopus header metadata")

	return True
开发者ID:quantumjot,项目名称:impy-tools,代码行数:104,代码来源:IJOctopus_.py

示例3: run

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import addValue [as 别名]

#.........这里部分代码省略.........
    graphs = skel_result.getGraph()

    for graph in graphs:
        summed_length = 0.0
        edges = graph.getEdges()
        for edge in edges:
            length = edge.getLength()
            branch_lengths.append(length)
            summed_length += length
        summed_lengths.append(summed_length)

    output_parameters["branch length mean"] = eztables.statistical.average(branch_lengths)
    output_parameters["branch length median"] = eztables.statistical.median(branch_lengths)
    output_parameters["branch length stdevp"] = eztables.statistical.stdevp(branch_lengths)

    output_parameters["summed branch lengths mean"] = eztables.statistical.average(summed_lengths)
    output_parameters["summed branch lengths median"] = eztables.statistical.median(summed_lengths)
    output_parameters["summed branch lengths stdevp"] = eztables.statistical.stdevp(summed_lengths)

    branches = list(skel_result.getBranches())
    output_parameters["network branches mean"] = eztables.statistical.average(branches)
    output_parameters["network branches median"] = eztables.statistical.median(branches)
    output_parameters["network branches stdevp"] = eztables.statistical.stdevp(branches)

    # Create/append results to a ResultsTable...
    status.showStatus("Display results...")
    if "Mito Morphology" in list(WindowManager.getNonImageTitles()):
        rt = WindowManager.getWindow("Mito Morphology").getTextPanel().getOrCreateResultsTable()
    else:
        rt = ResultsTable()

    rt.incrementCounter()
    for key in output_order:
        rt.addValue(key, str(output_parameters[key]))

    # Add user comments intelligently
    if user_comment != None and user_comment != "":
        if "=" in user_comment:
            comments = user_comment.split(",")
            for comment in comments:
                rt.addValue(comment.split("=")[0], comment.split("=")[1])
        else:
            rt.addValue("Comment", user_comment)

    rt.show("Mito Morphology")

	# Create overlays on the original ImagePlus and display them if 2D...
    if imp.getNSlices() == 1:
        status.showStatus("Generate overlays...")
        IJ.run(skeleton, "Green", "")
        IJ.run(binary, "Magenta", "")

        skeleton_ROI = ImageRoi(0,0,skeleton.getProcessor())
        skeleton_ROI.setZeroTransparent(True)
        skeleton_ROI.setOpacity(1.0)
        binary_ROI = ImageRoi(0,0,binary.getProcessor())
        binary_ROI.setZeroTransparent(True)
        binary_ROI.setOpacity(0.25)

        overlay = Overlay()
        overlay.add(binary_ROI)
        overlay.add(skeleton_ROI)

        imp.setOverlay(overlay)
        imp.updateAndDraw()
开发者ID:ScienceToolkit,项目名称:MiNA,代码行数:69,代码来源:MiNA_Analyze_Morphology.py

示例4: WaitForUserDialog

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import addValue [as 别名]
	while goRun:
		wfud = WaitForUserDialog("Pick freehand ROI, then hit OK to analyze")
		wfud.show()
		roi = theImage.getRoi()
		if roi is None:
			goRun = False
		else:
			dataImage.setRoi(roi)
			subImage = dataImage.duplicate()
			dataIp = dataImage.getProcessor()
			dataIp.setRoi(roi)
			maskIp = dataIp.getMask()
			maskImage = ImagePlus("Mask Image",maskIp)
			ic = ImageCalculator()
			countingImage = ic.run("AND create stack",subImage,maskImage)
			pixelCount = 0
			for i in range(1,countingImage.getNSlices()+1):
				countingImage.setSlice(i)
				countingIp = countingImage.getProcessor()
				for x in range(0,countingImage.getWidth()):
					for y in range(0,countingImage.getHeight()):
						if (countingIp.getPixel(x,y) >= intensityThreshold):
							pixelCount = pixelCount + 1
			totAvailablePixels = countingImage.getWidth() * countingImage.getHeight() * countingImage.getNSlices()
			#IJ.log("Pixel count: " + str(pixelCount) + " of " + str(totAvailablePixels))
			countingImage.close()
			rt.incrementCounter()
			rt.addValue("PosPixels",pixelCount)
			rt.addValue("TotPixels",totAvailablePixels)
			rt.show("DMI Results")
	
开发者ID:stalepig,项目名称:deep-mucosal-imaging,代码行数:32,代码来源:Count_bright_pixels_in_ROI.py

示例5: range

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import addValue [as 别名]
	resultsTable.showRowNumbers(False)

	for i in range(0, len(results)):
		if options['oneShot']:
			localBackground = options['localBackground']
			seedRadius = options['seedRadius']
			gaussXY = options['gaussXY']
			gaussZ = options['gaussZ']
		else:
			localBackground = parameters[i]['localBackground']
			seedRadius = parameters[i]['seedRadius']
			gaussXY = parameters[i]['gaussXY']
			gaussZ = parameters[i]['gaussZ']
		
		resultsTable.incrementCounter()
		resultsTable.addValue("Threshold", localBackground)
		resultsTable.addValue("Seed radius", seedRadius)
		resultsTable.addValue("GXY", gaussXY)
		resultsTable.addValue("GZ", gaussZ)
		resultsTable.addValue("TOTAL", results[i]['all'])
		resultsTable.addValue("0-250", results[i]['0'])
		resultsTable.addValue("251-500", results[i]['250'])
		resultsTable.addValue("501-750", results[i]['500'])
		resultsTable.addValue("751-1000", results[i]['750'])
		resultsTable.addValue("1001-1500", results[i]['1000'])
		resultsTable.addValue(">1501", results[i]['1500'])
		resultsTable.addValue("Skipped", results[i]['edge'])

	resultsTable.save(options['outputDir'] + options['outputFile'])

else:
开发者ID:rejsmont,项目名称:nuclearP,代码行数:33,代码来源:SegmentationOptimizer.py

示例6: __fmeasures

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import addValue [as 别名]

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

			
			#for i in range(rect.width*rect.height) :
			#	mm20 += currentPixel[i]*(xCoord[i]-xm)*(xCoord[i]-xm)
			#	mm02 += currentPixel[i]*(yCoord[i]-ym)*(yCoord[i]-ym)
			#	mm11 += currentPixel[i]*(xCoord[i]-xm)*(yCoord[i]-ym)

			#	mm30 += currentPixel[i]*(xCoord[i]-xm)*(xCoord[i]-xm)*(xCoord[i]-xm)
			#	mm03 += currentPixel[i]*(yCoord[i]-ym)*(yCoord[i]-ym)*(yCoord[i]-ym)
			#	mm21 += currentPixel[i]*(xCoord[i]-xm)*(xCoord[i]-xm)*(yCoord[i]-ym)
			#	mm12 += currentPixel[i]*(xCoord[i]-xm)*(yCoord[i]-ym)*(yCoord[i]-ym)

			#	mm40 += currentPixel[i]*(xCoord[i]-xm)*(xCoord[i]-xm)*(xCoord[i]-xm)*(xCoord[i]-xm)
			#	mm04 += currentPixel[i]*(yCoord[i]-ym)*(yCoord[i]-ym)*(yCoord[i]-ym)*(yCoord[i]-ym)
			#	mm31 += currentPixel[i]*(xCoord[i]-xm)*(xCoord[i]-xm)*(xCoord[i]-xm)*(yCoord[i]-ym)
			#	mm13 += currentPixel[i]*(xCoord[i]-xm)*(yCoord[i]-ym)*(yCoord[i]-ym)*(yCoord[i]-ym)

			
			
			#xxcVar = mc20/m00
			#yycVar = mc02/m00
			#xycVar = mc11/m00

			#xcSkew = mc30/(m00 * math.pow(xxcVar,(3.0/2.0)))
			#ycSkew = mc03/(m00 * math.pow(yycVar,(3.0/2.0)))

			#xcKurt = mc40 / (m00 * math.pow(xxcVar,2.0)) - 3.0
			#ycKurt = mc04 / (m00 * math.pow(yycVar,2.0)) - 3.0

			#ecc = (math.pow((mc20-mc02),2.0)+(4.0*mc11*mc11))/m00
			
			#xxmVar = mm20/m00
			#yymVar = mm02/m00
			#xymVar = mm11/m00

			#xmSkew = mm30/(m00 * math.pow(xxmVar,(3.0/2.0)))
			#ymSkew = mm03/(m00 * math.pow(yymVar,(3.0/2.0)))

			#xmKurt = mm40 / (m00 * math.pow(xxmVar,2.0)) - 3.0
			#ymKurt = mm04 / (m00 * math.pow(yymVar,2.0)) - 3.0

			#ecm = (math.pow((mm20-mm02),2.0)+(4.0*mm11*mm11))/m00

			#rt.addValue("xxcVar", xxcVar)
			#rt.addValue("yycVar", yycVar)
			#rt.addValue("xycVar", xycVar)

			#rt.addValue("xcSkew", xcSkew)
			#rt.addValue("ycSkew", ycSkew)

			#rt.addValue("xcKurt", xcKurt)
			#rt.addValue("ycKurt", ycKurt)

			#rt.addValue("Ecc", ecc)

			#rt.addValue("xxmVar", xxmVar)
			#rt.addValue("yymVar", yymVar)
			#rt.addValue("xymVar", xymVar)

			#rt.addValue("xmSkew", xmSkew)
			#rt.addValue("ymSkew", ymSkew)

			#rt.addValue("xmKurt", xmKurt)
			#rt.addValue("ymKurt", ymKurt)

			#rt.addValue("Ecm", ecm)

			rt.addValue("roiw", rect.width)
			rt.addValue("roih", rect.height)

			rt.addValue("cellw", self.__ipw[index-1])
			rt.addValue("cellh", self.__iph[index-1])

			self.__impRes.killRoi()

			xCoord[:] = []
			yCoord[:] = []
			currentPixel[:] = []
			points = []
			points[:] = []
			npointsmax = 0
			
			#lab = self.__labels[index-1]
			nameroi = self.__dictCells[index][0]
			lab = self.__dictCells[index][1]

			if self.__maxfinder : 
				self.__impMax.setSlice(index)
				ipmax = self.__impMax.getProcessor()
				for y in range(ipmax.getHeight()) :
					for x in range(ipmax.getWidth()) :
						if ipmax.getPixelValue(x,y) > 0 : 
							twpoints.append(str(index)+"\t"+lab+"\t"+nameroi+"\t"+str(x)+"\t"+str(y)+"\t"+str(self.__cellsrois[index-1][0].getLength())+"\t"+str(self.__ipw[index-1])+"\t"+str(self.__iph[index-1]))
							npointsmax+=1
				rt.addValue("npoints", npointsmax)

			twlabels.append(str(index)+"\t"+lab+"\t"+nameroi+"\t"+str(npointsmax))
			rt.show("RT-"+self.__name)
			
		rt.show("RT-"+self.__name)
开发者ID:leec13,项目名称:MorphoBactPy,代码行数:104,代码来源:Stack_Cells.py


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