本文整理汇总了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
示例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
#.........这里部分代码省略.........