当前位置: 首页>>代码示例>>Python>>正文


Python RoiManager.show方法代码示例

本文整理汇总了Python中ij.plugin.frame.RoiManager.show方法的典型用法代码示例。如果您正苦于以下问题:Python RoiManager.show方法的具体用法?Python RoiManager.show怎么用?Python RoiManager.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.plugin.frame.RoiManager的用法示例。


在下文中一共展示了RoiManager.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __settings

# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import show [as 别名]
	def __settings(self, imgName) :
		"""
		Lets the user to choose different measures to make, and displays it following the choice of the user.
		
		"""

		try : dico=self.__dictCells[imgName]
		except KeyError : 
			try : dico=self.__dictCells[imgName[:-4]]
			except KeyError : return False
			else : imgName=imgName[:-4]
		
		dico=self.__dictCells[imgName]
		for cellname in dico.keys() :
			self.__dictMeasures[dico[cellname]]={}
			
		# Represents the datas on a diagram
		def diagrambuttonPressed(event) :
			IJ.showMessage("Push 'Auto' button each time you want to see the diagram")
			x1=10
			y1=20
			x2=100
			y2=50
			x3=60
			y3=30
			xr=10
			yr=20
			wr=20
			hr=20

			
			rect=Rectangle(xr,yr,wr,hr)
			
			#img=IJ.getImage()
			#nbslices=self.__img.getImageStackSize()
			nbslices=self.__maxLife
			IJ.run("Hyperstack...", "title=Diagram type=32-bit display=Color width="+str(x2+(nbslices+1)*x3)+" height="+str(y2+y3*len(dico))+" channels=1 slices="+str(len(self.__measures))+" frames=1")
			im=IJ.getImage()
			ip=im.getProcessor()
			for i in range(len(self.__measures)) :
				indiceligne=0
				maxvalue=0
				minvalue=1000000
				im.setPosition(1,i+1,1)
				for cellname in self.__listcellname :
					indiceligne+=1
					for indicecolonne in range(1,nbslices+1):
						rect.setLocation(x2+indicecolonne*x3+int(x3/6),(y1+indiceligne*y3-int(y3/2)))
						# we create at the first iteration a dictionary with the rectangles (for a future use)
						if i==0 :
							self.__gridrectangle[(indiceligne,indicecolonne)]=Rectangle(rect)
						im.setRoi(rect)
						ipr=im.getProcessor()
						# we find the min and max values of the datas for a measure given.
						if self.__dictMeasures[dico[cellname]][self.__measures[i]][indicecolonne-1]>maxvalue :
							maxvalue=self.__dictMeasures[dico[cellname]][self.__measures[i]][indicecolonne-1]
						if self.__dictMeasures[dico[cellname]][self.__measures[i]][indicecolonne-1]<minvalue :
							minvalue=self.__dictMeasures[dico[cellname]][self.__measures[i]][indicecolonne-1]
						# we fill the rectangle with the value of the measure
						ipr.setValue(self.__dictMeasures[dico[cellname]][self.__measures[i]][indicecolonne-1])
						ipr.fill()
				# we write the names and the n of slices on the image with the maxvalue.
				ip.setValue(maxvalue)
				ip.moveTo(x1,y1)
				ip.drawString(self.__measures[i])
				for j in range(1,nbslices+1) :
					ip.moveTo(x2+j*x3,y1)
					ip.drawString("Slice "+str(j))
				j=0
				for cellname in self.__listcellname :
					ip.moveTo(x1,y2+j*y3)
					ip.drawString(cellname)
					j+=1
			im.killRoi()
			im=IJ.run(im,"Fire","")
			IJ.run("Brightness/Contrast...", "")
			#im.setMinAndMax(minvalue,maxvalue)
			#im.updateImage()
			
			#we add a mouse listener in order to be able to show the roi corresponding to a rectangle when the user clicks on it.
			listener = ML()
			listener.name=imgName
			for imp in map(WindowManager.getImage, WindowManager.getIDList()):
				if imp.getTitle().startswith("Diagram") : 
					win = imp.getWindow()
 					if win is None:
						continue
					win.getCanvas().addMouseListener(listener)
		
		# Represents the datas on a series of graphs.
		def graphbuttonPressed(event) :
			
			colors=[]
			#img=IJ.getImage()
			#nbslices=self.__img.getImageStackSize()
			nbslices=self.__maxLife

			acell=dico.values()[0]
			if self.__useTime : 
				x = acell.getListTimes()
#.........这里部分代码省略.........
开发者ID:leec13,项目名称:MorphoBactPy,代码行数:103,代码来源:MeasuresCells_.py

示例2: procOneImage

# 需要导入模块: from ij.plugin.frame import RoiManager [as 别名]
# 或者: from ij.plugin.frame.RoiManager import show [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
开发者ID:cmci,项目名称:HTManalysisCourse,代码行数:74,代码来源:measTransportBatch3.py


注:本文中的ij.plugin.frame.RoiManager.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。