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


Python ImagePlus.getWindow方法代码示例

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


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

示例1: openImp

# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import getWindow [as 别名]
 def openImp(self, path):
    imp = ImagePlus(path)  # open associated tif file
    imp.show()
    imp.getWindow().setLocationAndSize(280, 120, imp.getWidth()*4, imp.getHeight()*4) # int x, int y, int width, int height
    return imp
开发者ID:schiklen,项目名称:BatchMeasurement,代码行数:7,代码来源:04-QualityControl_v8j.py

示例2: gui

# 需要导入模块: from ij import ImagePlus [as 别名]
# 或者: from ij.ImagePlus import getWindow [as 别名]
class gui(JFrame):
	def __init__(self): # constructor 
		#origing of coordinates
		self.coordx = 300
		self.coordy = 50

		self.imageCount = 0 #a counter for the image list
		self.listendFlag = 0 #some values to check
		#inintialize values
		self.imLeft = None
		self.imRight = None
		self.chosenOne = None
		self.chosenIm = None
		#create panel (what is inside the GUI)
		self.panel = self.getContentPane()
		self.panel.setLayout(GridLayout(5,2))

		#define buttons here:
		quitButton = JButton("Quit", actionPerformed=self.quit)
		loadButton = JButton("Load", actionPerformed=self.load)
		leftButton = JButton("Choose Left", actionPerformed = self.ChooseLeft)
		rightButton = JButton("Choose Right", actionPerformed = self.ChooseRight)
		ThresButton = JButton("Threshold",actionPerformed = self.ImThresh)
		self.ThreshField = JTextField("5", 1)
		StartConversionButton = JButton("Start Conversion", actionPerformed = self.StartConv)
		ConvertButton = JButton("Convert Image", actionPerformed = self.ImConvert)
		
		#Zslider = JSlider(JSlider.HORIZONTAL,0, 100, 0)

		#add buttons here
		self.panel.add(loadButton)
		self.panel.add(quitButton)
		self.panel.add(leftButton)
		self.panel.add(rightButton)
		self.panel.add(self.ThreshField)
		self.panel.add(ThresButton)
		self.panel.add(StartConversionButton)
		self.panel.add(ConvertButton)
		#self.panel.add(Zslider)

       	#other stuff to improve the look
		self.pack() # packs the frame
		self.setVisible(True) # shows the JFrame
		self.setLocation(0,self.coordy+200)


		




	#define functions for the buttons:
       
	def quit(self, event): #quit the gui
		if self.imLeft is not None:
			self.imLeft.close()
			self.imRight.close()
		self.dispose()
       

	def load(self, event): #choose a folder to load images
		self.imdir = DirectoryChooser("Select a dir, dude").getDirectory()

		self.pictureList = [path.join(self.imdir, f) for f in listdir(self.imdir) if path.splitext(f)[1]==".tiff" and 'AVG' not in f and 'Avg' not in f]  #list of pictures (not averages) with .tiff extension
		print self.pictureList #list of pictures
		self.imLeft = ImagePlus(self.pictureList[self.imageCount]) #read the image
		self.imageCount =self.imageCount+1 #increase counter
		self.imRight = ImagePlus(self.pictureList[self.imageCount]) #read the image
		self.imageCount =self.imageCount+1
		
		self.imLeft.show() #show image on the left
		self.imLeft.getWindow().setLocation(self.coordx,self.coordy) #reposition image
		
       
		self.imRight.show() #show image on the right
		self.rightImLocx = self.coordx+self.imLeft.getWindow().getWidth() #set a variable with the x position for right image
		self.imRight.getWindow().setLocation(self.rightImLocx,self.coordy) #reposition image

		#WindowOrganizer("Tile")
		
		#SyncWindows(self.imLeft.getTitle() + " " + self.imRight.getTitle())
		#IJ.run("Sync Windows")

		print len(self.pictureList)

		

	def ChooseLeft(self, event): #remove right image and load another
		if self.listendFlag==0: #if is not the end of the list
			print "You chose left, which is of course right"
			self.imRight.close()
		if self.imageCount>=len(self.pictureList): #if is the end of the list
			print "YOU HAVE A WINNER!!!"
			self.listendFlag = 1	#flag
			if self.imageCount==len(self.pictureList):
				self.chosenOne = 'L'	#a variable to know the position of the chosen one
			self.imageCount = self.imageCount+1	#this is to avoid changing the chosen one
		else:
			self.imRight = ImagePlus(self.pictureList[self.imageCount]) #read next image
			self.imageCount =self.imageCount+1	#increase counter
#.........这里部分代码省略.........
开发者ID:HernyMV,项目名称:Fiji,代码行数:103,代码来源:CuratedBinary.py


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