本文整理汇总了Python中ij.gui.GenericDialog.wasOKed方法的典型用法代码示例。如果您正苦于以下问题:Python GenericDialog.wasOKed方法的具体用法?Python GenericDialog.wasOKed怎么用?Python GenericDialog.wasOKed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.GenericDialog
的用法示例。
在下文中一共展示了GenericDialog.wasOKed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _dialog
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import wasOKed [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
示例2: get_config_file
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import wasOKed [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()
示例3: GenericDialog
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import wasOKed [as 别名]
# Asks for parameters
gd = GenericDialog("Set Parameters...")
gd.addNumericField("Start tile:",1,0)
gd.addNumericField("Finish tile:",9,0)
gd.addNumericField("Final disk space / Initial disk space:",0.25,2)
gd.addNumericField("Step size (higher is faster but uses more memory):",10,0)
gd.showDialog()
startTile = int(gd.getNextNumber())
finishTile = int(gd.getNextNumber())
ratioRaw = gd.getNextNumber()
ratio = math.sqrt(ratioRaw)
stepSize = int(gd.getNextNumber())
# Performs scaling
if (gd.wasOKed()):
anchorTiles = range(startTile,finishTile+1,stepSize)
print anchorTiles
for i in anchorTiles:
if (i+stepSize-1 > finishTile):
lastAnchorTile = finishTile
else:
lastAnchorTile = i+stepSize-1
iterTiles = range(i,lastAnchorTile+1)
params = "open=[" + theFilePath + "] color_mode=Default view=Hyperstack stack_order=XYCZT series_list=" + str(i) + "-" + str(lastAnchorTile)
print params
IJ.run("Bio-Formats Importer", params)
imageIDList = WindowManager.getIDList()
if (len(imageIDList) == len(iterTiles)):
count = 0
示例4: reduce
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import wasOKed [as 别名]
IJ.showStatus("Computing...")
computedImage = reduce(self.addImages,imgList)
computedImage.show()
IJ.showStatus("Ready")
## Main body of script
opener = OpenDialog("Select parent LSM file...")
parentLSMFilePath = opener.getPath()
if (parentLSMFilePath is not None):
stackInfo = parse_tile_info_file(parentLSMFilePath + "_tiles/tile_info.txt")
channelTexts = map(lambda x: str(x), filter(lambda x:os.path.isfile(parentLSMFilePath+"_tiles/objects/C"+str(x)+".objects.keep.unique.csv"),range(1,stackInfo[0]+1)))
gd = GenericDialog("Specify parameters...")
gd.addChoice("Which_channel",channelTexts,channelTexts[0])
gd.showDialog()
if gd.wasOKed():
channel = int(gd.getNextChoice())
## Obtains global coordinate system for tiles
scale_info = estimate_scale_multiplier(parentLSMFilePath+"_tiles/tile_1.ome.tif",parentLSMFilePath+"_tiles/resized/tile_1.tif")
## Parses each of the object files
objectDB = [[] for x in range(4)]
objectDB[0] = parse_object_file_into_db(parentLSMFilePath+"_tiles/objects/C"+str(channel)+".objects.keep.contained.csv")
objectDB[1] = parse_object_file_into_db(parentLSMFilePath+"_tiles/objects/C"+str(channel)+".objects.keep.duplicated.csv")
objectDB[2] = parse_object_file_into_db(parentLSMFilePath+"_tiles/objects/C"+str(channel)+".objects.keep.restitched.csv")
objectDB[3] = parse_object_file_into_db(parentLSMFilePath+"_tiles/objects/C"+str(channel)+".objects.keep.unique.csv")
## Converts object global coordinates to rescaled coordinates
for i in range(len(objectDB)):
for j in range(len(objectDB[i])):
示例5: str
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import wasOKed [as 别名]
sizeGD.addNumericField("Tile overlap percentage",10,0)
sizeGD.addCheckbox("Write fused image sequence to disk",False)
sizeGD.showDialog()
doComputeOverlap = sizeGD.getNextBoolean()
overlapPctStr = str(sizeGD.getNextNumber())
doWriteToDisk = sizeGD.getNextBoolean()
if (doComputeOverlap):
overlapText = "compute_overlap ignore_z_stage"
else:
overlapText = ""
if (doWriteToDisk):
outputPath = imgDir + "substitched"
diskWriteText = "image_output=[Write to disk] output_directory=[" + outputPath + "]"
else:
diskWriteText = "image_output=[Fuse and display]"
if (sizeGD.wasOKed()):
for t in tiles:
shutil.copyfile(imgDir+"tile_"+str(t)+".ome.tif",imgDir+"temp/tile_"+str(ind)+".ome.tif")
ind = ind + 1
IJ.showStatus("Beginning stitch...")
params = ("type=[Grid: row-by-row] order=[Right & Down ] grid_size_x=" +
str(xs[2]) + " grid_size_y=" + str(ys[2]) + " tile_overlap=" + overlapPctStr + " first_file_index_i=1 directory=[" +
imgDir + "temp] file_names=tile_{i}.ome.tif output_textfile_name=TileConfiguration.txt " +
"fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 " +
"absolute_displacement_threshold=3.50 " + overlapText + " subpixel_accuracy " +
"computation_parameters=[Save memory (but be slower)] " + diskWriteText)
IJ.run("Grid/Collection stitching", params)
gd = NonBlockingGenericDialog("Explore full resolution...")
gd.addMessage("Select ROI for visualization at full resolution")
gd.showDialog()
示例6: main_interactive
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import wasOKed [as 别名]
def main_interactive():
"""The main routine for running interactively."""
log.info('Running in interactive mode.')
(base, fname) = ui_get_input_file()
if (base is None):
return
log.warn("Parsing project file: %s" % (base + fname))
IJ.showStatus("Parsing experiment file...")
mosaics = fv.FluoViewMosaic(join(base, fname), runparser=False)
IJ.showStatus("Parsing mosaics...")
progress = 0.0
count = len(mosaics.mosaictrees)
step = 1.0 / count
for subtree in mosaics.mosaictrees:
IJ.showProgress(progress)
mosaics.add_mosaic(subtree)
progress += step
IJ.showProgress(progress)
IJ.showStatus("Parsed %i mosaics." % len(mosaics))
dialog = GenericDialog('FluoView OIF / OIB Stitcher')
if len(mosaics) == 0:
msg = ("Couldn't find any (valid) mosaics in the project file.\n"
" \n"
"Please make sure to have all files available!\n"
" \n"
"Will stop now.\n")
log.warn(msg)
dialog.addMessage(msg)
dialog.showDialog()
return
msg = "------------------------ EXPORT OPTIONS ------------------------"
dialog.addMessage(msg)
formats = ["OME-TIFF", "ICS/IDS"]
dialog.addChoice("Export Format", formats, formats[0])
dialog.addCheckbox("separate files by Z slices (OME-TIFF only)?", False)
msg = "------------------------ EXPORT OPTIONS ------------------------"
dialog.addMessage(msg)
dialog.addMessage("")
dialog.addMessage("")
msg = gen_mosaic_details(mosaics)
log.warn(msg)
msg += "\n \nPress [OK] to write tile configuration files\n"
msg += "and continue with running the stitcher."
dialog.addMessage(msg)
dialog.showDialog()
opts = {}
if dialog.getNextChoice() == 'ICS/IDS':
opts['export_format'] = '".ids"'
else:
opts['export_format'] = '".ome.tif"'
if dialog.getNextBoolean() == True:
opts['split_z_slices'] = 'true'
code = imagej.gen_stitching_macro_code(mosaics, 'templates/stitching',
path=base, tplpath=imcftpl, opts=opts)
log.warn("============= generated macro code =============")
log.warn(flatten(code))
log.warn("============= end of generated macro code =============")
if dialog.wasOKed():
log.warn('Writing stitching macro.')
imagej.write_stitching_macro(code, fname='stitch_all.ijm', dname=base)
log.warn('Writing tile configuration files.')
imagej.write_all_tile_configs(mosaics, fixsep=True)
log.warn('Launching stitching macro.')
IJ.runMacro(flatten(code))