本文整理汇总了Python中ij.gui.GenericDialog.addMessage方法的典型用法代码示例。如果您正苦于以下问题:Python GenericDialog.addMessage方法的具体用法?Python GenericDialog.addMessage怎么用?Python GenericDialog.addMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.GenericDialog
的用法示例。
在下文中一共展示了GenericDialog.addMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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
示例2: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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
示例3: get_setup
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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
示例4: run
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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()
示例5: run
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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
示例6: main
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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())
示例7: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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
示例8: get_options
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [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
示例9: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [as 别名]
def getOptions():
gd = GenericDialog("Options")
gd.addMessage("Filter Parameters")
gd.addNumericField("Smoothing Parameter", 0.1, 2) # show 2 decimals
gd.addNumericField("Patch radius", 2 , 1)
gd.addNumericField("Search volume radius", 3 , 1)
gd.showDialog()
if gd.wasCanceled():
print "User canceled dialog!"
sys.exit()
# Read out the options
beta = gd.getNextNumber()
patchradius = gd.getNextNumber()
searchradius = gd.getNextNumber()
return beta, patchradius, searchradius
示例10: getRefIdDialog
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [as 别名]
def getRefIdDialog():
gd = GenericDialog("Reference Image")
gd.addMessage("Preparing Turboreg(Rigidbody)\nSpecify image for reference")
gd.addNumericField("Channel (C):", 2, 0)
gd.addNumericField("Slice (Z):", 1, 0)
gd.addNumericField("Frame (T):", 1, 0)
gd.addMessage("Note: All fields start with 1 (not 0)")
gd.showDialog()
#
if gd.wasCanceled():
print "User canceled dialog!"
return
# Read out the options
c = int(gd.getNextNumber())
z = int(gd.getNextNumber())
t = int(gd.getNextNumber())
refId = [c,z,t]
return refId
示例11: get_parameters
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [as 别名]
def get_parameters(p, num_data_sets):
gd = GenericDialog("Correct 3D Drift Options")
gd.addMessage("Found "+str(num_data_sets)+" data sets")
gd.addStringField("analyse", "all");
gd.addMessage("Image analysis parameters:")
for k in p.keys():
gd.addNumericField(k, p[k], 2);
gd.showDialog()
if gd.wasCanceled():
return
to_be_analyzed = gd.getNextString()
for k in p.keys():
p[k] = gd.getNextNumber()
return to_be_analyzed, p
示例12: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [as 别名]
def getOptions(imp):
gd = GenericDialog("Correct 3D Drift Options")
channels = []
for ch in range(1, imp.getNChannels()+1 ):
channels.append(str(ch))
gd.addChoice("Channel for registration:", channels, channels[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.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.showDialog()
if gd.wasCanceled():
return
channel = gd.getNextChoiceIndex() + 1 # zero-based
multi_time_scale = gd.getNextBoolean()
subpixel = gd.getNextBoolean()
process = gd.getNextBoolean()
virtual = gd.getNextBoolean()
dt = gd.getNextNumber()
return channel, virtual, multi_time_scale, subpixel, process
示例13: run
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [as 别名]
def run():
bPrintLog(' ', 0)
bPrintLog('=====================================', 0)
bPrintLog('Running bAlign_Batch_v7', 0)
bPrintLog('=====================================', 0)
if len(sys.argv) < 2:
print " We need a hard-drive folder with .tif stacks as input"
print " Usage: ./fiji-macosx bALign_Batch_7 <full-path-to-folder>/"
# Prompt user for a folder
sourceFolder = DirectoryChooser("Please Choose A Directory Of .tif Files").getDirectory()
if not sourceFolder:
return 0
strippedFolder = sourceFolder.replace(' ', '')
if sourceFolder != strippedFolder:
print 'found a space in specified path. Pease remove spaces and try again.'
print 'path:', sourceFolder
errorDialog = GenericDialog('Align Batch 7 Options')
errorDialog.addMessage('bAlignBatch7 Error !!!')
errorDialog.addMessage('There can not be any spaces in the path.')
errorDialog.addMessage('Please remove spaces and try again.')
errorDialog.addMessage('Offending path is:')
errorDialog.addMessage(sourceFolder)
errorDialog.showDialog()
return 0
else:
sourceFolder = sys.argv[1] #assuming it ends in '/'
if not os.path.isdir(sourceFolder):
bPrintLog('\nERROR: run() did not find folder: ' + sourceFolder + '\n',0)
return 0
if (Options(sourceFolder)):
runOneFolder(sourceFolder)
bPrintLog('=====================================', 0)
bPrintLog('Done bAlign_Batch_v7', 0)
bPrintLog('=====================================', 0)
bPrintLog(' ', 0)
示例14: get_config_file
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [as 别名]
def get_config_file(folder):
'''Returns the config file name.'''
# Get list of files in the selected directory.
files = os.listdir(folder)
# Check if a config file is present in folder.
if default_config in files:
dialog = GenericDialog('Default config file found!')
dialog.addMessage('Use this file for the analysis?\n \n%s' % os.path.join(folder, default_config))
dialog.enableYesNoCancel()
dialog.showDialog()
if dialog.wasCanceled():
return None
elif dialog.wasOKed():
return default_config
else:
open_dialog = OpenDialog('Select a config file', folder, default_config)
return open_dialog.getFileName()
else:
# Ask user to select a config file.
open_dialog = OpenDialog('Select a config file', folder, default_config)
return open_dialog.getFileName()
示例15: get_setup
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addMessage [as 别名]
def get_setup():
'''Returns two ImagePlus objects and a dictionary of properties to copy.'''
dialog = GenericDialog('Copy Properties setup')
dialog.addMessage('Select the source and target image and the properties to copy.')
image_ids = WindowManager.getIDList()
if not image_ids or len(image_ids) < 2:
IJ.showMessage('Two or more images are necessary to use this plugin.')
return [None]*3
image_titles = [WindowManager.getImage(id).getTitle() for id in image_ids]
dialog.addChoice('Source', image_titles, image_titles[0])
dialog.addChoice('Target', image_titles, image_titles[1])
dialog.addCheckbox('Copy Calibration', True)
dialog.addCheckbox('Copy Slice Labels', False)
dialog.showDialog()
if dialog.wasCanceled():
return [None]*3
source = WindowManager.getImage(image_ids[dialog.getNextChoiceIndex()])
target = WindowManager.getImage(image_ids[dialog.getNextChoiceIndex()])
choices = {'cal': dialog.getNextBoolean(),
'labels': dialog.getNextBoolean()
}
return source, target, choices