本文整理汇总了Python中ij.gui.GenericDialog.addSlider方法的典型用法代码示例。如果您正苦于以下问题:Python GenericDialog.addSlider方法的具体用法?Python GenericDialog.addSlider怎么用?Python GenericDialog.addSlider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.GenericDialog
的用法示例。
在下文中一共展示了GenericDialog.addSlider方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getOptions
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addSlider [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
示例2: run
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addSlider [as 别名]
def run(title):
gd = GenericDialog("Record Window")
gd.addMessage("Maximum number of frames to record.\nZero means infinite, interrupt with ESC key.")
gd.addNumericField("Max. frames:", 50, 0)
gd.addNumericField("Milisecond interval:", 300, 0)
gd.addSlider("Start in (seconds):", 0, 20, 5)
frames = []
titles = []
for f in Frame.getFrames():
if f.isEnabled() and f.isVisible():
frames.append(f)
titles.append(f.getTitle())
gd.addChoice("Window:", titles, titles[0])
gd.addCheckbox("To file", False)
gd.showDialog()
if gd.wasCanceled():
return
n_frames = int(gd.getNextNumber())
interval = gd.getNextNumber() / 1000.0 # in seconds
frame = frames[gd.getNextChoiceIndex()]
delay = int(gd.getNextNumber())
tofile = gd.getNextBoolean()
dir = None
if tofile:
dc = DirectoryChooser("Directory to store image frames")
dir = dc.getDirectory()
if dir is None:
return # dialog canceled
snaps = []
borders = None
executors = Executors.newFixedThreadPool(1)
try:
while delay > 0:
IJ.showStatus("Starting in " + str(delay) + "s.")
time.sleep(1) # one second
delay -= 1
IJ.showStatus("Capturing frame borders...")
bounds = frame.getBounds()
robot = Robot()
frame.toFront()
time.sleep(0.5) # half a second
borders = robot.createScreenCapture(bounds)
IJ.showStatus("Recording " + frame.getTitle())
# Set box to the inside borders of the frame
insets = frame.getInsets()
box = bounds.clone()
box.x = insets.left
box.y = insets.top
box.width -= insets.left + insets.right
box.height -= insets.top + insets.bottom
start = System.currentTimeMillis() / 1000.0 # in seconds
last = start
intervals = []
real_interval = 0
i = 1
fus = None
if tofile:
fus = []
# 0 n_frames means continuous acquisition
while 0 == n_frames or (len(snaps) < n_frames and last - start < n_frames * interval):
now = System.currentTimeMillis() / 1000.0 # in seconds
real_interval = now - last
if real_interval >= interval:
last = now
img = snapshot(frame, box)
if tofile:
fus.append(executors.submit(Saver(i, dir, bounds, borders, img, insets))) # will flush img
i += 1
else:
snaps.append(img)
intervals.append(real_interval)
else:
time.sleep(interval / 5)
# interrupt capturing:
if IJ.escapePressed():
IJ.showStatus("Recording user-interrupted")
break
# debug:
# print "insets:", insets
# print "bounds:", bounds
# print "box:", box
# print "snap dimensions:", snaps[0].getWidth(), snaps[0].getHeight()
# Create stack
stack = None
if tofile:
for fu in snaps:
fu.get() # wait on all
stack = VirtualStack(bounds.width, bounds.height, None, dir)
files = File(dir).list(TifFilter())
Arrays.sort(files)
for f in files:
#.........这里部分代码省略.........
示例3: snapshot
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addSlider [as 别名]
# Take a snapshot after a delay specified in a dialog
#
# The plugin has to fork, which is done by:
# 1 - declaring a function to do the work, 'snasphot'
# 2 - invoking the function via thread.start_new_thread,
# which runs it in a separate thread.
from ij import IJ
from ij.gui import GenericDialog
import thread
import time
def snapshot(delay):
time.sleep(delay)
IJ.doCommand('Capture Screen')
gd = GenericDialog('Delay')
gd.addSlider('Delay (secs.): ', 0, 20, 5)
gd.showDialog()
if not gd.wasCanceled():
# the 'extra' comma signals tuple, a kind of list in python.
thread.start_new_thread(snapshot, (int(gd.getNextNumber()),))
示例4: int
# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import addSlider [as 别名]
from java.awt.event import AdjustmentListener
from java.lang import Math, System
image = WindowManager.getCurrentImage()
ip = image.getProcessor()
pixelsCopy = ip.getPixelsCopy()
pixels = ip.getPixels()
width = ip.getWidth()
height = ip.getHeight()
minWidth = int(Math.sqrt(len(pixels) / 16))
maxWidth = minWidth * 16
class Listener(AdjustmentListener):
def adjustmentValueChanged(self, event):
value = event.getSource().getValue()
rowstride = min(width, value)
for j in range(0, min(height, int(width * height / value))):
System.arraycopy(pixelsCopy, j * value,
pixels, j * width, rowstride)
image.updateAndDraw()
gd = GenericDialog("Width")
gd.addSlider("width", minWidth, maxWidth, ip.getHeight())
gd.getSliders().get(0).addAdjustmentListener(Listener())
gd.showDialog()
if gd.wasCanceled():
pixels[0:width * height] = pixelsCopy
image.updateAndDraw()