本文整理汇总了Python中ij.gui.GenericDialog.showDialog方法的典型用法代码示例。如果您正苦于以下问题:Python GenericDialog.showDialog方法的具体用法?Python GenericDialog.showDialog怎么用?Python GenericDialog.showDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.GenericDialog
的用法示例。
在下文中一共展示了GenericDialog.showDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getSettings
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def getSettings(img):
"""This function assesses (by returning a boolean value) if the filter can
be applied to the image passed as argument. Will ask the user for new values
if current parameters are undefined."""
global xradius, yradius, zradius
canProceed = True
if not img:
IJ.error("No images open.")
canProceed = False
# Get new values if at least one of the parameters is 'null'
if canProceed and None in (xradius, yradius, zradius):
gd = GenericDialog("Median Filter")
gd.addNumericField("X radius:", 2.0, 1)
gd.addNumericField("Y radius:", 2.0, 1)
gd.addNumericField("Z radius:", 2.0, 1)
gd.showDialog()
if gd.wasCanceled():
canProceed = False
else:
xradius = gd.getNextNumber()
yradius = gd.getNextNumber()
zradius = gd.getNextNumber()
return canProceed
示例2: get_setup
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def get_setup():
''' Returns the drift correction mode and three image.
The order of return values is drift detection mode, pre-edge 1, pre-edge 2, post-edge.
'''
options = drift.get_options()
modes = drift.get_modes()
dialog = GenericDialog('3-window-method setup')
dialog.addMessage('Select the mode for drift correction\n' +
'and the images to process.')
dialog.addChoice('Mode:', options, options[0])
image_ids = WindowManager.getIDList()
if not image_ids or len(image_ids) < 2:
return [None]*4
image_titles = [WindowManager.getImage(id).getTitle() for id in image_ids]
dialog.addMessage('Post-edge is divided by the pre-edge.')
dialog.addChoice('Pre-edge 1', image_titles, image_titles[0])
dialog.addChoice('Pre-edge 2', image_titles, image_titles[1])
dialog.addChoice('Post-edge', image_titles, image_titles[2])
dialog.showDialog()
if dialog.wasCanceled():
return [None]*4
mode = modes[dialog.getNextChoiceIndex()]
img1 = WindowManager.getImage(image_ids[dialog.getNextChoiceIndex()])
img2 = WindowManager.getImage(image_ids[dialog.getNextChoiceIndex()])
img3 = WindowManager.getImage(image_ids[dialog.getNextChoiceIndex()])
return mode, img1, img2, img3
示例3: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def getOptions(imp):
gd = GenericDialog("Correct 3D Drift Options")
channels = []
for ch in range(1, imp.getNChannels()+1 ):
channels.append(str(ch))
methods = ["phase_correlation","center_of_mass"]
gd.addChoice("Channel for registration:", channels, channels[0])
gd.addChoice("Method for registration:", methods, methods[1])
gd.addNumericField("Background value:", 0, 0)
gd.addCheckbox("Multi_time_scale computation for enhanced detection of slow drifts?", False)
gd.addCheckbox("Sub_pixel drift correction (possibly needed for slow drifts)?", False)
gd.addCheckbox("Edge_enhance images for possibly improved drift detection?", False)
gd.addCheckbox("Use virtualstack for saving the results to disk to save RAM?", False)
gd.addCheckbox("Drift correct only data inside ROI?", False)
gd.addCheckbox("Only compute drift vectors?", False)
gd.addMessage("If you put a ROI, drift will only be computed in this region;\n the ROI will be moved along with the drift to follow your structure of interest.")
gd.addSlider("z_min of ROI", 1, imp.getNSlices(), 1)
gd.addSlider("z_max of ROI", 1, imp.getNSlices(), imp.getNSlices())
gd.showDialog()
if gd.wasCanceled():
return
channel = gd.getNextChoiceIndex() + 1 # zero-based
method = gd.getNextChoiceIndex() + 1 # zero-based
bg_value = gd.getNextNumber()
multi_time_scale = gd.getNextBoolean()
subpixel = gd.getNextBoolean()
process = gd.getNextBoolean()
virtual = gd.getNextBoolean()
only_roi = gd.getNextBoolean()
only_compute = gd.getNextBoolean()
roi_z_min = int(gd.getNextNumber())
roi_z_max = int(gd.getNextNumber())
return channel, method, bg_value, virtual, multi_time_scale, subpixel, process, only_roi, only_compute, roi_z_min, roi_z_max
示例4: main
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def main():
properties = ImageProperties(imp)
# Create a GenericDialog to configure renaming:
gd = GenericDialog('Gatan Reamer')
gd.addMessage('Modifying: %s' % (imp.getTitle(),))
gd.addMessage('Recorded: %s' % (properties.date.toString(),))
gd.addNumericField('Exposure time', properties.exposure, 4, field_width, 's')
gd.addNumericField('Magnification:', properties.magnification, 0, field_width, 'x')
mag_units = ('kx', 'x')
gd.addChoice('Magnification unit:', mag_units, mag_units[0])
gd.addMessage('The actual magnification is %.2f times larger.' % (properties.mag_factor,))
gd.addCheckbox('Use actual magnification:', False)
gd.addMessage('')
gd.addNumericField('Energy loss:', properties.energyloss, 1, field_width, 'eV')
gd.addStringField('Date:', properties.date_string, field_width)
gd.addStringField('original name:', properties.name, field_width_long)
gd.addStringField('Filename format', default_format_str, field_width_long)
gd.showDialog()
if not gd.wasCanceled():
# Edit the properties to consiter user choices:
properties.exposure = gd.getNextNumber()
mag = gd.getNextNumber()
properties.mag_unit = gd.getNextChoice()
if gd.getNextBoolean():
properties.calc_mag(mag)
properties.energyloss = gd.getNextNumber()
properties.date_string = gd.getNextString()
properties.name = gd.getNextString()
format_str = gd.getNextString()
# Chenge the title:
imp.setTitle(format_str % properties.to_dict())
示例5: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def getOptions():
lowerThreshold = 80;
upperThreshold = 255;
stepNumber = 1
stepThreshold = 5;
#p3DOCThreshold = 70;
#p3DOCSlice = 1;
p3DOCmin = 100;
p3DOCmax = 2658480;
gd = GenericDialog( "Parameters" )
gd.addMessage("Binary mask thresholds")
gd.addNumericField("Lower Threshold", lowerThreshold, 0) # show 2 decimals
gd.addNumericField("Upper threshold", upperThreshold, 0) # show 2 decimals
gd.addNumericField("Step number", stepNumber, 0) # show 2 decimals
gd.addNumericField("Step threshold", stepThreshold, 0) # show 2 decimals
gd.addMessage("3D Object Counter parameters")
#gd.addNumericField("threshold", p3DOCThreshold, 0) # show 2 decimals
gd.addNumericField("min.", p3DOCmin, 0) # show 2 decimals
gd.addNumericField("max.", p3DOCmax, 0) # show 2 decimals
gd.showDialog()
if gd.wasCanceled():
return
# Read out the options
lowerThreshold = gd.getNextNumber()
upperThreshold = gd.getNextNumber()
stepNumber = gd.getNextNumber()
stepThreshold = gd.getNextNumber()
#p3DOCThreshold = gd.getNextNumber()
p3DOCmin = gd.getNextNumber()
p3DOCmax = gd.getNextNumber()
return lowerThreshold, upperThreshold, stepNumber, stepThreshold, p3DOCmin, p3DOCmax
示例6: run
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def run():
''' If someone tries to run this file by itself, warn them of their error. Unfortunately, since I was too lazy to make Microscope_Calibrations a full plugin (rather than a script), this accompanying settings file will show up in the Scripts menu.'''
from ij.gui import GenericDialog
gd = GenericDialog("Microscope_Calibrations_user_settings.py")
gd.addMessage("This file is only for adding functionality to the plugin 'Microscope Measurement Tools'.\nNothing is done when this settings file is run by itself." )
gd.showDialog()
示例7: Resize
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def Resize(imp):
gd = GenericDialog("Image size")
scales = ["1024","2048","4096"]
gd.addChoice("Choose image size",scales,scales[1])
gd.showDialog()
scale_choice = gd.getNextChoice()
IJ.run(imp,"Scale...", "x=- y=- z=1.0 width="+scale_choice+" height="+scale_choice+" interpolation=Bilinear average process create title=Scaled")
scaled_imp = WindowManager.getImage("Scaled")
return scaled_imp
示例8: _dialog
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def _dialog(self,comment):
gd = GenericDialog(comment)
gd.enableYesNoCancel()
gd.showDialog()
if gd.wasCanceled():
print "user cancelled dialog"
sys.exit(1)
option = gd.wasOKed()
return option
示例9: get_results_filename
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def get_results_filename():
'''Prompt the user to suggest name of the output file.'''
dialog = GenericDialog('Output results file')
dialog.addStringField('Choose name without extension:', 'results')
dialog.showDialog()
name = dialog.getNextString()
if dialog.wasCanceled():
return None
#TODO Check if file exists before and try again?
return name + '.csv'
示例10: run
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def run():
''' If someone tries to run this file by itself, warn them of their error. Unfortunately, since I was too lazy to make Microscope_Calibrations a full plugin (rather than a script), this accompanying settings file will show up in the Scripts menu.'''
from ij.gui import GenericDialog
gd = GenericDialog("Microscope_Calibrations_user_settings.py")
gd.addMessage("This file is only for setting the microscope calibrations and settings for the plugins 'Microscope Measurement Tools'.\nNothing is done when this settings file is run by itself.\nPlease open this file in a text editor instead, to edit the calibrations.\n \n" + \
"The file should reside in a path like the following\n" + \
"Fiji.app/plugins/Scripts/Analyze/Microscope Measurement Tools/Microscope_Calibrations_user_settings.py\n " + "\n" + \
"Changes to the settings file are not automatically picked up by Fiji. The workaround is to\n 1) Quit Fiji.\n 2) Delete the '$py.class' file 'Microscope_Calibrations_user_settings$py.class'\n 3) Open Fiji. Make sure the new settings show up in 'Choose Microscope Calibration'." )
gd.showDialog()
开发者ID:demisjohn,项目名称:Microscope-Measurement-Tools,代码行数:13,代码来源:Microscope_Calibrations_user_settings.py
示例11: getChannels
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def getChannels():
gd = GenericDialog( "Select stack's channels" )
# print gd.getModalityType()
# gd.setModal( False )
# print gd.getModalityType()
color = ["red", "green", "blue"]
gd.addChoice("Channel for mask", color, color[2])
gd.addChoice("Channel for particles", color, color[1])
gd.showDialog()
maskChannel = gd.getNextChoice()
partChannel = gd.getNextChoice()
if gd.wasCanceled():
sys.exit()
return maskChannel, partChannel
示例12: create_selection_dialog
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def create_selection_dialog(image_titles, defaults, title='Select images for processing'):
gd = GenericDialog(title)
# The build in function enumerate() returns two values:
# The index and the value stored in the tuple/list.
for index, default in enumerate(defaults):
# for each loop we add a new choice element to the dialog.
gd.addChoice('Image_'+ str(index + 1), image_titles, image_titles[default])
gd.showDialog()
if gd.wasCanceled():
return None
# This function returns a list.
# _ is used as a placeholder for values we don't use.
# The for loop is used to call gd.getNextChoiceIndex() len(defaults) times.
return [gd.getNextChoiceIndex() for _ in defaults]
示例13: create_selection_dialog
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def create_selection_dialog(image_titles, defaults, title='Select images for processing'):
"""
Show a dialog to select the images to process and return a list of the selected ones (index).
:param image_titles: A list of image titles presented for selection.
:param defaults: The titles to be selected by default.
The length of this list defines the number of selectable images.
:param title: the title of the dialog (default 'Select images for processing').
"""
dialog = GenericDialog(title)
for index, default in enumerate(defaults):
dialog.addChoice('Image_'+ str(index + 1), image_titles, image_titles[default])
dialog.showDialog()
if dialog.wasCanceled():
return None
return [dialog.getNextChoiceIndex() for _ in defaults]
示例14: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def getOptions(imp):
gd = GenericDialog("Correct 3D Drift Options")
channels = []
for ch in range(1, imp.getNChannels()+1 ):
channels.append(str(ch))
gd.addMessage("Select a channel to be used for the registration.")
gd.addChoice(" channel:", channels, channels[0])
gd.addCheckbox("Use virtualstack?", False)
gd.addMessage("This will store the registered hyperstack as an image sequence and\nshould be used if free RAM is less than 2X the size of the hyperstack. ")
gd.showDialog()
if gd.wasCanceled():
return
channel = gd.getNextChoiceIndex() + 1 # zero-based
virtual = gd.getNextBoolean()
return channel, virtual
示例15: get_options
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import showDialog [as 别名]
def get_options():
"""Ask user for input values."""
dlg = GenericDialog("Options for Boxed Heatmap")
dlg.addMessage("Boxed Heatmap settings")
dlg.addMessage("Specify box size:")
dlg.addNumericField("Width", 32, 0)
dlg.addNumericField("Height", 32, 0)
dlg.showDialog()
if dlg.wasCanceled():
print "User canceled dialog."
return None
# Read out the options
boxw = int(dlg.getNextNumber())
boxh = int(dlg.getNextNumber())
return boxw, boxh