本文整理汇总了Python中ij.measure.ResultsTable.getColumn方法的典型用法代码示例。如果您正苦于以下问题:Python ResultsTable.getColumn方法的具体用法?Python ResultsTable.getColumn怎么用?Python ResultsTable.getColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.measure.ResultsTable
的用法示例。
在下文中一共展示了ResultsTable.getColumn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: countParticles
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [as 别名]
def countParticles(imp, roim, minSize, maxSize, minCircularity, maxCircularity):
# Create a table to store the results
table = ResultsTable()
# Create the particle analyzer
pa = ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER, Measurements.AREA|Measurements.MEAN, table, minSize, maxSize, minCircularity, maxCircularity)
#pa = ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER, Measurements.AREA|Measurements.MEAN, table, 10, Double.POSITIVE_INFINITY, 0.5, 1.0)
#pa = ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER, Measurements.AREA|Measurements.MEAN, table, 5, 6, 0.5, 1.0)
pa.setRoiManager(roim)
pa.setHideOutputImage(True)
if pa.analyze(imp):
print "All ok"
else:
print "There was a problem in analyzing", blobs
areas = table.getColumn(0)
intensities = table.getColumn(1)
if ( (areas!=None) and (intensities!=None)):
for area, intensity in zip(areas,intensities): print str(area)+": "+str(intensity)
示例2: getParticleCenters
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [as 别名]
def getParticleCenters(imp):
# Create a table to store the results
rt = ResultsTable()
paOpts = PA.SHOW_OUTLINES \
+ PA.INCLUDE_HOLES \
+ PA.EXCLUDE_EDGE_PARTICLES
measurements = PA.CENTROID + PA.CENTER_OF_MASS
MINSIZE = 1000
MAXSIZE = Double.POSITIVE_INFINITY
pa = PA(paOpts,measurements, rt, MINSIZE, MAXSIZE)
pa.setHideOutputImage(True)
if not pa.analyze(imp):
print "There was a problem in analyzing", imp
# The measured centroids are listed in the first column of the results table, as a float array:
centroids_x = rt.getColumn(rt.X_CENTROID)
centroids_y = rt.getColumn(rt.Y_CENTROID)
coms_x = rt.getColumn(rt.X_CENTER_OF_MASS)
coms_y = rt.getColumn(rt.Y_CENTER_OF_MASS)
return (centroids_x,centroids_y, coms_x, coms_y)
示例3: process
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [as 别名]
def process(self,imp):
# extract nucleus channel, 8-bit and twice binned
imp.setC(self.nucleusChannel)
ip = imp.getChannelProcessor().duplicate()
ip = ip.convertToByteProcessor()
ip = ip.bin(4)
nucleus = ImagePlus("nucleus_channel", ip)
# threshold image and separate clumped nuclei
IJ.run(nucleus, "Auto Threshold", "method=Otsu white setthreshold show");
IJ.run(nucleus, "Make Binary", "thresholded remaining black");
IJ.run(nucleus, "Watershed", "");
directory = imp.getTitle()
directory = directory.replace(" ", "_")\
.replace(",", "_")\
.replace("#", "_series")\
.replace("...", "")\
.replace(".","_")
directory = os.path.join(self.exportDir, directory)
sliceDirectory = os.path.join(directory, "slices")
print directory
print sliceDirectory
if not os.path.exists(sliceDirectory):
os.makedirs(sliceDirectory)
# 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)
# remove small particles and border particles
pa = ParticleAnalyzer(\
ParticleAnalyzer.ADD_TO_MANAGER | ParticleAnalyzer.EXCLUDE_EDGE_PARTICLES,\
Measurements.CENTER_OF_MASS,\
table,\
self.minArea, self.maxArea,\
0.0,1.0)
if pa.analyze(nucleus):
print "All ok, number of particles: ", table.size()
else:
print "There was a problem in analyzing", imp, nucleus
table.save(os.path.join(directory, "rt.csv"))
# read the center of mass coordinates
cmx = table.getColumn(0)
cmy = table.getColumn(1)
if self.debug:
imp.show()
i=0
for i in range(0, min(self.nCells,table.size())):
# ROI around the cell
cmx = table.getValue("XM",i)
cmy = table.getValue("YM",i)
x = 4 * cmx - (self.boxSize - 1) / 2
y = 4 * cmy - (self.boxSize - 1) / 2
if (x < self.edge or y < self.edge or x > imp.getWidth() - self.edge or y > imp.getHeight() - self.edge):
continue
roi = Roi(x,y,self.boxSize,self.boxSize)
imp.setRoi(roi, False)
cellStack = ImageStack(self.boxSize, self.boxSize)
for z in range(1, imp.getNSlices() + 1):
imp.setSlice(z)
for c in range(1, imp.getNChannels() + 1):
imp.setC(c)
# copy ROI to stack
imp.copy()
impSlice = imp.getClipboard()
cellStack.addSlice(impSlice.getProcessor())
if self.slices:
sliceTitle = "cell_%s_z%s_c%s" % (str(i).zfill(4), str(z).zfill(3), str(c))
print sliceTitle
IJ.saveAsTiff(impSlice, os.path.join(sliceDirectory, sliceTitle))
impSlice.close()
title = "cell_" + str(i).zfill(4)
cell = ImagePlus(title, cellStack)
# save ROI image
IJ.saveAsTiff(cell, os.path.join(directory, title))
cell.close()
if self.debug:
imp.updateAndDraw()
wait = Wait("particle done")
wait.show()
示例4: updatepressed
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [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()
示例5: PointRoi
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [as 别名]
table.setValue("TRACK_ID", rowNumber, id)
table.setValue("POSITION_X", rowNumber, x)
table.setValue("POSITION_Y", rowNumber, y)
table.setValue("FRAME", rowNumber, t)
table.setValue("MEAN_INTENSITY", rowNumber, mean)
table.setValue("STANDARD_DEVIATION", rowNumber, std)
table.setValue("SNR", rowNumber, snr)
rowNumber = rowNumber + 1
# roi1 = PointRoi(x/dx, y/dy)
# roi1.setPosition(int(t))
# rm.add(imp, roi1, nextRoi)
# nextRoi = nextRoi+1
frame = table.getColumn(3)
mean = table.getColumn(4)
std = table.getColumn(5)
snr = table.getColumn(6)
var = [s / m for s,m in zip(std, mean)]
from collections import Counter as Counter
idxvec = [item for item, count in Counter(frame).items() if count > 1]
if idxvec == []:
continue
division = min(idxvec)
idx = frame.index(division)+1
mean = mean[:idx]
frame = frame[:idx]
std = std[:idx]
示例6: RoiManager
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [as 别名]
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://imagej.net/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, table, 0, Double.POSITIVE_INFINITY, 0.0, 1.0)
pa.setHideOutputImage(True)
if pa.analyze(imp):
print "All ok"
else:
print "There was a problem in analyzing", blobs
# The measured areas are listed in the first column of the results table, as a float array:
areas = table.getColumn(0)
# Create a new list to store the mean intensity values of each blob:
means = []
for roi in RoiManager.getInstance().getRoisAsArray():
blobs.setRoi(roi)
stats = blobs.getStatistics(Measurements.MEAN)
means.append(stats.mean)
for area, mean in zip(areas, means):
print area, mean
示例7: analyze
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [as 别名]
#.........这里部分代码省略.........
imp = ic.run("Subtract create 32-bit stack", imp, imp_avg);
#
# REGION SEGMENTATION
#
imp1 = Duplicator().run(imp, 1, imp.getImageStackSize()-1)
imp2 = Duplicator().run(imp, 2, imp.getImageStackSize())
imp_diff = ic.run("Subtract create 32-bit stack", imp1, imp2);
#imp_diff.show()
IJ.run(imp_diff, "Z Project...", "projection=[Standard Deviation]");
imp_diff_sd = IJ.getImage()
# save
IJ.run(imp_diff_sd, "Gaussian Blur...", "sigma=5");
output_file = filename+"--sd.tif"
IJ.saveAs(imp_diff_sd, "TIFF", os.path.join(output_folder, output_file))
tbModel.setFileAPth(output_folder, output_file, iDataSet, "SD","IMG")
IJ.run(imp_diff_sd, "Enhance Contrast", "saturated=0.35");
IJ.run(imp_diff_sd, "8-bit", "");
IJ.run(imp_diff_sd, "Properties...", "unit=p pixel_width=1 pixel_height=1 voxel_depth=1");
IJ.run(imp_diff_sd, "Auto Local Threshold", "method=Niblack radius=60 parameter_1=2 parameter_2=0 white");
rm = ROIManipulator.getEmptyRm()
IJ.run(imp_diff_sd, "Analyze Particles...", "add");
# select N largest Rois
diameter_roi = []
for i in range(rm.getCount()):
roi = rm.getRoi(i)
diameter_roi.append([roi.getFeretsDiameter(), roi])
diameter_roi = sorted(diameter_roi, reverse=True)
#print diameter_roi
rm.reset()
for i in range(min(len(diameter_roi), p["n_rois"])):
rm.addRoi(diameter_roi[i][1])
# save
output_file = filename+"--rois"
ROIManipulator.svRoisToFl(output_folder, output_file, rm.getRoisAsArray())
tbModel.setFileAPth(output_folder, output_file+".zip", iDataSet, "REGIONS","ROI")
#
# FFT in each region
#
IJ.run(imp, "Variance...", "radius=2 stack");
output_file = filename+"--beats.tif"
IJ.saveAs(imp, "TIFF", os.path.join(output_folder, output_file))
tbModel.setFileAPth(output_folder, output_file, iDataSet, "BEATS","IMG")
n = rm.getCount()
for i_roi in range(n):
imp_selection = Duplicator().run(imp)
rm.select(imp_selection, i_roi)
IJ.run(imp_selection, "Clear Outside", "stack");
imp_selection.show()
# FFT using Parallel FFTJ
transformer = FloatTransformer(imp_selection.getStack())
transformer.fft()
imp_fft = transformer.toImagePlus(SpectrumType.FREQUENCY_SPECTRUM)
imp_fft.show()
# Analyze FFt
IJ.run(imp_fft, "Gaussian Blur 3D...", "x=0 y=0 z=1.5");
IJ.run(imp_fft, "Plot Z-axis Profile", "");
output_file = filename+"--Region"+str(i_roi+1)+"--fft.tif"
IJ.saveAs(IJ.getImage(), "TIFF", os.path.join(output_folder, output_file))
tbModel.setFileAPth(output_folder, output_file, iDataSet, "FFT_R"+str(i_roi+1),"IMG")
IJ.run(imp_fft, "Select All", "");
rm.addRoi(imp_fft.getRoi())
rm.select(rm.getCount())
rt = ResultsTable()
rt = rm.multiMeasure(imp_fft); #print(rt.getColumnHeadings);
x = rt.getColumn(rt.getColumnIndex("Mean1"))
#rm.runCommand("delete")
peak_height_pos = []
x_min = 10
for i in range(x_min,len(x)/2):
before = x[i-1]
center = x[i]
after = x[i+1]
if (center>before) and (center>after):
peak_height_pos.append([float(x[i]),i])
if len(peak_height_pos)>0:
peak_height_pos = sorted(peak_height_pos, reverse=True)
n_max = 3
for i_max in range(min(len(peak_height_pos),n_max)):
tbModel.setNumVal(round(float(len(x))/float(peak_height_pos[i_max][1]),2), iDataSet, "F"+str(i_max+1)+"_R"+str(i_roi+1))
tbModel.setNumVal(int(peak_height_pos[i_max][0]), iDataSet, "A"+str(i_max+1)+"_R"+str(i_roi+1))
示例8: procOneImage
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumn [as 别名]
def procOneImage(pathpre, wnumber, endings):
""" Analyzes a single image set (Dapi, VSVG, PM images)
pathpre: fullpath prefix, down till "endings".
endings: a dictionary with signiture for three different channels.
wnumber: a number in string, indicating the spot ID.
Returns three results tables.
"""
imp = IJ.openImage(pathpre + endings['dapi'] + '.tif')
impVSVG = IJ.openImage(pathpre + endings['vsvg'] + '.tif')
impPM = IJ.openImage(pathpre + endings['pm'] + '.tif')
imp2 = imp.duplicate()
rtallcellPM = ResultsTable()
rtjnucVSVG = ResultsTable()
rtallcellVSVG = ResultsTable()
backVSVG = backgroundSubtraction(impVSVG)
backPM = backgroundSubtraction(impPM)
impfilteredNuc = nucleusSegmentation(imp2)
intmax = impfilteredNuc.getProcessor().getMax()
if intmax == 0:
return rtallcellPM, rtjnucVSVG, rtallcellVSVG
impfilteredNuc.getProcessor().setThreshold(1, intmax, ImageProcessor.NO_LUT_UPDATE)
nucroi = ThresholdToSelection().convert(impfilteredNuc.getProcessor())
nucroiA = ShapeRoi(nucroi).getRois()
#print nucroiA
allcellA = [roiEnlarger(r) for r in nucroiA]
jnucroiA = [roiRingGenerator(r) for r in nucroiA]
#print allcellA
print 'Detected Cells: ', len(jnucroiA)
if len(jnucroiA) <2:
print "measurement omitted, as there is only on nucleus detected"
return rtallcellPM, rtjnucVSVG, rtallcellVSVG
if (GUIMODE):
rm = RoiManager()
for r in jnucroiA:
rm.addRoi(r)
rm.show()
impfilteredNuc.show()
measOpt = PA.AREA + PA.MEAN + PA.CENTROID + PA.STD_DEV + PA.SHAPE_DESCRIPTORS + PA.INTEGRATED_DENSITY + PA.MIN_MAX +\
PA.SKEWNESS + PA.KURTOSIS + PA.MEDIAN + PA.MODE
## All Cell Plasma Membrane intensity
measureROIs(impPM, measOpt, rtallcellPM, allcellA, backPM, True)
meanInt_Cell = rtallcellPM.getColumn(rtallcellPM.getColumnIndex('Mean'))
print "Results Table rownumber:", len(meanInt_Cell)
# JuxtaNuclear VSVG intensity
measureROIs(impVSVG, measOpt, rtjnucVSVG, jnucroiA, backVSVG, False)
meanInt_jnuc = rtjnucVSVG.getColumn(rtjnucVSVG.getColumnIndex('Mean'))
# AllCell VSVG intensity
measureROIs(impVSVG, measOpt, rtallcellVSVG, allcellA, backVSVG, True)
meanInt_vsvgall = rtallcellVSVG.getColumn(rtallcellVSVG.getColumnIndex('Mean'))
#Calculation of Transport Ratio JuxtaNuclear VSVG intensity / All Cell Plasma Membrane intensity results will be appended to PM results table.
for i in range(len(meanInt_Cell)):
if meanInt_Cell[i] != 0.0:
transportR = meanInt_jnuc[i] / meanInt_Cell[i]
transportRall = meanInt_vsvgall[i] / meanInt_Cell[i]
else:
transportR = float('inf')
transportRall = float('inf')
rtjnucVSVG.setValue('TransportRatio', i, transportR)
rtallcellVSVG.setValue('TransportRatio', i, transportRall)
rtjnucVSVG.setValue('WellNumber', i, int(wnumber))
rtallcellVSVG.setValue('WellNumber', i, int(wnumber))
rtallcellPM.setValue('WellNumber', i, int(wnumber))
return rtallcellPM, rtjnucVSVG, rtallcellVSVG