本文整理汇总了Python中ij.plugin.frame.RoiManager.getSelectedRoisAsArray方法的典型用法代码示例。如果您正苦于以下问题:Python RoiManager.getSelectedRoisAsArray方法的具体用法?Python RoiManager.getSelectedRoisAsArray怎么用?Python RoiManager.getSelectedRoisAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.plugin.frame.RoiManager
的用法示例。
在下文中一共展示了RoiManager.getSelectedRoisAsArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeCell
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getSelectedRoisAsArray [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
示例2: __ImportCells
# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import getSelectedRoisAsArray [as 别名]
def __ImportCells(self, imagesnames) :
#self.__dictCells[imgName]={}
rm = RoiManager.getInstance()
if (rm==None): rm = RoiManager()
rm.runCommand("reset")
listpaths = []
listfilescells=[]
if self.__optionImages :
IJ.showMessage("Select the folder 'Cells' containing the cells to import")
selectdir=IJ.getDirectory("image")
selectdir=IJ.getDirectory("")
listfilescells.extend(glob.glob(selectdir+os.path.sep+"*"))
listpaths.append("")
else :
IJ.showMessage("Select the text file containing the list cell paths (listpaths.txt)")
selectdir=IJ.getDirectory("current")
frame = Frame("Text file settings ?")
fd = FileDialog(frame)
fd.setDirectory(selectdir)
fd.show()
selectdir = fd.getDirectory()
textfile = fd.getFile()
fichier = open(selectdir+textfile,"r")
listpaths=[ glob.glob(f.split("\n")[0]+"Selected-Cells"+os.path.sep+"*") for f in fichier.readlines()]
#for f in templist :
# listpaths.append(f.split("\n")+"Cells")
listfilescells.append("")
if listfilescells[0]=="" : importmode = True
else : importmode = False
for j in range(len(listpaths)) :
self.__dictCells[imagesnames[j]]={}
if importmode : listfilescells = listpaths[j]
pathtemp = []
for cellfile in listfilescells :
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]))
self.__dictCells[imagesnames[j]][values[0]]=celltemp
self.__dictMeasures[self.__dictCells[imagesnames[j]][values[0]]]={}
if params[0] == "PATHROIS" :
pathtemp.append(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])))
indiceroi=0
ind=0
tempimp = WindowManager.getImage(imagesnames[j])
if tempimp is not None :
IJ.selectWindow(imagesnames[j])
tempimp.show()
else :
if imagesnames[j][-4:]==".tif" :
IJ.selectWindow(imagesnames[j][:-4])
tempimp = IJ.getImage()
else :
IJ.selectWindow(imagesnames[j]+".tif")
tempimp = IJ.getImage()
rm.runCommand("reset")
for cellname in self.__dictCells[imagesnames[j]].keys() :
rm.runCommand("Open", pathtemp[ind])
ind+=1
nbtemp=self.__dictCells[imagesnames[j]][cellname].getLifeTime()
for i in range(nbtemp) :
rm.select(tempimp, indiceroi)
roi=rm.getSelectedRoisAsArray()[0]
self.__dictCells[imagesnames[j]][cellname].setRoi(roi,i+self.__dictCells[imagesnames[j]][cellname].getSlideInit()-1)
#.........这里部分代码省略.........