本文整理汇总了Python中ij.measure.ResultsTable.getColumnIndex方法的典型用法代码示例。如果您正苦于以下问题:Python ResultsTable.getColumnIndex方法的具体用法?Python ResultsTable.getColumnIndex怎么用?Python ResultsTable.getColumnIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.measure.ResultsTable
的用法示例。
在下文中一共展示了ResultsTable.getColumnIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ResultsTable
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumnIndex [as 别名]
### Compute area fraction of oriented regions ###
# Compute area of oriented mask
newMaskImp = ImageJFunctions.wrapUnsignedByte(newMask, "New mask");
newMaskImp.getProcessor().setThreshold(1.0, 1.5, False); # [0.5, 1.0] does not work due to rounding problems
rt = ResultsTable();
analyzer = Analyzer(newMaskImp, Measurements.AREA | Measurements.LIMIT, rt);
analyzer.measure();
# Compute area of overall selection mask
energyMaskImp = ImageJFunctions.wrapUnsignedByte(overallSelectionMask, "Energy mask");
energyMaskImp.getProcessor().setThreshold(1.0, 1.5, False); # [0.5, 1.0] does not work due to rounding problems
rtEnergy = ResultsTable();
analyzerEnergy = Analyzer(energyMaskImp, Measurements.AREA | Measurements.LIMIT, rtEnergy);
analyzerEnergy.measure();
# Print Area% (through SciJava OUTPUT, see L5)
if IJ.debugMode:
print("Coherency area: "+str(rt.getValueAsDouble(rt.getColumnIndex("Area"), rt.size()-1)));
print("Energy area: "+str(rtEnergy.getValueAsDouble(rtEnergy.getColumnIndex("Area"), rtEnergy.size()-1)));
areaCoherency = rt.getValueAsDouble(rt.getColumnIndex("Area"), rt.size()-1);
areaEnergy = rtEnergy.getValueAsDouble(rtEnergy.getColumnIndex("Area"), rtEnergy.size()-1);
areaFraction = str(areaCoherency/areaEnergy*100.0)+"%";
# Close "S-Mask"
if not IJ.debugMode:
maskImp.close();
# Close "Energy"
if not IJ.debugMode and useEnergy:
energyImp.close();
示例2: procOneImage
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumnIndex [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
示例3: analyze
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumnIndex [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))
示例4: nucleusSegmentation
# 需要导入模块: from ij.measure import ResultsTable [as 别名]
# 或者: from ij.measure.ResultsTable import getColumnIndex [as 别名]
def nucleusSegmentation(imp2):
""" Segmentation of nucleus image.
Nucleus are selected that:
1. No overlapping with dilated regions
2. close to circular shape. Deformed nuclei are rejected.
Outputs a binary image.
"""
#Convert to 8bit
ImageConverter(imp2).convertToGray8()
#blur slightly using Gaussian Blur
radius = 2.0
accuracy = 0.01
GaussianBlur().blurGaussian( imp2.getProcessor(), radius, radius, accuracy)
# Auto Local Thresholding
imps = ALT().exec(imp2, "Bernsen", 15, 0, 0, True)
imp2 = imps[0]
#ParticleAnalysis 0: prefiltering by size and circularity
rt = ResultsTable()
paOpt = PA.CLEAR_WORKSHEET +\
PA.SHOW_MASKS +\
PA.EXCLUDE_EDGE_PARTICLES +\
PA.INCLUDE_HOLES #+ \
# PA.SHOW_RESULTS
measOpt = PA.AREA + PA.STD_DEV + PA.SHAPE_DESCRIPTORS + PA.INTEGRATED_DENSITY
MINSIZE = 20
MAXSIZE = 10000
pa0 = PA(paOpt, measOpt, rt, MINSIZE, MAXSIZE, 0.8, 1.0)
pa0.setHideOutputImage(True)
pa0.analyze(imp2)
imp2 = pa0.getOutputImage() # Overwrite
imp2.getProcessor().invertLut()
#impNuc = imp2.duplicate() ## for the ring.
impNuc = Duplicator().run(imp2)
#Dilate the Nucleus Area
## this should be 40 pixels in Cihan's method, but should be smaller.
#for i in range(20):
# IJ.run(imp2, "Dilate", "")
rf = RankFilters()
rf.rank(imp2.getProcessor(), RIMSIZE, RankFilters.MAX)
#Particle Analysis 1: get distribution of sizes.
paOpt = PA.CLEAR_WORKSHEET +\
PA.SHOW_NONE +\
PA.EXCLUDE_EDGE_PARTICLES +\
PA.INCLUDE_HOLES #+ \
# PA.SHOW_RESULTS
measOpt = PA.AREA + PA.STD_DEV + PA.SHAPE_DESCRIPTORS + PA.INTEGRATED_DENSITY
rt1 = ResultsTable()
MINSIZE = 20
MAXSIZE = 10000
pa = PA(paOpt, measOpt, rt1, MINSIZE, MAXSIZE)
pa.analyze(imp2)
#rt.show('after PA 1')
#particle Analysis 2: filter nucleus by size and circularity.
#print rt1.getHeadings()
if (rt1.getColumnIndex('Area') > -1):
q1, q3, outlier_offset = getOutlierBound(rt1)
else:
q1 = MINSIZE
q3 = MAXSIZE
outlier_offset = 0
print imp2.getTitle(), ": no Nucleus segmented,probably too many overlaps"
paOpt = PA.CLEAR_WORKSHEET +\
PA.SHOW_MASKS +\
PA.EXCLUDE_EDGE_PARTICLES +\
PA.INCLUDE_HOLES #+ \
# PA.SHOW_RESULTS
rt2 = ResultsTable()
#pa = PA(paOpt, measOpt, rt, q1-outlier_offset, q3+outlier_offset, circq1-circoutlier_offset, circq3+circoutlier_offset)
pa = PA(paOpt, measOpt, rt2, q1-outlier_offset, q3+outlier_offset, 0.8, 1.0)
pa.setHideOutputImage(True)
pa.analyze(imp2)
impDilatedNuc = pa.getOutputImage()
#filter original nucleus
filteredNuc = ImageCalculator().run("AND create", impDilatedNuc, impNuc)
return filteredNuc