本文整理汇总了Python中ij.plugin.frame.RoiManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python RoiManager.getInstance方法的具体用法?Python RoiManager.getInstance怎么用?Python RoiManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.plugin.frame.RoiManager
的用法示例。
在下文中一共展示了RoiManager.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resetpressed
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def resetpressed(event):
self.__ranges.clear()
self.__image=IJ.getImage()
rm = RoiManager.getInstance()
if (rm==None): rm = RoiManager()
rm.runCommand("reset")
self.__image.killRoi()
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()
#rm.runCommand("Show All")
#rm.runCommand("Select All")
#rm.runCommand("Set Color", "blue")
IJ.resetThreshold(self.__image)
keys=self.__slidersDict.keys()
for k in keys:
if k.endswith("min"):
self.__slidersDict[k].setValue(0)
self.__slidersDict[k].repaint()
else:
self.__slidersDict[k].setValue(self.__slidersDict[k].getMaximum())
self.__slidersDict[k].repaint()
示例2: __init__
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def __init__(self):
swing.JFrame.__init__(self, title="Stack Cells")
self.__impD = IJ.getImage()
self.setDefaultCloseOperation(swing.JFrame.DISPOSE_ON_CLOSE)
self.__n=0
self.__widthl = "11"
self.__iplist = []
self.__init = False
self.__initDIA = False
self.__initFLUO = False
self.__skip = False
self.__avg = True
self.__mosa = True
self.__maxfinder = True
self.__appmedian = True
self.__fire = True
self.__align = True
self.__alignC = False
self.__enlarge = True
self.__measures = True
self.__sens = []
self.__listrois = []
self.__cellsrois = []
self.__Cutoff = 0
self.__labels = []
self.__maxraf = 100.0
self.__minraf = 0.0
self.__conEllipses = False
self.__dictCells = {}
self.__rm = RoiManager.getInstance()
if (self.__rm==None): self.__rm = RoiManager()
self.run()
示例3: get_roi_manager
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def get_roi_manager(new=False):
rm = RoiManager.getInstance()
if not rm:
rm = RoiManager()
if new:
rm.runCommand("Reset")
return rm
示例4: anaParticlesWatershed
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def anaParticlesWatershed(imp, strThrMeth="method=Default white", minPx=10, minCirc=0.35, labCol=Color.white, linCol=Color.green, bDebug=False, sl=0.005):
"""anaParticlesWatershed(imp, strThrMeth="method=Default white", minPx=10, minCirc=0.35, labCol=Color.white, linCol=Color.green, bDebug=False, sl=0.005)
A wrapper function to do particle analyis from an image after a watershed transformation and draw the detected
features into the overlay of the original image.
Inputs:
imp - the ImagePlus instance that we will process
strThrMeth - a string specifying the threshold method
minPx - the minimum pixels to detect
minCirc - the minimum circularity to detect
labCol - the color for labels in the overlay (default white)
linCol - the color for line/stroke in the overlay (default green)
bDebug - a flag (default False) that, if true, keeps the work image open
sl - a time (default 0.005) to sleep when adding ROIs to not overload
This adds the detected features to the overlay and returns the result table for
processing for output.
"""
title = imp.getTitle()
shortTitle = imp.getShortTitle()
typ = imp.getType()
imp.setTitle(shortTitle)
imp.show()
IJ.run(imp,"Duplicate...", "title=work")
wrk = IJ.getImage()
# if this is a 16 bit image, convert to 8 bit prior to threshold
if typ == ImagePlus.GRAY16:
IJ.run(wrk, "Enhance Contrast", "saturated=0.35")
IJ.run(wrk, "8-bit", "")
IJ.run(wrk, "Threshold", strThrMeth)
IJ.run(wrk, "Watershed", "")
wrk.show()
strMeas = "area mean modal min center perimeter bounding fit shape feret's display redirect=%s decimal=3" % shortTitle
IJ.run(wrk, "Set Measurements...", strMeas)
strAna = "size=%d-Infinity circularity=%g-1.00 exclude clear include add" % (minPx, minCirc)
IJ.run(wrk, "Analyze Particles...", strAna)
rt = ResultsTable().getResultsTable()
rm = RoiManager.getInstance()
ra = rm.getRoisAsArray()
# Let's draw the particles into the overlay of the original
i=0
for r in ra:
i += 1
rLab = "%d" % i
r.setName(rLab)
imp = addRoiToOverlay(imp, r, labCol=labCol, linCol=linCol)
# needed to put in sleep here on cruch to let this complete and not overrun buffer
time.sleep(sl)
# let's put a PointRoi outside the image to get the overlays all the same color
r = PointRoi(-10, -10)
imp = addRoiToOverlay(imp, r, labCol=labCol, linCol=linCol)
# clear the roi manager and return the results table
rm.reset()
rm.close()
if bDebug == False:
wrk.changes = False
wrk.close()
imp.setTitle(title)
return rt
示例5: __add
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def __add(self, event):
if ( not self.__init) :
IJ.showMessage("", "please start a new stack")
return
if ( not self.__initDIA) :
IJ.showMessage("", "please select an image for DIA")
return
if ( not self.__initFLUO) :
IJ.showMessage("", "please select an image for FLUO")
return
self.__widthl = self.__display2.getText()
roi = self.__impD.getRoi()
if roi == None :
IJ.showMessage("", "No selection")
return
if roi.getType() in [6,7] :
nslice = self.__impD.getCurrentSlice()
self.__impF.setSlice(nslice)
self.__impF.setRoi(roi)
elif roi.getType() in [2,4] :
nslice = self.__impD.getCurrentSlice()
self.__impF.setSlice(nslice)
m=Morph(self.__impF, roi)
m.setMidParams(10, 2)
roi=m.MidAxis
if roi == None :
self.__display.text = "roi fail"
if not self.__skip : IJ.showMessage("", "failed roi, please draw it as polyline")
return
#if roi.getType() != 6 : self.__impF.setRoi(roi)
else :
IJ.showMessage("", "This selection is not yet allowed")
return
self.__impF.setRoi(roi)
straightener = Straightener()
new_ip = straightener.straighten(self.__impF, roi, int(self.__widthl))
self.__iplist.append(new_ip)
self.__labels.append(self.__isF.getShortSliceLabel(nslice))
self.__display.text = self.__name + " cell " + str(len(self.__iplist)) +" width="+str(new_ip.getWidth())+ " height="+ str(new_ip.getHeight())
roi.setPosition(self.__impD.getCurrentSlice())
self.__rm = RoiManager.getInstance()
if (self.__rm==None): self.__rm = RoiManager()
self.__rm.add(self.__impD, roi, len(self.__iplist))
self.__cellsrois.append((roi, self.__impD.getCurrentSlice()))
#self.__rm.runCommand("Show All")
IJ.selectWindow(self.__impD.getTitle())
示例6: segmentChannel_Weka
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def segmentChannel_Weka(image, **kwargs):
""" SegmentChannel using a Weka Classification"""
ch = kwargs['channel']
if ch > len(image):
raise Exception('Expecting at least ' + str(ch) + ' channels. Image has only ' + str(len(imageC)) + ' channel(s)')
imp = image[ch-1].duplicate()
ws = WekaSegmentation(imp) # create an instance
ws.loadClassifier(kwargs['clspath']) # load classifier
impProb = ws.applyClassifier(imp, 0, True)
impMetaProb = extractChannel(impProb,1,1)
impMetaProb.setTitle("MetaProb")
# segmentation
impBW = threshold(impMetaProb, kwargs['probThr'])
impMetaProb.show()
IJ.run("Set Measurements...", " mean center shape area redirect=MetaProb decimal=2");
# particle analysis
IJ.run(impBW, "Analyze Particles...", "size=10-10000 pixel area circularity=0.00-1.00 display exclude clear stack add");
rt = Analyzer.getResultsTable()
validParticles = []
roim = RoiManager.getInstance()
if roim == None:
raise Exception('Fiji error segmentNuclei.py: no RoiManager!')
if roim.getCount() > 0:
rois = roim.getRoisAsArray()
else:
IJ.log("# particles = 0")
return impMetaProb, impBW, None, None
X = rt.getColumn(rt.getColumnIndex("XM"))
Y = rt.getColumn(rt.getColumnIndex("YM"))
Mean = rt.getColumn(rt.getColumnIndex("Mean"))
Circ = rt.getColumn(rt.getColumnIndex("Circ."))
Area = rt.getColumn(rt.getColumnIndex("Area"))
print "# particles = " + str(len(Mean))
nValid = 0
for i in range(len(Mean)):
valid = (Mean[i]>kwargs['minProb']) and (Circ[i]<kwargs['maxCirc']) # filter particles post detection
if(valid):
validParticles.append([i, X[i], Y[i], Mean[i]])
print validParticles
IJ.log("# valid particles = %d " % len(validParticles))
# sort particles according to Mean
validParticlesSorted = sorted(validParticles, key=itemgetter(3))
# only keep the three with the largest Mean
validParticles = validParticlesSorted[-int(kwargs["nrPart"]):]
#random.shuffle(validParticles)
IJ.log("# valid particles = %d " % len(validParticles))
if len(validParticles) == 0:
validParticles = None
return impMetaProb, impBW, validParticles, rois
开发者ID:tischi,项目名称:scripts,代码行数:52,代码来源:2015-04-30--Tischi--KatharinaSonnen--Online_Weka_Metaphase_Detection_.py
示例7: filter_hough
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def filter_hough():
new_image = IJ.getImage()
# Get the roi manager
roi_manager = RoiManager.getInstance()
roi_array = roi_manager.getRoisAsArray()
for cur_roi in roi_array:
new_image.setRoi(cur_roi)
stats = new_image.getStatistics(Measurements.CENTROID)
x_centroid_list.append(stats.xCentroid)
y_centroid_list.append(stats.yCentroid)
# Close the new image
new_image.killRoi() # Remove the remaining ROI
roi_manager.runCommand("Reset")
roi_manager.runCommand("Close")
new_image.changes = False
new_image.close()
示例8: ShowRoi
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def ShowRoi(self,imp,point, name):
for indices in self.__gridrectangle.keys() :
if self.__gridrectangle[indices].contains(point) :
roitemp=self.__dictCells[name][self.__listcellname[indices[0]-1]].getRoi(indices[1]-1)
if isinstance(roitemp,Roi) :
idimages=WindowManager.getIDList()
for i in range(len(idimages)) :
if idimages[i]==self.__img.getID() :
IJ.selectWindow(self.__img.getID())
rm = RoiManager.getInstance()
for i in range(rm.getCount()) :
if rm.getName(str(i))==roitemp.getName() :
rm.select(i)
selectroi=self.__img.getRoi()
#col=rm.getSelectedRoisAsArray().getStrokeColor()
selectroi.setStrokeColor(Color.red)
selectroi.setStrokeWidth(3)
self.__img.updateAndDraw()
break
示例9: makeCell
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def makeCell(cellfile) :
filetemp = open(cellfile,"r")
linestemp=filetemp.readlines()
for line in linestemp :
params=line.split("=")
values=params[1].split("\n")
if params[0] == "NAMECELL" :
celltemp=Bacteria_Cell(str(values[0]))
if params[0] == "PATHROIS" :
pathtemp = str(values[0])
if params[0] == "NSLICES" :
for i in range(int(values[0])) :
celltemp.getListRoi().append("")
if params[0] == "SLICEINIT" :
celltemp.setSlideInit(int(values[0]))
#for i in range(int(values[0])-2) :
# celltemp.setRoi("NOT HERE YET",i)
if params[0] == "SLICEEND" :
celltemp.setSlideEnd(int(values[0]))
#for i in range(int(values[0])) :
# celltemp.setRoi("LOST",i)
if params[0] == "COLOR" :
colorstemp=values[0].split(";")
celltemp.setColor(Color(int(colorstemp[0]),int(colorstemp[1]),int(colorstemp[2])))
rm = RoiManager.getInstance()
if (rm==None): rm = RoiManager()
rm.runCommand("reset")
rm.runCommand("Open", pathtemp)
rois=rm.getSelectedRoisAsArray()
celltemp.setlistRois(rois)
rm.runCommand("UseNames", "true")
rm.runCommand("Associate", "true")
return celltemp
示例10: showSettingsDialog
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def showSettingsDialog(self):
if self.__image.getOverlay() is not None : self.__image.getOverlay().clear()
rm = RoiManager.getInstance()
if (rm==None): rm = RoiManager()
#rm.runCommand("Deselect")
#for i in range(rm.getCount()) :
# rm.select(i)
# rm.runCommand("Set Color", "0000FF", 2)
IJ.resetThreshold(self.__image)
rm.runCommand("Show All")
self.__ranges.clear()
#areas, means, majors, minors=[],[],[],[]
#for roi in self.__roisArray:
# m=Morph(self.__image, roi)
# areas.append(m.Area)
# means.append(m.Mean)
# majors.append(m.Major)
# minors.append(m.Minor)
#maxarea=max(areas)*1000
#maxint=max(means)*10
#maxline=max(majors)*100
#maxminline=max(minors)*100
#minline=min(minors)
#namemeasures=["Area", "Mean", "Angle", "Major", "Minor", "Solidity", "AR", "Round", "Circ"]
#maxmeasures=[maxarea, maxint, 180*10, maxline, maxminline, 1*1000, (maxline/minline), 1*1000, 1*1000]
#set1000=Set(["Solidity", "Round", "Circ"])
#set10=Set(["Angle"])
def buttonPressed(event):
temprois=self.getIncludeRois()
for roi in temprois:
m=Morph(self.__image, roi)
IJ.log("----------------------------------")
IJ.log(roi.getName())
for r in self.__ranges.values():
IJ.log(r[0]+" min= "+str(r[1])+" < val="+str(m.__getattribute__(r[0]))+" < max= "+str(r[2]))
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()
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)
#.........这里部分代码省略.........
示例11: microns
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
from ij import IJ
from ij.plugin.frame import RoiManager
print "'Multi Drift Correction' plugin; version 1.1; by Brandon Brown"
#converts microns (or whatever the physical dist is to pixels)
'''
def getPixelPos(x,y, imp):
point = [0,0]
point[0] = (x / cal.piXelW)
point[1] = (imp.height * (y / 100))
return point
'''
rm = RoiManager.getInstance() #get the open ROI manager instance
ra = rm.getRoisAsArray() #get all the ROIs in an array
#print r1.getPosition()
imp = IJ.getImage() #get current image
stack = imp.getStack() #get current
rm = RoiManager.getInstance()
ra = rm.getRoisAsArray()
nRois = len(ra)
proc = IJ.getProcessor() #get the image processor
cal = imp.getCalibration();
#print cal.pixelWidth
#print imp.width
totSlices = int(stack.getSize())
#print stack.getSize()
#print r1.getFloatPolygon().xpoints[0] #get xpoint
#first convert our ROIs to something more useful, a tuple containing the point (x,y) and the Z position => (x,y,z)
for i in range(0, nRois-1):
示例12: validDataset
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
# @LogService log
# This script exemplifies how to instruct KymographBuilder to
# process all the line ROIs present in the ROI Manager. For more
# details see http://imagej.net/KymographBuilder
import ij.plugin.frame.RoiManager as RM
import sc.fiji.kymographBuilder.KymographFactory as KFactory
def validDataset(dataset):
"""Assess if dataset has suitable dimensions"""
from net.imagej.axis import Axes
z = dataset.dimension(dataset.dimensionIndex(Axes.Z))
t = dataset.dimension(dataset.dimensionIndex(Axes.TIME))
return z * t > 1
rm = RM.getInstance()
counter = 0
if validDataset(dataset) and rm and rm.getCount():
for roi in rm.getRoisAsArray():
if roi.isLine():
kfactory = KFactory(context, dataset, roi)
kfactory.build()
counter += 1
title = "Kymograph" + str(counter).zfill(3) + "_" + roi.getName()
ij.ui().show(title, kfactory.getKymograph())
log.info("MultiKymographBuilder Finished. " + str(counter) + " ROIs processed")
else:
log.error("Either the ROI Manager is empty or " + dataset.getName() +" has invalid dimensions")
示例13: __addroi
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
def __addroi(self, event) :
if ( not self.__init) :
IJ.showMessage("", "please start a new stack")
return
if ( not self.__initDIA) :
IJ.showMessage("", "please select an image for DIA")
return
if ( not self.__initFLUO) :
IJ.showMessage("", "please select an image for FLUO")
return
twres = TextWindow("measures-"+self.__name, "label\tname\tsol\tarea\tcirc\tAR\tFeret\taxis\traf\tdMajor\tdFeret\tdArea", "", 300, 450)
tab="\t"
self.__widthl = self.__display2.getText()
IJ.selectWindow(self.__impF.getTitle())
self.__rm = RoiManager.getInstance()
if (self.__rm==None): self.__rm = RoiManager()
if self.__impF.getImageStackSize() > 1 :
roisarray =[(roi, self.__rm.getSliceNumber(roi.getName())) for roi in self.__rm.getRoisAsArray()]
else :
roisarray =[(roi, 1) for roi in self.__rm.getRoisAsArray()]
self.__rm.runCommand("reset")
#self.__rm.runCommand("Delete")
IJ.selectWindow(self.__impF.getTitle())
self.__maxraf=float(self.__display19.text)
self.__minraf=float(self.__display20.text)
count=1
for roielement in roisarray :
roi = roielement[0]
pos = roielement[1]
lab = self.__impF.getImageStack().getShortSliceLabel(pos)
if lab==None : lab=str(pos)
if self.__conEllipses :
IJ.selectWindow(self.__impF.getTitle())
self.__impF.setSlice(pos)
self.__impF.setRoi(roi)
self.__rm.runCommand("Add")
IJ.run(self.__impF, "Fit Ellipse", "")
ellipse=self.__impF.getRoi()
params = ellipse.getParams()
ferets = ellipse.getFeretValues()
imp2 = Duplicator().run(self.__impF,pos,pos)
IJ.run(imp2, "Rotate... ", "angle="+str(ferets[1])+" grid=0 interpolation=Bilinear enlarge slice")
temproi=Roi((imp2.getWidth()-ferets[0])/2.0,(imp2.getHeight()-ferets[2])/2.0,ferets[0],ferets[2])
imp2.setRoi(temproi)
imp3 = Duplicator().run(imp2,1,1)
ip3=imp3.getProcessor()
if int(self.__display5.text) < ip3.getWidth() < int(self.__display6.text) :
self.__iplist.append(ip3)
self.__display.text = self.__name + " cell " + str(len(self.__iplist))
fer=Line(params[0],params[1],params[2],params[3])
self.__cellsrois.append((fer, pos))
self.__labels.append(self.__isF.getShortSliceLabel(pos))
m=Morph(self.__impF, roi)
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(fer.getLength())+tab+str(1)+tab+str(0)+tab+str(0)+tab+str(0))
self.__dictCells[count]=(str(roi.getName()), lab, roi)
count=count+1
continue
if roi.getType() in [6,7] :
self.__impF.setSlice(pos)
self.__impF.setRoi(roi)
self.__rm.runCommand("Add")
elif roi.getType() in [2,4] :
self.__impF.setSlice(pos)
self.__impF.setRoi(roi)
m=Morph(self.__impF, roi)
m.setMidParams(10, 2)
midroi=m.MidAxis
if midroi == None : continue
raf = m.MaxFeret/midroi.getLength()
if (self.__maxraf < raf) or (raf < self.__minraf) : continue
maxsol = float(self.__display7.text)
minsol = float(self.__display8.text)
maxarea = float(self.__display9.text)
minarea = float(self.__display10.text)
maxcirc = float(self.__display11.text)
mincirc = float(self.__display12.text)
maxar = float(self.__display13.text)
minar = float(self.__display14.text)
maxfer = float(self.__display15.text)
minfer = float(self.__display16.text)
maxmean = float(self.__display17.text)
#.........这里部分代码省略.........
示例14: locDialogParameters
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
validParticles
random.shuffle(validParticles)
if kwargs['command'] != 'nothing':
autTool.writePositionToRegistry([[part[1], part[2]] for part in validParticles[0:int(kwargs["nrPart"])]])
IJ.run("Read Write Windows Registry", "action=write location=[HKCU\\"+zk.regkey+"] key="+zk.subkey_codemic+" value=["+kwargs['command']+"] windows=REG_SZ")
return validParticles
test = 0
if test ==0:
locDialogParameters('Weka_Metaphase_Detection')
if test ==1 :
IJ.run("Close All", "");
roim = RoiManager.getInstance()
if roim == None:
roim = RoiManager()
roim.runCommand("reset");
imagePath = r"C:\Users\toni\Code\AutomatedMicroscopy\IJMacros\WekaPipeline\TestImage_1024.tif"
imp = IJ.openImage(imagePath)
imp.show()
kwargs={'pip':'Default', 'task':1, 'channel':1, 'command':"trigger1", 'clspath':"C:\\Users\\toni\\Code\\AutomatedMicroscopy\\IJMacros\\WekaPipeline\\classifier.model", 'nrPart':3,
'Min Intensity':0.8, 'maxCirc': 0.8, 'probThr':0.6}
procs, segs, validParticles, rois = segmentChannel_Weka([imp], **kwargs)
executeTask_Weka(validParticles, **kwargs)
particle = [part[0] for part in validParticles]
print particle
开发者ID:tischi,项目名称:scripts,代码行数:33,代码来源:2015-04-30--Tischi--KatharinaSonnen--Online_Weka_Metaphase_Detection_.py
示例15: __settings
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getInstance [as 别名]
#.........这里部分代码省略.........
if self.__measuresparambool_global[2] : # calculate cumulatedDistance
self.__measures.append("cumulatedDist")
#velocities=[]
for i in range(len(self.__listcellname)) :
IJ.showProgress(i, len(self.__listcellname))
self.__measurecumulDist(self.__img,imgName)
self.__img.show()
self.__img.getProcessor().resetThreshold()
if self.__updateoverlay :
if self.__img.getOverlay() is not None : self.__img.getOverlay().clear()
outputrois=[]
cellnames=[]
self.__img.hide()
for cellname in self.__listcellname :
for r in dico[cellname].getListRoi():
if isinstance(r,Roi) :
pos=r.getPosition()
#print "MC overlay", cellname, r.getName(), pos
#r.setPosition(0)
#overlay.add(r)
outputrois.append(r)
if "cell" in r.getName() : cellnames.append(r.getName())
else : cellnames.append(str(pos)+"-"+cellname)
#print cellnames[-1]
rm = RoiManager.getInstance()
if (rm==None): rm = RoiManager()
rm.show()
self.__img.show()
IJ.selectWindow(self.__img.getTitle())
rm.runCommand("reset")
for i in range(len(outputrois)) :
outputrois[i].setName(cellnames[i])
rm.addRoi(outputrois[i])
rm.select(rm.getCount()-1)
rm.runCommand("Rename", cellnames[i])
IJ.run("Show Overlay", "")
rm.runCommand("UseNames", "true")
rm.runCommand("Associate", "true")
IJ.run(self.__img, "Labels...", "color=red font=12 show use")
IJ.run(self.__img, "From ROI Manager", "")
rm.runCommand("Show None")
rm.runCommand("Show All")
# ----------- batch analyse ------------------------
if self.__batchanalyse :
if self.__savetables : saveResults()
self.__dictMeasures.clear()
self.__allcells[:]=[]
self.__measurescompl[:]=[]
self.__measures[:]=[]
return False
# ---------- display methodes dialog ----------------
# Allows the user to choose how to see the results of the measures.