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


Python ResultsTable.show方法代码示例

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


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

示例1: writeCSV

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [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: MandersPlugin

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
class MandersPlugin(ImageListener, WindowAdapter):

	def __init__(self):
		self.imp = None
		self.preview = None
		self.createMainWindow()
		self.cells = None
		self.files = []
		self.results = ResultsTable()
		ImagePlus.addImageListener(self)
		self.selectInputDir()
		self.selectOutputDir()
		self.pairs = []
		self.methods = []
		self.processNextFile()

	def selectInputDir(self):
		inputDialog = DirectoryChooser("Please select a directory contaning your images")
		inputDir = inputDialog.getDirectory()
		for imageFile in os.listdir(inputDir):
			self.files.append(inputDir + imageFile)

	def selectOutputDir(self):
		outputDialog = DirectoryChooser("Please select a directory to save your results")
		self.outputDir = outputDialog.getDirectory()
		
	def closeImage(self):
		if self.imp is not None:
			self.imp.close()
			self.imp = None
		if self.preview is not None:
			self.preview.close()
			self.preview = None

	def openImage(self, imageFile):
		try:
			images = BF.openImagePlus(imageFile)
			self.imp = images[0]
		except UnknownFormatException:
			return None
		if self.imp.getNChannels() < 2:
			IJ.error("Bad image format", "Image must contain at lease 2 channels!")
			return None
		if not self.pairs or \
			not self.methods:
			self.getOptionsDialog(self.imp)
		title = self.imp.title
		self.imp.title = title[:title.rfind('.')]
		return self.imp

	def getOptionsDialog(self, imp):
		thr_methods = ["None", "Default", "Huang", "Intermodes", "IsoData",  "Li", "MaxEntropy","Mean", "MinError(I)", "Minimum", "Moments", "Otsu", "Percentile", "RenyiEntropy", "Shanbhag" , "Triangle", "Yen"]
		gd = GenericDialog("Please select channels to collocalize")
		for i in range(1, imp.getNChannels() + 1):
			gd.addChoice("Threshold method for channel %i" % i, thr_methods, "None")
		gd.showDialog()
		if gd.wasCanceled():
			self.exit()
		channels = []
		for i in range(1, imp.getNChannels() + 1):
			method = gd.getNextChoice()
			self.methods.append(method)
			if method != "None":
				channels.append(i)
		for x in channels:
			for y in channels:
				if x < y:
					self.pairs.append((x, y))

	def processNextFile(self):
		if self.files:
			imageFile = self.files.pop(0)
			return self.processFile(imageFile)
		else:
			return False
			
	def processFile(self, imageFile):
		imp = self.openImage(imageFile)
		if imp is not None:
			cell = Cell(imp.NSlices, 1)
			self.cells = DelegateListModel([])
			self.cells.append(cell)
			self.showMainWindow(self.cells)
			if self.checkbox3D.isSelected():
				self.displayImage(imp)
			else:
				self.displayImage(imp, False)
				self.preview = self.previewImage(imp)
				self.displayImage(self.preview)
			return True
		else:
			return self.processNextFile()
	
	def displayImage(self, imp, show = True):
		imp.setDisplayMode(IJ.COMPOSITE)
		enhancer = ContrastEnhancer()
		enhancer.setUseStackHistogram(True)
		splitter = ChannelSplitter()
		for c in range(1, imp.getNChannels() + 1):
			imp.c = c
#.........这里部分代码省略.........
开发者ID:rejsmont,项目名称:FijiScripts,代码行数:103,代码来源:mColoc3D.py

示例3: RGBStackMerge

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
  		print "...ch2 mean     ", stats.mean
  		print ".."  		
  		print "...ch3 TotalInt ", statsch3.area * statsch3.mean
  		print "...ch3 Area     ", statsch3.area
  		print "...ch3 mean     ", statsch3.mean
	 	rt.incrementCounter()
	 	rt.setValue("DotID", ct, i)
	 	rt.setValue("DotX", ct, yA[i])
	 	rt.setValue("DotY", ct, xA[i])
	 	rt.setValue("DotZ", ct, zA[i])	 	
		rt.setValue("Ch2_TotalIntensity", ct, stats.area * stats.mean)
		rt.setValue("Ch2_MeanIntensity", ct, stats.mean)
		rt.setValue("Ch3_TotalIntensity", ct, statsch3.area * statsch3.mean)
		rt.setValue("Ch3_meanIntensity", ct, statsch3.mean)
		ct += 1
rt.show("Dot Intensity")


#AREA, AREA_FRACTION, CENTER_OF_MASS, CENTROID, CIRCULARITY, ELLIPSE, FERET, 
#INTEGRATED_DENSITY, INVERT_Y, KURTOSIS, LABELS, LIMIT, MAX_STANDARDS, MEAN, 
#MEDIAN, MIN_MAX, MODE, PERIMETER, RECT, SCIENTIFIC_NOTATION, SHAPE_DESCRIPTORS, 
#SKEWNESS, SLICE, STACK_POSITION, STD_DEV

# preparing merged stack with detected dots. 

merge = RGBStackMerge()
#stacks = Array()
#stacks[0] = imp2.getImageStack()
#stacks[1] = imp.getImageStack()
#imgconv = ImageConverter(imp)
#imgconv.setDoScaling(True)
开发者ID:cmci,项目名称:3D-DotDetection,代码行数:33,代码来源:Dot3Danalysis_2_MI.py

示例4: updatepressed

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
		def updatepressed(event):
			self.__image=IJ.getImage()
			rm = RoiManager.getInstance()
			if (rm==None): rm = RoiManager()
			rm.runCommand("reset")
			self.__image.killRoi()
			IJ.run("Threshold...")
			IJ.setAutoThreshold(self.__image, "MaxEntropy")
			
			rt=ResultsTable()
			pa=ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER+ParticleAnalyzer.CLEAR_WORKSHEET , Measurements.AREA+Measurements.ELLIPSE+Measurements.MEAN, rt, 0.00, 10000.00, 0.00, 1.00)
			pa.analyze(self.__image)
			self.__roisArray=[]
			self.__roisArray=rm.getRoisAsArray()
			#for i in range(rm.getCount()) : 
			#	rm.select(i)
			#	rm.runCommand("Set Color", "0000FF", 2)
				
			IJ.resetThreshold(self.__image)
			rt.show("tempRT")
			areas=rt.getColumn(ResultsTable.AREA)
			means=rt.getColumn(ResultsTable.MEAN)
			majors=rt.getColumn(ResultsTable.MAJOR)
			minors=rt.getColumn(ResultsTable.MINOR)
			#print 0
			if self.__slidersDict["Area_max"].getMaximum() <  int(max(areas)+1):
			#	print 1
				self.__slidersDict["Area_max"].setMaximum(int(max(areas))+1)
			if self.__slidersDict["Area_min"].getMaximum() < int(max(areas)+1):
			#	print 2
				self.__slidersDict["Area_min"].setMaximum(int(max(areas))+1)
			if self.__slidersDict["Mean_max"].getMaximum() < int(max(means)+1):
			#	print 3
				self.__slidersDict["Mean_max"].setMaximum(int(max(means))+1)
			if self.__slidersDict["Mean_min"].getMaximum() < int(max(means)+1):
			#	print 4
				self.__slidersDict["Mean_min"].setMaximum(int(max(means))+1)
			if self.__slidersDict["Major_max"].getMaximum() < int(max(majors)):
			#	print 5
				self.__slidersDict["Major_max"].setMaximum(int(max(majors))+1)
			if self.__slidersDict["Major_min"].getMaximum() < int(max(majors)+1):
			#	print 6
				self.__slidersDict["Major_min"].setMaximum(int(max(majors))+1)
			if self.__slidersDict["Minor_max"].getMaximum() < int(max(minors)+1):
			#	print 7
				self.__slidersDict["Minor_max"].setMaximum(int(max(minors))+1)
			if self.__slidersDict["Minor_min"].getMaximum() < int(max(minors)+1):
			#	print 8
				self.__slidersDict["Minor_min"].setMaximum(int(max(minors))+1)
			if self.__slidersDict["AR_max"].getMaximum() < int((max(majors)+1)/min(minors)+1):
			#	print 9
				self.__slidersDict["AR_max"].setMaximum(int((max(majors)+1)/(min(minors))))
			if self.__slidersDict["AR_min"].getMaximum() < int((max(majors)+1)/min(minors)):
			#	print 10
				self.__slidersDict["AR_min"].setMaximum(int((max(majors)+1)/(min(minors))))

			#print 11
				
			for sb in self.__slidersDict.values():
				sb.repaint()

			#rm.runCommand("reset")
			#temprois=self.getIncludeRois()
			#IJ.run(self.__image, "Remove Overlay", "")
			#o=Overlay()
			#for roi in temprois:
			#	o.addElement(roi)
			#self.__image.killRoi()
			#self.__image.setOverlay(o)
			self.__image.updateAndDraw()
开发者ID:leec13,项目名称:MorphoBactPy,代码行数:72,代码来源:RangeRois.py

示例5: open_Octopus_file

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
def open_Octopus_file():

	# set up a file info structure
	fi = FileInfo()
	fi.fileFormat = fi.RAW
	fi.fileType=FileInfo.GRAY16_UNSIGNED
	fi.intelByteOrder = True
	fi.nImages = 1

	op = OpenDialog("Choose Octopus .dth file...", "")
	if not op.getDirectory(): return False

	# get the file extension
	file_extension = re.search('(\.[a-z][a-z][a-z])', op.getFileName()).group(1)
	
	if file_extension != ".dth":
		dlg = GenericDialog("Warning")
		dlg.addMessage("Please select an octopus .dth file")
		dlg.showDialog()
		return False

	# now strip the filename into a stem and index
	file_parse = re.match('([a-zA-z0-9_]*_)([0-9]+)\.dth', op.getFileName())
	file_stem = file_parse.group(1)
	file_index = int( file_parse.group(2) )

	# ok now we need to parse the header info
	header = get_Octopus_header(op.getDirectory(), file_stem, file_index)
	fi.nImages  = len(header['N'])

	# check to see whether we have a bit depth, if not, assume 16-bit
	if 'Bit_Depth' in header:
		print header['Bit_Depth']
		bit_depth = int(header['Bit_Depth'][0])
		if bit_depth == 8: fi.fileType = FileInfo.GRAY8
	else:
		bit_depth = 16

	# will assume that all files have the same size
	fi.width = int( header['W'][0] )
	fi.height = int( header['H'][0] )
	file_timestamp = strftime("%a, %d %b %Y %H:%M:%S", gmtime(float(header['Time'][0])) )
	

	# make a new imagestack to store the data
	stack = ImageStack(fi.width, fi.height)

	# finally, we need to make a list of files to import as sometimes we have
	# non contiguous file numbers
	try:
		files = os.listdir(op.getDirectory())
	except IOError:
		raise IOError( "No files exist in directory: " + op.getDirectory())

	filenums = []
	for f in files:
		# strip off the stem, and get the number
		targetfile = re.match(file_stem+'([0-9]+)\.dth', f)
		# only take thosefiles which match the formatting requirements
		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
#.........这里部分代码省略.........
开发者ID:quantumjot,项目名称:impy-tools,代码行数:103,代码来源:IJOctopus_.py

示例6: ResultsTable

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
# paOpt = PA.CLEAR_WORKSHEET +\
paOpt = PA.SHOW_OUTLINES + PA.EXCLUDE_EDGE_PARTICLES  # +\
# PA.INCLUDE_HOLES #+ \
#       PA.SHOW_RESULTS
measOpt = PA.AREA + PA.CENTROID + PA.SLICE  # + PA.SHAPE_DESCRIPTORS + PA.INTEGRATED_DENSITY
rt = ResultsTable()
MINSIZE = 2
MAXSIZE = 10000
pa = PA(paOpt, measOpt, rt, MINSIZE, MAXSIZE)
pa.setHideOutputImage(True)
# pa.processStack = True
for i in range(imp.getStackSize()):
    imp.setSlice(i + 1)
    pa.analyze(imp)
# pa.getOutputImage().show()
rt.show("cells")

# rt = ResultsTable.open2(path)
dotlinker = DotLinker(loadmethod, rt)  # better there is a constructor also with linkkost function object.
dotlinker.setTrajectoryThreshold(5)
dotlinker.setShowTrackTable(False)
# dotlinker = DotLinker(loadmethod)
linkcostfunction = dotlinker.setLinkCostFunction(lcAD)
linkcostfunction.setParameters(5.0, 2.0)
rtout = dotlinker.doLinking(False)
rtout.show("Tracks")


vd = ViewDynamicsArea(imp)
vd.plotAreaDynamics(rtout, vd.PLOTALL)
imp.show()
开发者ID:cmci,项目名称:DotLinker,代码行数:33,代码来源:DotLinker2014.py

示例7: calculateThreshold

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
		thr1, thrimp1 = calculateThreshold(imp1, roi, methods[0])
		thr2, thrimp2 = calculateThreshold(imp2, roi, methods[1])
		
		cursor = TwinCursor(img1.randomAccess(), img2.randomAccess(), Views.iterable(mask).localizingCursor())
		rtype = img1.randomAccess().get().createVariable()
		raw = manders.calculateMandersCorrelation(cursor, rtype)
		rthr1 = rtype.copy()
		rthr2 = rtype.copy()
		rthr1.set(thr1)
		rthr2.set(thr2)
		cursor.reset()
		thrd = manders.calculateMandersCorrelation(cursor, rthr1, rthr2, ThresholdMode.Above)
		print "Results are: %f %f %f %f" % (raw.m1, raw.m2, thrd.m1, thrd.m2)

		results.incrementCounter()
		rowno = results.getCounter() - 1
		results.setValue("Cell", rowno, int(rowno))
		results.setValue("Threshold 1", rowno, int(thr1))
		results.setValue("Threshold 2", rowno, int(thr2))
		results.setValue("M1 raw", rowno, float(raw.m1))
		results.setValue("M2 raw", rowno, float(raw.m2))
		results.setValue("M1 thrd", rowno, float(thrd.m1))
		results.setValue("M2 thrd", rowno, float(thrd.m2))
		
		thrimp = RGBStackMerge.mergeChannels([thrimp1, thrimp2], False)
		saver = FileSaver(thrimp)
		saver.saveAsTiffStack(outputDir + "Cell_%i-" % results.getCounter() + title + ".tif")
		thrimp.close()

results.show("Colocalization results")
开发者ID:rejsmont,项目名称:FijiScripts,代码行数:32,代码来源:mcoloc.py

示例8: OvalRoi

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
                continue
            idx = tempvar.index(max(tempvar))
            start = frame[0]
            metaphase = frame[idx+3]
            
            if (division - start > 15 and division - start < 100):
                if start>0:
                    for spot in sortedTrack:

                        # Fetch spot features directly from spot.
                        x=spot.getFeature('POSITION_X')
                        y=spot.getFeature('POSITION_Y')
                        t=spot.getFeature('FRAME')
                        roi2 = OvalRoi(x/dx - (6*dx), y/dy - (6*dy), 12, 12)
                        roi2.setPosition(int(t))
                        rm.add(imp, roi2, nextRoi)
                        nextRoi = nextRoi+1
                    resultstable.setValue("IMAGE_NAME", trackrowNumber, filename)
                    resultstable.setValue("TRACK_ID", trackrowNumber, id)
                    resultstable.setValue("START", trackrowNumber, start)
                    resultstable.setValue("METAPHASE", trackrowNumber, metaphase)
                    resultstable.setValue("END", trackrowNumber, division)

                    trackrowNumber = trackrowNumber + 1
#                    plot = Plot(str(id), "slice", "mean", frame, var) 
#                    plot.show()
#                    break

#        imp.close()
resultstable.show("Results")     
开发者ID:bramalingam,项目名称:Omero-Imagej-Scripts,代码行数:32,代码来源:Mitotic_Tracker_Final.py

示例9: run

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
def run(imp, preprocessor_path, postprocessor_path, threshold_method, user_comment):

    output_parameters = {"image title" : "",
    "preprocessor path" : float,
    "post processor path" : float,
    "thresholding op" : float,
    "use ridge detection" : bool,
    "high contrast" : int,
    "low contrast" : int,
    "line width" : int,
    "minimum line length" : int,
    "mitochondrial footprint" : float,
    "branch length mean" : float,
    "branch length median" : float,
    "branch length stdevp" : float,
    "summed branch lengths mean" : float,
    "summed branch lengths median" : float,
    "summed branch lengths stdevp" : float,
    "network branches mean" : float,
    "network branches median" : float,
    "network branches stdevp" : float}

    output_order = ["image title",
    "preprocessor path",
    "post processor path",
    "thresholding op",
    "use ridge detection",
    "high contrast",
    "low contrast",
    "line width",
    "minimum line length",
    "mitochondrial footprint",
    "branch length mean",
    "branch length median",
    "branch length stdevp",
    "summed branch lengths mean",
    "summed branch lengths median",
    "summed branch lengths stdevp",
    "network branches mean",
    "network branches median",
    "network branches stdevp"]

    # Perform any preprocessing steps...
    status.showStatus("Preprocessing image...")
    if preprocessor_path != None:
        if preprocessor_path.exists():
            preprocessor_thread = scripts.run(preprocessor_path, True)
            preprocessor_thread.get()
            imp = WindowManager.getCurrentImage()
    else:
        pass

    # Store all of the analysis parameters in the table
    if preprocessor_path == None:
        preprocessor_str = ""
    else:
        preprocessor_str = preprocessor_path.getCanonicalPath()
    if postprocessor_path == None:
        postprocessor_str = ""
    else:
        postprocessor_str = preprocessor_path.getCanonicalPath()

    output_parameters["preprocessor path"] = preprocessor_str
    output_parameters["post processor path"] = postprocessor_str
    output_parameters["thresholding op"] = threshold_method
    output_parameters["use ridge detection"] = str(use_ridge_detection)
    output_parameters["high contrast"] = rd_max
    output_parameters["low contrast"] = rd_min
    output_parameters["line width"] = rd_width
    output_parameters["minimum line length"] = rd_length

    # Create and ImgPlus copy of the ImagePlus for thresholding with ops...
    status.showStatus("Determining threshold level...")
    imp_title = imp.getTitle()
    slices = imp.getNSlices()
    frames = imp.getNFrames()
    output_parameters["image title"] = imp_title
    imp_calibration = imp.getCalibration()
    imp_channel = Duplicator().run(imp, imp.getChannel(), imp.getChannel(), 1, slices, 1, frames)
    img = ImageJFunctions.wrap(imp_channel)

    # Determine the threshold value if not manual...
    binary_img = ops.run("threshold.%s"%threshold_method, img)
    binary = ImageJFunctions.wrap(binary_img, 'binary')
    binary.setCalibration(imp_calibration)
    binary.setDimensions(1, slices, 1)

    # Get the total_area
    if binary.getNSlices() == 1:
        area = binary.getStatistics(Measurements.AREA).area
        area_fraction = binary.getStatistics(Measurements.AREA_FRACTION).areaFraction
        output_parameters["mitochondrial footprint"] =  area * area_fraction / 100.0
    else:
        mito_footprint = 0.0
        for slice in range(binary.getNSlices()):
            	binary.setSliceWithoutUpdate(slice)
                area = binary.getStatistics(Measurements.AREA).area
                area_fraction = binary.getStatistics(Measurements.AREA_FRACTION).areaFraction
                mito_footprint += area * area_fraction / 100.0
        output_parameters["mitochondrial footprint"] = mito_footprint * imp_calibration.pixelDepth
#.........这里部分代码省略.........
开发者ID:ScienceToolkit,项目名称:MiNA,代码行数:103,代码来源:MiNA_Analyze_Morphology.py

示例10: WaitForUserDialog

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

示例11: ResultsTable

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


imp = IJ.getImage()

# Create a table to store the results
table = ResultsTable()
# Create a hidden ROI manager, to store a ROI for each blob or cell
roim = RoiManager(True)
# Create a ParticleAnalyzer, with arguments:
# 1. options (could be SHOW_ROI_MASKS, SHOW_OUTLINES, SHOW_MASKS, SHOW_NONE, ADD_TO_MANAGER, and others; combined with bitwise-or)
# 2. measurement options (see [http://rsb.info.nih.gov/ij/developer/api/ij/measure/Measurements.html Measurements])
# 3. a ResultsTable to store the measurements
# 4. The minimum size of a particle to consider for measurement
# 5. The maximum size (idem)
# 6. The minimum circularity of a particle
# 7. The maximum circularity
pa = ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER,
	Measurements.AREA
	+ Measurements.CENTER_OF_MASS
	+ Measurements.SHAPE_DESCRIPTORS
	+ Measurements.INTEGRATED_DENSITY,
	table, 0,
	Double.POSITIVE_INFINITY, 0.0, 1.0)
pa.setHideOutputImage(True)
 
if pa.analyze(imp):
  print "All ok"
  table.show("foooo");
else:
  print "There was a problem in analyzing", blobs
开发者ID:KaiSchleicher,项目名称:imcf-toolbox,代码行数:33,代码来源:ParticleAnalyzer_ResultsTable.py

示例12: __fmeasures

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
	def __fmeasures(self) : 
		self.__Cutoff = float(self.__display4.text)
		nslices = self.__impRes.getImageStackSize() 
		rt = ResultsTable()
		rt.show("RT-"+self.__name)
		if self.__maxfinder : twpoints = TextWindow("points-"+self.__name, "index\tlabel\tname\tx\ty\taxis\tcellw\tcellh", "", 200, 450)
		twlabels = TextWindow("labels-"+self.__name, "index\tlabel\tname\tnpoints", "", 200, 450)

		isres = self.__impRes.getImageStack()
		
		for index in range(1, nslices+1):
			pc = (index*100)/nslices
			IJ.showStatus("Je suis a "+str(pc)+"%")
			self.__impRes.setSlice(index)
			self.__impRes.killRoi()
			roi = self.__listrois[index-1]
			self.__impRes.setRoi(roi)
			analyser= Analyzer(self.__impRes, Analyzer.LABELS+Analyzer.CENTER_OF_MASS+Analyzer.CENTROID+Analyzer.INTEGRATED_DENSITY+Analyzer.MEAN+Analyzer.KURTOSIS+Analyzer.SKEWNESS+Analyzer.MIN_MAX+Analyzer.SLICE+Analyzer.STACK_POSITION+Analyzer.STD_DEV, rt)
			analyser.measure()
			rt.show("RT-"+self.__name)
			
			rect=roi.getBounds()
			ip = self.__impRes.getProcessor()

			xCoord = []
			yCoord = []
			currentPixel = []

			m00 = 0.00
			m10 = 0.00
			m01 = 0.00
			
			mc20 = 0.00
			mc02 = 0.00
			mc11 = 0.00
			mc30 = 0.00
			mc03 = 0.00
			mc21 = 0.00
			mc12 = 0.00
			mc40 = 0.00
			mc04 = 0.00
			mc31 = 0.00
			mc13 = 0.00

			mm20 = 0.00
			mm02 = 0.00
			mm11 = 0.00
			mm30 = 0.00
			mm03 = 0.00
			mm21 = 0.00
			mm12 = 0.00
			mm40 = 0.00
			mm04 = 0.00
			mm31 = 0.00
			mm13 = 0.00
			
			
			#for y in range(rect.y, rect.y+rect.height, 1) :
			#	for x in range(rect.x, rect.x+rect.width, 1) :
			#		xCoord.append(x+0.5)
			#		yCoord.append(y+0.5)
			#		#pixel=ip.getf(x,y)-self.__Cutoff
			#		pixel = ip.getPixelValue(x,y)-self.__Cutoff
			#		if pixel < 0 : pixel = 0
			#		currentPixel.append(pixel)
			#		m00 += currentPixel[-1]
			#		m10 += currentPixel[-1]*xCoord[-1]
			#		m01 += currentPixel[-1]*yCoord[-1]


			#xm = m10/(m00+0.00000001)
			#ym = m01/(m00+0.00000001)

			#xc = rect.width/2.00
			#yc = rect.height/2.00

			#for i in range(rect.width*rect.height) :

			#	xcrel = xCoord[i]-xc
			#	ycrel = yCoord[i]-yc
			
			#	#mc20 += currentPixel[i]*(xCoord[i]-xc)*(xCoord[i]-xc)
			#	#mc02 += currentPixel[i]*(yCoord[i]-yc)*(yCoord[i]-yc)
			#	#mc11 += currentPixel[i]*(xCoord[i]-xc)*(yCoord[i]-yc)
			#	#
			#	#mc30 += currentPixel[i]*(xCoord[i]-xc)*(xCoord[i]-xc)*(xCoord[i]-xc)
			#	#mc03 += currentPixel[i]*(yCoord[i]-yc)*(yCoord[i]-yc)*(yCoord[i]-yc)
			#	#mc21 += currentPixel[i]*(xCoord[i]-xc)*(xCoord[i]-xc)*(yCoord[i]-yc)
			#	#mc12 += currentPixel[i]*(xCoord[i]-xc)*(yCoord[i]-yc)*(yCoord[i]-yc)
			#	#
			#	#mc40 += currentPixel[i]*(xCoord[i]-xc)*(xCoord[i]-xc)*(xCoord[i]-xc)*(xCoord[i]-xc)
			#	#mc04 += currentPixel[i]*(yCoord[i]-yc)*(yCoord[i]-yc)*(yCoord[i]-yc)*(yCoord[i]-yc)
			#	#mc31 += currentPixel[i]*(xCoord[i]-xc)*(xCoord[i]-xc)*(xCoord[i]-xc)*(yCoord[i]-yc)
			#	#mc13 += currentPixel[i]*(xCoord[i]-xc)*(yCoord[i]-yc)*(yCoord[i]-yc)*(yCoord[i]-yc)

			#	mc20 += currentPixel[i]*xcrel*xcrel
			#	mc02 += currentPixel[i]*ycrel*ycrel
			#	mc11 += currentPixel[i]*xcrel*ycrel
				
			#	mc30 += currentPixel[i]*xcrel*xcrel*xcrel
#.........这里部分代码省略.........
开发者ID:leec13,项目名称:MorphoBactPy,代码行数:103,代码来源:Stack_Cells.py

示例13: main

# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import show [as 别名]
def main():
    rt = RT.open2(table_file.getAbsolutePath())
    if not rt: return

    log(" --- --- --- ")
    log("Loaded %s" % table_file.getAbsolutePath())
    log("Loading column lists...")

    # Get column indices from imported file
    headings = getColumnHeadings(rt)
    id_col = getColumnIndex(headings, "TID")
    t_col = getColumnIndex(headings, "t [")
    d2p_col = getColumnIndex(headings, "D2P [")
    angle_col = getColumnIndex(headings, u'\u03B1 [deg]')
    delta_col = getColumnIndex(headings, u'\u0394\u03B1 [deg]')
    if angle_col == RT.COLUMN_NOT_FOUND:
        log("Failed to detect index for angle column. Re-trying...")
        angle_col = getColumnIndex(headings, u'? [deg]')
    if delta_col == RT.COLUMN_NOT_FOUND:
        log("Failed to detect index for delta angle column. Re-trying...")
        delta_col = getColumnIndex(headings, u'?? [deg]')
    log("Last column index is %s" % rt.getLastColumn())

    if RT.COLUMN_NOT_FOUND in (id_col, d2p_col, delta_col, angle_col):
        uiservice.showDialog("Error: Some key columns were not found!", "Invalid Table?")
        return

    log("Settings: BOUT_WINDOW= %s, MIN_D2P= %s, DEF_FRAME_INTERVAL= %s"
            % (BOUT_WINDOW, '{0:.4f}'.format(MIN_D2P), DEF_FRAME_INTERVAL))

    # Store all data on dedicated lists
    track_id_rows = rt.getColumnAsDoubles(id_col)
    d2p_rows = rt.getColumnAsDoubles(d2p_col)
    angle_rows = rt.getColumnAsDoubles(angle_col)
    delta_rows = rt.getColumnAsDoubles(delta_col)
    t_rows = rt.getColumnAsDoubles(t_col)

    # Assess n of data points and extract unique path ids
    n_rows = len(track_id_rows)
    row_indices = range(n_rows)
    track_ids = set(track_id_rows)
    n_tracks = len(track_ids)
    log("Table has %g rows" % n_rows)
    log("Table has %g tracks" % n_tracks)

    log("Parsing tracks...")
    for track_id in track_ids:


        for row, next_row in zip(row_indices, row_indices[1:]):

            if track_id_rows[row] != track_id:
                continue

            if not isNumber(angle_rows[row]):
                 rt.setValue("FLAG", row, "NA")
                 continue

            lower_bound = max(0, row - BOUT_WINDOW + 1)
            upper_bound = min(n_rows-1, row + BOUT_WINDOW)
            win_d2p = []
            for _ in range(lower_bound, upper_bound):
                win_d2p.append(d2p_rows[row])

            if sum(win_d2p) <= MIN_D2P * len(win_d2p):
                rt.setValue("FLAG", row, 0)

            else:
                current_angle = angle_rows[row]
                next_angle = angle_rows[next_row]
                current_delta = delta_rows[row]

                flag = -1 if current_angle < 0 else 1
                delta_change = (abs(current_delta) > 90)
                same_sign = ((current_angle<0) == (next_angle<0))
                if delta_change and not same_sign:
                    flag *= -1

                rt.setValue("FLAG", row, flag)
                if next_row == n_rows - 1:
                    rt.setValue("FLAG", next_row, flag)

    if rt.save(table_file.getAbsolutePath()):
        log("Processed table successfully saved (file overwritten)")
    else:
        log("Could not override input file. Displaying it...")
        rt.show(table_file.name)


    log("Creating onset table...")
    onset_rt = RT()
    onset_rt.showRowNumbers(False)

    frame_int = DEF_FRAME_INTERVAL
    if "table" in frame_rate_detection:
        frame_int = getFrameIntervalFromTable(row_indices, track_id_rows, t_rows)
    elif "image" in frame_rate_detection:
        frame_int = getFrameIntervalFromImage(image_file.getAbsolutePath())
    else:
        log("Using default frame rate")
#.........这里部分代码省略.........
开发者ID:tferr,项目名称:Scripts,代码行数:103,代码来源:Tag_and_Onset_MtrackJ_paths.py


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