本文整理汇总了Python中ij.ImagePlus.killRoi方法的典型用法代码示例。如果您正苦于以下问题:Python ImagePlus.killRoi方法的具体用法?Python ImagePlus.killRoi怎么用?Python ImagePlus.killRoi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.ImagePlus
的用法示例。
在下文中一共展示了ImagePlus.killRoi方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StackCells
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import killRoi [as 别名]
#.........这里部分代码省略.........
testmean = (minmean < m.Mean < maxmean)
testmferet = (minmferet < m.MinFeret < maxmferet)
#print minmferet , m.MinFeret , maxmferet
test = (testsol+testarea+testcirc+testar+testfer+testmean+testmferet)/7
if test :
fmaj, ffmx, fa =[],[],[]
for r in m.getMidSegments(10, 40, 0) :
if r == None : continue
m2=Morph(self.__impF, r)
fmaj.append(m2.Major)
ffmx.append(m2.MaxFeret)
fa.append(m2.Area)
diffmajor, diffferet, diffarea = 0,0,0
if len(fa) > 4 :
medfmaj = self.listmean(fmaj[1:-1])
medffmx = self.listmean(ffmx[1:-1])
medfa = self.listmean(fa[1:-1])
diffmajor = (max(fmaj[1:-1])-medfmaj)/medfmaj
diffferet = (max(ffmx[1:-1])-medffmx)/medffmx
diffarea = (max(fa[1:-1])-medfa)/medfa
twres.append(lab+tab+str(roi.getName())+tab+str(m.Solidity)+tab+str(m.Area)+tab+str(m.Circ)+tab+str(m.AR)+tab+str(m.MaxFeret)+tab+str(midroi.getLength())+tab+str(m.MaxFeret/midroi.getLength())+tab+str(diffmajor)+tab+str(diffferet)+tab+str(diffarea))
#print lab+tab+str(roi.getName())+tab+str(m.Solidity)+tab+str(m.Area)+tab+str(m.Circ)+tab+str(m.AR)+tab+str(m.MaxFeret)+tab+str(midroi.getLength())+tab+str(m.MaxFeret/midroi.getLength())+tab+str(diffmajor)+tab+str(diffferet)+tab+str(diffarea)
self.__impF.setRoi(roi)
self.__rm.runCommand("Add")
self.__impF.killRoi()
self.__impF.setRoi(midroi)
#self.__dictCells[str(roi.getName())]=(str(roi.getName()), lab, roi)
self.__dictCells[count]=(str(roi.getName()), lab, roi)
count=count+1
else :
#print "test falls"
continue
else :
print "out loop"
continue
straightener = Straightener()
new_ip = straightener.straighten(self.__impF, midroi, int(self.__widthl))
if int(self.__display5.text) < new_ip.getWidth() < int(self.__display6.text) :
self.__iplist.append(new_ip)
self.__display.text = self.__name + " cell " + str(len(self.__iplist))
#print "add", roi.getName(), roi.getType()
self.__cellsrois.append((midroi, pos))
self.__labels.append(self.__isF.getShortSliceLabel(pos))
#roisarray=self.__rm.getRoisAsArray()
#self.__rm.runCommand("reset")
#self.__rm.runCommand("Delete")
self.__impD.killRoi()
self.__impF.killRoi()
示例2: __midline
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import killRoi [as 别名]
def __midline(self):
debug=False
#print "line 251", self.__boolML
if self.__boolML :
ordpoints=self.__midLine[:]
npoints=len(ordpoints)
xpoints=[point[0] for point in ordpoints]
ypoints=[point[1] for point in ordpoints]
polyOrd=PolygonRoi(xpoints, ypoints, npoints, PolygonRoi.POLYLINE)
return polyOrd
#if self.getMaxF()<15 : return None
#self.__FeretAxis()
#return self.__line
self.__boolML=True
self.__image.killRoi()
self.__image.setRoi(self.__contour)
boundRect=self.__contour.getBounds()
boundRoi=Roi(boundRect)
xori=boundRect.x
yori=boundRect.y
wori=boundRect.width
hori=boundRect.height
ip2 = ByteProcessor(self.__image.getWidth(), self.__image.getHeight())
ip2.setColor(255)
ip2.setRoi(self.__contour)
ip2.fill(self.__contour)
skmp=ImagePlus("ip2", ip2)
skmp.setRoi(xori-1,yori-1,wori+1,hori+1)
ip3=ip2.crop()
skmp3=ImagePlus("ip3", ip3)
skmp3.killRoi()
#-------------------------------------------------------------
if debug :
skmp3.show()
IJ.showMessage("imp3 l287")
#-------------------------------------------------------------
IJ.run(skmp3, "Skeletonize (2D/3D)", "")
#IJ.run(skmp3, "Skeletonize", "")
#-------------------------------------------------------------
if debug :
skmp3.show()
IJ.showMessage("imp3 l294")
#-------------------------------------------------------------
IJ.run(skmp3, "BinaryConnectivity ", "white")
ip3.setThreshold(3,4, ImageProcessor.BLACK_AND_WHITE_LUT)
IJ.run(skmp3, "Convert to Mask", "")
#-------------------------------------------------------------
if debug :
skmp3.show()
IJ.showMessage("imp3 l302")
#-------------------------------------------------------------
#IJ.run(skmp3, "Skeletonize", "")
#-------------------------------------------------------------
if debug :
skmp3.updateAndDraw()
skmp3.show()
IJ.showMessage("imp3 l308")
#-------------------------------------------------------------
rawPoints=[]
w=ip3.getWidth()
h=ip3.getHeight()
rawPoints=[(x+xori,y+yori,self.__sommeVals(x,y,ip3)) for x in range(w) for y in range(h) if ip3.getPixel(x,y)==255]
tempbouts=[val for val in rawPoints if val[2]==2]
if len(tempbouts)!=2 : return None
# test
#if len(tempbouts)!=2 :
#
# IJ.run(skmp3, "BinaryConnectivity ", "white")
# ip3.setThreshold(3,3, ImageProcessor.BLACK_AND_WHITE_LUT)
# IJ.run(skmp3, "Convert to Mask", "")
# #-------------------------------------------------------------
# if debug==debug :
# skmp3.updateAndDraw()
# skmp3.show()
# IJ.showMessage("if test l 328")
##-------------------------------------------------------------
# rawPoints=[(x+xori,y+yori,self.__sommeVals(x,y,ip3)) for x in range(w) for y in range(h) if ip3.getPixel(x,y)==255]
# tempbouts=[val for val in rawPoints if val[2]==2]
ip3.setRoi(boundRect)
if rawPoints==[]: return None
npoints=len(rawPoints)
xpoints=[point[0] for point in rawPoints]
ypoints=[point[1] for point in rawPoints]
valpoints=[point[2] for point in rawPoints]
bouts={}
if tempbouts==[]: return None
if tempbouts[0][1]>tempbouts[1][1]:
bouts["A"]=tempbouts[0]
bouts["B"]=tempbouts[1]
else:
bouts["A"]=tempbouts[1]
bouts["B"]=tempbouts[0]
#.........这里部分代码省略.........
示例3:
# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import killRoi [as 别名]
# rt.reset()
# rt.updateResults()
if bClose:
imp.changes = False
imp.close()
# Now draw particles into the original image
rm = RoiManager.getInstance()
ra = rm.getRoisAsArray()
for r in ra:
orig.setRoi(r)
strStroke = " stroke=%s width=%g" % (col, wid)
IJ.run(orig, "Properties... ", strStroke )
IJ.run(orig, "Add Selection...", "")
orig.killRoi()
rm.close()
outPth = sRptImgPath + strName + ".png"
# burn a scale bar and save the image
IJ.run(orig, "RGB Color", "")
IJ.run(orig, "Add Scale Bar", "width=100 height=6 font=28 color=Green location=[Lower Right] bold")
IJ.saveAs(orig, "PNG", outPth)
orig.changes = False
orig.close()
i += 1
# prepare and write the output file
f=open(sRptCsvPath, 'w')
strLine = 'ing, ecd.nm, circ, rnd, a.r, solidity, gray.mode\n'