本文整理汇总了Python中ij.WindowManager.getNthImageID方法的典型用法代码示例。如果您正苦于以下问题:Python WindowManager.getNthImageID方法的具体用法?Python WindowManager.getNthImageID怎么用?Python WindowManager.getNthImageID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.WindowManager
的用法示例。
在下文中一共展示了WindowManager.getNthImageID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __buildstacks
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getNthImageID [as 别名]
def __buildstacks(self) :
listfiles = self.__listfiles[2]
positionsList = self.__imagesnames
if not isinstance(listfiles[0],list) and os.path.isfile(listfiles[0]) :
if len(positionsList)==0 : tempname = WindowManager.getUniqueName("image")
else : tempname = positionsList[0]
tempd = tempfile.mkdtemp()
fichier = open(tempd+os.path.sep+tempname+".tif","w")
rawtimes=[]
rawtimes.append(0)
zerotimes=0
for i in range(len(listfiles)-1) :
difftimes=int((os.stat(listfiles[i+1]).st_mtime-os.stat(listfiles[i]).st_mtime))
if difftimes==0 : zerotimes+=1
rawtimes.append(rawtimes[-1]+difftimes)
fichier.writelines(listfiles[i]+"\n")
fichier.writelines(listfiles[-1]+"\n")
fichier.close()
IJ.run("Stack From List...","open="+tempd+os.path.sep+tempname+".tif")
n=WindowManager.getImageCount()
tempid=WindowManager.getNthImageID(n)
tempimg=WindowManager.getImage(tempid)
tempimg.show()
#self.__dictImages[tempname]=tempimg
#tempimg.hide()
nameimages=tempname+"tif"
#if zerotimes/len(rawtimes) > 0.5 : rawtimes=range(len(listfiles))
#self.__dictTimeStack[tempname]=rawtimes
#elif isinstance(listfiles[0][0],str) :
elif os.path.isfile(listfiles[0][0]) :
nameimages=[]
rawtimes=[]
rawtimes.append(0)
for i in range(len(listfiles)) :
if len(positionsList)==0 : tempname = WindowManager.getUniqueName("image"+str(i+1))
else : tempname = positionsList[i]
tempd = tempfile.mkdtemp()
fichier = open(tempd+os.path.sep+tempname+".tif","w")
zerotimes=0
for j in range(len(listfiles[i])-1) :
difftimes=int((os.stat(listfiles[i][j+1]).st_mtime-os.stat(listfiles[i][j]).st_mtime))
if difftimes==0 : zerotimes+=1
rawtimes.append(rawtimes[-1]+difftimes)
fichier.writelines(listfiles[i][j]+"\n")
fichier.writelines(listfiles[i][-1]+"\n")
fichier.close()
IJ.run("Stack From List...","open="+tempd+os.path.sep+tempname+".tif")
n=WindowManager.getImageCount()
tempid=WindowManager.getNthImageID(n)
tempimg=WindowManager.getImage(tempid)
tempimg.show()
#self.__dictImages[tempname]=tempimg
nameimages.append(tempname)
#if zerotimes/len(rawtimes) > 0.5 : rawtimes=range(len(listfiles[i]))
#self.__dictTimeStack[tempname]=rawtimes
rawtimes=[]
rawtimes.append(0)
else :
nameimages=[]
print "ERROR IN BUILDSTACK"
return nameimages
示例2: __buildstack
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getNthImageID [as 别名]
def __buildstack(self, listfiles):
"""
Creates stacks according to the list of paths given by the user.
"""
if not isinstance(listfiles[0],list) and os.path.isfile(listfiles[0]) :
if len(self.__positionsList)==0 : tempname = WindowManager.getUniqueName("image")
else : tempname = self.__positionsList[0]
tempd = tempfile.mkdtemp()
fichier = open(tempd+"/"+tempname+".tif","w")
rawtimes=[]
rawtimes.append(0)
zerotimes=0
for i in range(len(listfiles)-1) :
difftimes=int((os.stat(listfiles[i+1]).st_mtime-os.stat(listfiles[i]).st_mtime))
if difftimes==0 : zerotimes+=1
rawtimes.append(rawtimes[-1]+difftimes)
fichier.writelines(listfiles[i]+"\n")
fichier.writelines(listfiles[-1]+"\n")
fichier.close()
IJ.run("Stack From List...","open="+tempd+"/"+tempname+".tif")
n=WindowManager.getImageCount()
tempid=WindowManager.getNthImageID(n)
tempimg=WindowManager.getImage(tempid)
if self.__batch : tempimg.hide()
else : tempimg.show()
self.__dictImages[tempname]=tempimg
tempimg.hide()
nameimages=tempname
if zerotimes/len(rawtimes) > 0.5 : rawtimes=range(len(listfiles))
self.__dictTimeStack["image1"]=rawtimes
#elif isinstance(listfiles[0][0],str) :
elif os.path.isfile(listfiles[0][0]) :
nameimages=[]
rawtimes=[]
rawtimes.append(0)
for i in range(len(listfiles)) :
if len(self.__positionsList)==0 : tempname = WindowManager.getUniqueName("image"+str(i+1))
else : tempname = self.__positionsList[i]
tempd = tempfile.mkdtemp()
fichier = open(tempd+"/"+tempname+".tif","w")
zerotimes=0
for j in range(len(listfiles[i])-1) :
difftimes=int((os.stat(listfiles[i][j+1]).st_mtime-os.stat(listfiles[i][j]).st_mtime))
if difftimes==0 : zerotimes+=1
rawtimes.append(rawtimes[-1]+difftimes)
fichier.writelines(listfiles[i][j]+"\n")
fichier.writelines(listfiles[i][-1]+"\n")
fichier.close()
IJ.run("Stack From List...","open="+tempd+"/"+tempname+".tif")
n=WindowManager.getImageCount()
tempid=WindowManager.getNthImageID(n)
tempimg=WindowManager.getImage(tempid)
#self.__dictImages["image"+str(i+1)]=tempimg
#nameimages.append("image"+str(i+1))
self.__dictImages[tempname]=tempimg
nameimages.append(tempname)
if zerotimes/len(rawtimes) > 0.5 : rawtimes=range(len(listfiles[i]))
#self.__dictTimeStack["image"+str(i+1)]=rawtimes
self.__dictTimeStack[tempname]=rawtimes
rawtimes=[]
rawtimes.append(0)
tempimg.hide()
else :
nameimages=[]
print "ERROR IN BUILDSTACK"
return nameimages
示例3: erase
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getNthImageID [as 别名]
def erase():
i = WindowManager.getImageCount()
while i > 0:
WindowManager.getImage(WindowManager.getNthImageID(i)).close()
i = i - 1