本文整理汇总了Python中ij.measure.ResultsTable.setValue方法的典型用法代码示例。如果您正苦于以下问题:Python ResultsTable.setValue方法的具体用法?Python ResultsTable.setValue怎么用?Python ResultsTable.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.measure.ResultsTable
的用法示例。
在下文中一共展示了ResultsTable.setValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OvalRoi
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import setValue [as 别名]
dotRoi = OvalRoi(int(yA[i] - xyoffset), int(xA[i] - xyoffset), thdist, thdist)
ipch2.setRoi(dotRoi)
#stats = IS.getStatistics(ip, options, imp.getCalibration())
stats = IS.getStatistics(ipch2, options, cal)
ipch3.setRoi(dotRoi)
statsch3 = IS.getStatistics(ipch3, options, cal)
print "dot", i
print "...ch2 TotalInt ", stats.area * stats.mean
print "...ch2 Area ", stats.area
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
示例2: MandersPlugin
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import setValue [as 别名]
#.........这里部分代码省略.........
image = self.imp
mode3D = self.checkbox3D.isSelected()
if image is not None and cell is not None and mode3D:
roi = cell.slices[selectedSlice].roi
if (image.z - 1 != selectedSlice):
image.z = selectedSlice + 1
image.setRoi(roi, True)
if self.preview is not None and not mode3D:
self.preview.setRoi(cell.roi, True)
def updateSlice(self, event):
if self.checkbox3D.isSelected():
self.updateSlice3D(self.imp)
else:
self.updateSlice2D(self.preview)
def updateSlice3D(self, imp):
selectedCell = self.cellList.selectedIndex
selectedSlice = self.sliceList.selectedIndex
if selectedCell >= 0 and selectedSlice >= 0 and imp is not None:
cell = self.cells[selectedCell]
impRoi = imp.getRoi()
if cell is not None and impRoi is not None:
index = selectedSlice + 1
roi = ShapeRoi(impRoi, position = index)
cell.mode3D = True
cell.name = "Cell %i (3D)" % cell.n
cell.slices[selectedSlice].roi = roi
if (index + 1 <= len(cell.slices)):
imp.z = index + 1
self.cellList.repaint(self.cellList.getCellBounds(selectedCell, selectedCell))
self.sliceList.repaint(self.sliceList.getCellBounds(selectedSlice, selectedSlice))
def updateSlice2D(self, imp):
selectedCell = self.cellList.selectedIndex
if selectedCell >= 0 and imp is not None:
cell = self.cells[selectedCell]
impRoi = imp.getRoi()
if cell is not None and impRoi is not None:
roi = ShapeRoi(impRoi, position = 1)
cell.mode3D = False
cell.name = "Cell %i (2D)" % cell.n
cell.roi = roi
self.cellList.repaint(self.cellList.getCellBounds(selectedCell, selectedCell))
def imageOpened(self, imp):
pass
def imageClosed(self, imp):
pass
def imageUpdated(self, imp):
if self.checkbox3D.isSelected():
if imp is not None:
selectedCell = self.cellList.selectedIndex
selectedSlice = imp.z - 1
if imp == self.imp and selectedSlice != self.sliceList.selectedIndex:
self.sliceList.selectedIndex = selectedSlice
def doneSelecting(self, event):
oluts = self.imp.luts
luts = []
channels = []
for c, method in enumerate(self.methods):
if method != "None":
luts.append(oluts[c])
channels.append(c)
for cell in self.cells:
manders = self.getManders(self.imp, cell)
if manders is not None:
chimps, thrimps, thrs, raws, thrds = manders
index = self.cells.index(cell) + 1
title = "Cell_%i-" % index + self.imp.title
self.saveMultichannelImage(title, chimps, oluts)
title = "Cell_%i_thrd-" % index + self.imp.title
self.saveMultichannelImage(title, thrimps, luts)
self.results.incrementCounter()
row = self.results.getCounter() - 1
for i, thr in enumerate(thrs):
if thr is not None:
self.results.setValue("Threshold %i" % (i + 1), row, int(thr))
for i, pair in enumerate(self.pairs):
self.results.setValue("%i-%i M1 raw" % pair, row, float(raws[i].m1))
self.results.setValue("%i-%i M2 raw" % pair, row, float(raws[i].m2))
self.results.setValue("%i-%i M1 thrd" % pair, row, float(thrds[i].m1))
self.results.setValue("%i-%i M2 thrd" % pair, row, float(thrds[i].m2))
self.closeImage()
if not self.processNextFile():
print "All done - happy analysis!"
self.results.show("Manders collocalization results")
self.exit()
def windowClosing(self, e):
print "Closing plugin - BYE!!!"
self.exit()
def exit(self):
ImagePlus.removeImageListener(self)
self.closeImage()
self.closeMainWindow()
示例3: Morph
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import setValue [as 别名]
class Morph(object):
"""
Fourni les mesures principales pour l'analyse des cellules bacteriennes:
proprietes:
1-MaxFeret
2-MinFeret
3-AngleFeret
4-XFeret
5-YFeret
6-Area
7-Mean
8-StdDev
9-IntDen
10-Kurt
11-Skew
12-Angle
13-Major
14-Minor
15-Solidity
16-AR
17-Round
18-Circ.
19-XM
20-YM
21-X
22-Y
23-FerCoord: tuple contenant x1, y1, x2, y2 du MaxFeret
24-Fprofil: list contenant les valeurs du profil le long de MaxFeret
25-FerAxis: Line ROI
26-MidAxis: Polyline ROI de l'axe median par skeletonize
27-MidProfil: list contenant les valeurs du profil le long de MidAxis
28-nb Foci
29-ListFoci: liste des positions des foci par cellule
30-ListAreaFoci: liste des area des foci
31-ListPeaksFoci: liste des int max des foci
32-ListMeanFoci liste des int mean des foci
toute les proprietes mettent a jour l'image cible par: object.propriete=imp
Methodes:
getFeretSegments(n segments)
getMidSegments(n segments, radius, tool 0= ligne perpendiculaire, 1= cercle, 2= ligne tangente)
selectInitRoi: active la ROI initiale
Statics:
distMorph(liste de coordonees a mesurer= (coefficient, valeur initiale, valeur finale))
setteurs:
setImage(ImagePlus)
setImageMeasures(imagePlus) met a jours les mesures avec imagePlus
setImageMidprofil(imagePlus) met a jours le profil avec imagePlus
setLineWidth(width) afecte la largeur de ligne pour le profil pour Fprofile et MidProfil defaut = 0
setshowFprof(True) affiche le graphique de profil Fprofil defaut = False
setMidParams(longueur mesurer l'angle de l'extremite en pixels defaut=10, coefficient pour prolonger et trouver l'intersection avec le contour defaut=1.3
"""
def __Measures(self):
self.__boolmeasures=True
if (self.__contour is not None) and (self.__contour.getType() not in [9,10]):
self.__image.killRoi()
self.__image.setRoi(self.__contour)
self.__ip=self.__image.getProcessor()
self.__rt= ResultsTable()
analyser= Analyzer(self.__image, Analyzer.AREA+Analyzer.CENTER_OF_MASS+Analyzer.CENTROID+Analyzer.ELLIPSE+Analyzer.FERET+Analyzer.INTEGRATED_DENSITY+Analyzer.MEAN+Analyzer.KURTOSIS+Analyzer.SKEWNESS+Analyzer.MEDIAN+Analyzer.MIN_MAX+Analyzer.MODE+Analyzer.RECT+Analyzer.SHAPE_DESCRIPTORS+Analyzer.SLICE+Analyzer.STACK_POSITION+Analyzer.STD_DEV, self.__rt)
analyser.measure()
#self.__rt.show("myRT")
else:
self.__rt = ResultsTable()
analyser = Analyzer(self.__image, Analyzer.AREA+Analyzer.CENTER_OF_MASS+Analyzer.CENTROID+Analyzer.ELLIPSE+Analyzer.FERET+Analyzer.INTEGRATED_DENSITY+Analyzer.MEAN+Analyzer.KURTOSIS+Analyzer.SKEWNESS+Analyzer.MEDIAN+Analyzer.MIN_MAX+Analyzer.MODE+Analyzer.RECT+Analyzer.SHAPE_DESCRIPTORS+Analyzer.SLICE+Analyzer.STACK_POSITION+Analyzer.STD_DEV, self.__rt)
analyser.measure()
#self.__rt.show("myRT")
maxValues=self.__rt.getRowAsString(0).split("\t")
heads=self.__rt.getColumnHeadings().split("\t")
for val in heads: self.__rt.setValue(val, 0, Float.NaN)
#self.__rt.show("myRT")
# calculate the 1/2 , 1/4 ... 1/n positions for a liste while 1/n >= 1 returns a dict = 0: (0, [0, 0, pos(1/2)]) 1: (1, [-1, -0.5, -pos(1/4)], [0, 0, pos(1/2)], [1, 0.5, pos(1/2)])
def __Centers(self, line) :
L=len(line)
l2=L//2
l=L
pos={}
for i in range(self.log2(L)) :
l = l//2
pos[i]=l
l=L
dicPos={}
jtot=1
for i in range(self.log2(L)) :
s=[]
j=1
while (l2-j*pos[i])>0 or (l2+j*pos[i])<L :
s.append((-j,(l2-j*pos[i])))
s.append((j,(l2+j*pos[i])))
j=j+1
s.append((0,l2))
s.sort()
if ((len(s)+1)*pos[i]-L)//pos[i] > 0 :
#.........这里部分代码省略.........
示例4: str
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import setValue [as 别名]
rowNumber = 0
for spot in sortedTrack:
sid = spot.ID()
# Fetch spot features directly from spot.
x=spot.getFeature('POSITION_X')
y=spot.getFeature('POSITION_Y')
t=spot.getFeature('FRAME')
q=spot.getFeature('QUALITY')
snr=spot.getFeature('SNR')
mean=spot.getFeature('MEAN_INTENSITY')
std = spot.getFeature('STANDARD_DEVIATION')
estdia = spot.getFeature('ESTIMATED_DIAMETER')
model.getLogger().log('\tspot ID = ' + str(sid) + ': x='+str(x)+', y='+str(y)+', t='+str(t)+', q='+str(q) + ', snr='+str(snr) + ', mean = ' + str(mean))
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)
示例5: calculateThreshold
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import setValue [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")
示例6: main
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import setValue [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")
#.........这里部分代码省略.........
示例7: procOneImage
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import setValue [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