当前位置: 首页>>代码示例>>Python>>正文


Python GenericDialog.getNextChoice方法代码示例

本文整理汇总了Python中ij.gui.GenericDialog.getNextChoice方法的典型用法代码示例。如果您正苦于以下问题:Python GenericDialog.getNextChoice方法的具体用法?Python GenericDialog.getNextChoice怎么用?Python GenericDialog.getNextChoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.gui.GenericDialog的用法示例。


在下文中一共展示了GenericDialog.getNextChoice方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [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())
开发者ID:m-entrup,项目名称:EFTEMj,代码行数:34,代码来源:Gatan_Renamer.py

示例2: Resize

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [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
开发者ID:martlj,项目名称:Fiji-scripts,代码行数:11,代码来源:ConvertTo8Bit_.py

示例3: make_directory

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [as 别名]
def make_directory(imgDir):
    """ Makes the necessary output directories or overwrites current ones. """
    if not path.exists(imgDir) or not path.isdir(imgDir):
        print "Not a valid directory"
        exit(0)

    if not path.exists(imgDir+"/binary"):
        mkdir(imgDir+"/binary")

    else:
    	gd = GenericDialog("Confirm Overwrite")
    	choices = ["Yes", "No"]
    	gd.addChoice("Overwrite \"binary\" folder?", choices, choices[0])
    	gd.showDialog()
    	if gd.wasCanceled():
    		exit(0)
    	choice = gd.getNextChoice()
    	if choice == "No":
    		exit(0)
    	shutil.rmtree(imgDir+"/binary")
    	mkdir(imgDir+"/binary")


    if not path.exists(imgDir+"/greyscale"):
        mkdir(imgDir+"/greyscale")

    else:
    	gd = GenericDialog("Confirm Overwrite")
    	choices = ["Yes", "No"]
    	gd.addChoice("Overwrite \"greyscale\" folder?", choices, choices[0])
    	gd.showDialog()
    	if gd.wasCanceled():
    		exit(0)
    	choice = gd.getNextChoice()
    	if choice == "No":
    		exit(0)
    	shutil.rmtree(imgDir+"/greyscale")
    	mkdir(imgDir+"/greyscale")
开发者ID:jsegert,项目名称:Bio119_root_tracking,代码行数:40,代码来源:Straighten+Root+Stack_.py

示例4: getChannels

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [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
开发者ID:mgrrwu,项目名称:IPMon,代码行数:16,代码来源:LargoCilia.py

示例5: getOptionsDialog

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [as 别名]
	def getOptionsDialog(self, imp):
		thr_methods = ["None", "Default", "Huang", "Intermodes", "IsoData",  "Li", "MaxEntropy","Mean", "MinError(I)", "Minimum", "Moments", "Otsu", "Percentile", "RenyiEntropy", "Shanbhag" , "Triangle", "Yen"]
		gd = GenericDialog("Please select channels to collocalize")
		for i in range(1, imp.getNChannels() + 1):
			gd.addChoice("Threshold method for channel %i" % i, thr_methods, "None")
		gd.showDialog()
		if gd.wasCanceled():
			self.exit()
		channels = []
		for i in range(1, imp.getNChannels() + 1):
			method = gd.getNextChoice()
			self.methods.append(method)
			if method != "None":
				channels.append(i)
		for x in channels:
			for y in channels:
				if x < y:
					self.pairs.append((x, y))
开发者ID:rejsmont,项目名称:FijiScripts,代码行数:20,代码来源:mColoc3D.py

示例6: Options

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [as 别名]
def Options(sourceFolder):
	#globals
	global gFileType
	global gGetNumChanFromScanImage
	global gNumChannels
		
	global gDoAlign
	global gAlignThisChannel
	
	global gDoCrop
	global gCropLeft
	global gCropTop
	global gCropWidth
	global gCropHeight
	
	global gAlignOnMiddleSlice
	global gAlignOnThisSlice
	global gRemoveCalibration
	global gLinearShift
	global gSave8bit

	tifNames = [file.name for file in File(sourceFolder).listFiles(Filter())]
	lsmNames = [file.name for file in File(sourceFolder).listFiles(Filter_LSM())]
	
	numTifs = len(tifNames)
	numLSM = len(lsmNames)

	gd = GenericDialog('Align Batch 7 Options')
	#gd.addStringField('Command: ', '')

	gd.addMessage('Source Folder: ' + sourceFolder)
	gd.addMessage('Number of .tif files: ' + str(numTifs))
	gd.addMessage('Number of .lsm files: ' + str(numLSM))
	
	gd.addChoice('File Type', ['tif','lsm'], gFileType)
	
	#gd.setInsets(5,0,3)
	#0
	gd.addCheckboxGroup(1, 1, ['Get Number Of Channels From ScanImage 3.x or 4.x header'], [gGetNumChanFromScanImage], ['Channels'])
	gd.addNumericField('Otherwise, Assume All Stacks Have This Number Of Channels: ', gNumChannels, 0)

	print gLinearShift
	
	#1
	gd.addCheckboxGroup(1, 1, ['Remove Linear Calibration From ScanImage 4.x'], [gRemoveCalibration], ['ScanImage4'])
	gd.addNumericField('And offset (subtract) by this amount: ', gLinearShift, 0)
	gd.addMessage('20151110, this number = 2^15-512 = 32768-512 = 32256')
	
	#2
	gd.addCheckboxGroup(1, 1, ['Crop All Images (pixels)'], [gDoCrop], ['Crop'])
	gd.addNumericField('Left', gCropLeft, 0)
	gd.addNumericField('Top', gCropTop, 0)
	gd.addNumericField('Width', gCropWidth, 0)
	gd.addNumericField('Height', gCropHeight, 0)

	#gd.setInsets(5,0,3)
	#3
	gd.addCheckboxGroup(1, 1, ['Run MultiStackReg'], [gDoAlign], ['MultStackReg'])
	gd.addNumericField('If 2 Channels Then Align On This Channel', gAlignThisChannel, 0)
	
	#4
	gd.addCheckboxGroup(1, 1, ['Start Alignment On Middle Slice'], [gAlignOnMiddleSlice], ['Align On Middle Slice'])
	gd.addNumericField('Otherwise, Start Alignment On This Slice', gAlignOnThisSlice, 0)

	#5
	gd.addCheckboxGroup(1, 1, ['Save 8-bit'], [gSave8bit], ['Save 8-bit (at end)'])
	#gd.addCheckbox('Save 8-bit', gSave8bit)
	
	gd.showDialog()

	if gd.wasCanceled():
		print 'Options Was Cancelled by user'
		return 0
	else:
		print 'Reading values'
		gFileType = gd.getNextChoice()
		
		gNumChannels = int(gd.getNextNumber())

		gLinearShift = int(gd.getNextNumber())

		gCropLeft = int(gd.getNextNumber())
		gCropTop = int(gd.getNextNumber())
		gCropWidth = int(gd.getNextNumber())
		gCropHeight = int(gd.getNextNumber())

		gAlignThisChannel = int(gd.getNextNumber())
		gAlignOnThisSlice = int(gd.getNextNumber())

		checks = gd.getCheckboxes()
		checkIdx = 0
		for check in checks:
			#print check.getState()
			if checkIdx==0:
				gGetNumChanFromScanImage = check.getState()
			if checkIdx==1:
				gRemoveCalibration = check.getState()
			if checkIdx==2:
				gDoCrop = check.getState()
			if checkIdx==3:
#.........这里部分代码省略.........
开发者ID:cudmore,项目名称:bob-fiji-plugins,代码行数:103,代码来源:bAlignBatch_v7_1.py

示例7: reduce

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [as 别名]
		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])):
				rescaledTup = [objectDB[i][j][27]/scale_info[0],objectDB[i][j][28]/scale_info[0],objectDB[i][j][29],objectDB[i][j][30]/scale_info[0],objectDB[i][j][31]/scale_info[0],objectDB[i][j][32]]
开发者ID:stalepig,项目名称:deep-mucosal-imaging,代码行数:33,代码来源:Display_found_objects.py

示例8: main_interactive

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [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))
开发者ID:KaiSchleicher,项目名称:imcf-toolbox,代码行数:68,代码来源:FluoView_OIF_OIB_Stitcher.py

示例9: dialog

# 需要导入模块: from ij.gui import GenericDialog [as 别名]
# 或者: from ij.gui.GenericDialog import getNextChoice [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
开发者ID:quantumjot,项目名称:impy-tools,代码行数:84,代码来源:IJClassifier_.py


注:本文中的ij.gui.GenericDialog.getNextChoice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。