本文整理汇总了Python中ij.WindowManager.getImageTitles方法的典型用法代码示例。如果您正苦于以下问题:Python WindowManager.getImageTitles方法的具体用法?Python WindowManager.getImageTitles怎么用?Python WindowManager.getImageTitles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.WindowManager
的用法示例。
在下文中一共展示了WindowManager.getImageTitles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: itemStateChanged
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getImageTitles [as 别名]
def itemStateChanged(self,e):
imgList = []
imgList.append(virginImage)
for i in range(len(checkboxObjects)):
if checkboxObjects[i].getState() == True:
imgList.append(self.boxImages[i])
titles = WindowManager.getImageTitles()
p = re.compile(r'^Result')
for title in titles:
m = p.search(title)
if m is not None:
computedImage = WindowManager.getImage(title)
computedImage.close()
IJ.showStatus("Computing...")
computedImage = reduce(self.addImages,imgList)
computedImage.show()
IJ.showStatus("Ready")
示例2: NonBlockingGenericDialog
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getImageTitles [as 别名]
ngd = NonBlockingGenericDialog("Control box")
ngd.addCheckbox("Contained_objects",False)
ngd.addCheckbox("Duplicated_objects",False)
ngd.addCheckbox("Restitched_objects",False)
ngd.addCheckbox("Unique_objects",False)
boxes = ngd.getCheckboxes()
checkboxObjects = []
for i in range(boxes.size()):
checkboxObjects.append(boxes.elementAt(i))
for i in range(len(checkboxObjects)):
checkboxObjects[i].addItemListener(CustomCheckboxListener(objectDB,virginImage,boxImages,boxes))
ngd.setCancelLabel("Exit")
ngd.setOKLabel("Inspect")
ngd.showDialog()
if (ngd.wasCanceled()):
titles = WindowManager.getImageTitles()
p = re.compile(r'^Result')
for title in titles:
m = p.search(title)
if m is not None:
theImage = WindowManager.getImage(title)
theImage.close()
virginImage.show()
for img in boxImages:
img.close()
else:
titles = WindowManager.getImageTitles()
p = re.compile(r'^Result')
for title in titles:
m = p.search(title)
示例3: dialog
# 需要导入模块: from ij import WindowManager [as 别名]
# 或者: from ij.WindowManager import getImageTitles [as 别名]
def dialog(self):
"""
Open the classifier dialog window and return the paramters
chosen.
"""
# determine how many images are currently open
image_count = WindowManager.getImageCount()
image_titles = list(WindowManager.getImageTitles())
image_titles.append("None")
# now open a dialog to let the user set options
path_listener = SetPathListener(self.path)
path_button = TrimmedButton("Output directory",0)
path_button.addActionListener(path_listener)
dlg = GenericDialog("Create classifier data (v"+__version__+")")
dlg.addMessage("Session ID: "+ str(self.session_id))
dlg.addMessage("")
dlg.addMessage("Select the ROI you want to save")
dlg.addNumericField("Window size (pixels): ", self.window_size, 0)
dlg.addChoice("Class label: ", DEFAULT_CLASSES+['Other...'], DEFAULT_CLASSES[0])
dlg.addStringField("Class label (if other): ", "")
dlg.addChoice("Image file #1 (BF):",image_titles,"None")
dlg.addChoice("Image file #2 (GFP):",image_titles,"None")
dlg.addChoice("Image file #3 (RFP):",image_titles,"None")
dlg.addChoice("Mask file:",image_titles,"None")
dlg.addCheckbox("Rename ROIs", True)
dlg.addCheckbox("Exclude edges", True)
dlg.addCheckbox("Save ROI zip", True)
dlg.addCheckbox("Save classifier details", True)
dlg.add(path_button)
dlg.showDialog()
# handle the cancelled dialog box
if dlg.wasCanceled():
return None
label_option = dlg.getNextChoice()
if label_option == 'Other...':
label = dlg.getNextString()
else:
label = label_option
# get the root path from the path listener
root_path = path_listener.path
if not os.path.isdir(root_path):
w_dlg = GenericDialog("Warning")
w_dlg.addMessage("Root path does not exist!!")
w_dlg.showDialog()
return None
# try to make the directory for the label if it does not exist
label_path = os.path.join(root_path, label)
check_and_makedir(label_path)
# get the options
dialog_options = {'window_size': dlg.getNextNumber(),
'label': label,
'BF': dlg.getNextChoice(),
'GFP': dlg.getNextChoice(),
'RFP': dlg.getNextChoice(),
'mask': dlg.getNextChoice(),
'rename': dlg.getNextBoolean(),
'edges': dlg.getNextBoolean(),
'zip': dlg.getNextBoolean(),
'save': dlg.getNextBoolean(),
'path': label_path}
# check that we actually selected an image file
if all([dialog_options[d] == "None" for d in ['BF','GFP','RFP']]):
w_dlg = GenericDialog("Warning")
w_dlg.addMessage("You must select an image stream.")
w_dlg.showDialog()
return None
# grab the contents and return these as a dictionary
return dialog_options