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


Python io.DirectoryChooser类代码示例

本文整理汇总了Python中ij.io.DirectoryChooser的典型用法代码示例。如果您正苦于以下问题:Python DirectoryChooser类的具体用法?Python DirectoryChooser怎么用?Python DirectoryChooser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: run

def run():
  imp = IJ.getImage()
  if imp is None:
    return
  if not imp.isHyperStack():
    print "Not a hyper stack!"
    return
  if 1 == imp.getNFrames():
    print "There is only one time frame!"
    return
  if 1 == imp.getNSlices():
    print "To register slices of a stack, use 'Register Virtual Stack Slices'"
    return
  dc = DirectoryChooser("Choose target folder")
  target_folder = dc.getDirectory()
  if target_folder is None:
    return # user canceled the dialog
  if not validate(target_folder):
    return
  gd = GenericDialog("Options")
  channels = []
  for ch in range(1, imp.getNChannels()+1 ):
    channels.append(str(ch))
  gd.addChoice("channel:", channels, channels[0])
  gd.showDialog()
  if gd.wasCanceled():
    return
  channel = gd.getNextChoiceIndex() + 1  # zero-based
  vs_imp = create_registered_hyperstack(imp, target_folder, channel)
  vs_imp.show()
开发者ID:Jondeen,项目名称:fiji,代码行数:30,代码来源:Correct_3D_drift.py

示例2: ijGUI

def ijGUI():
	from ij.io import DirectoryChooser
	dc = DirectoryChooser("Choose directory with Stratec files to scrub")
	dir_in = dc.getDirectory()
	dc = DirectoryChooser("Choose directory to write scrubbed files")
	dir_out = dc.getDirectory()
	idle_task_ij (process_files (dir_in, dir_out))
开发者ID:igg,项目名称:ScrubStratec,代码行数:7,代码来源:Scrub_Stratec_.py

示例3: main

def main():
    #filename = sys.argv[1]
    #exportDir = sys.argv[2]

    inputDir = "/mnt/med-groups-lmu/ls1/users/l/lsalomie/"
    defaultName = "lif.lif"
    outputDir = "/home/hajaalin/tmp/lifexporttest"

    filename = OpenDialog("Choose LIF",inputDir,defaultName).getPath()
    if not filename:
        # user canceled dialog
        return
    
    chooser = DirectoryChooser("Choose export directory")
    chooser.setDefaultDirectory(outputDir)
    exportDir = chooser.getDirectory()
    if not exportDir:
        # user canceled dialog
        return

    # EDF parameters
    params = Parameters()
    params.setQualitySettings(params.QUALITY_HIGH)
    params.nScales = 10

    worker = EdfWorker(exportDir,params)

    iterateLif(filename,worker)
开发者ID:UH-LMU,项目名称:lmu-scripts,代码行数:28,代码来源:edf_lif.py

示例4: actionPerformed

    def actionPerformed(self, event):
        dlg = DirectoryChooser("Choose an output directory for the classifier")

        if os.path.exists(self.path):
            dlg.setDefaultDirectory(self.path)

        self.path = dlg.getDirectory()
        IJ.log("Added path: "+self.path)
开发者ID:quantumjot,项目名称:impy-tools,代码行数:8,代码来源:IJClassifier_.py

示例5: run

def run():
  imp = IJ.getImage()
  if imp is None:
    return
  if not imp.isHyperStack():
    print "Not a hyper stack!"
    return
  if 1 == imp.getNFrames():
    print "There is only one time frame!"
    return
  if 1 == imp.getNSlices():
    print "To register slices of a stack, use 'Register Virtual Stack Slices'"
    return

  options = getOptions(imp)
  if options is not None:
    channel, virtual = options
    print "channel="+str(channel)+" virtual="+str(virtual)
  if virtual is True:
    dc = DirectoryChooser("Choose target folder to save image sequence")
    target_folder = dc.getDirectory()
    if target_folder is None:
      return # user canceled the dialog
    if not validate(target_folder):
      return
  else:
    target_folder = None 

  registered_imp= create_registered_hyperstack(imp, channel, target_folder, virtual)
  if virtual is True:
    if 1 == imp.getNChannels():
      ip=imp.getProcessor()
      ip2=registered_imp.getProcessor()
      ip2.setColorModel(ip.getCurrentColorModel())
      registered_imp.show()
    else:
    	registered_imp.copyLuts(imp)
    	registered_imp.show()
  else:
    if 1 ==imp.getNChannels():
    	registered_imp.show()
    else:
    	registered_imp.copyLuts(imp)
    	registered_imp.show()
  
  registered_imp.show()
开发者ID:Ghostqiu,项目名称:fiji,代码行数:46,代码来源:Correct_3D_drift.py

示例6: run

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)
开发者ID:cudmore,项目名称:bob-fiji-plugins,代码行数:40,代码来源:bAlignBatch_v7_2.py

示例7: find_index_greater_zero

	arr1 = [x - mi for x in arr]
	arr2 = [x - ma for x in arr]
	start = find_index_greater_zero(arr1)
	end = find_index_greater_zero(arr2)
	length = end-start+1
	return [start,end,length]

def make_tile_series(xs,ys,xlen,ylen):
	arr = []
	for y in range(ys[0],ys[1]+1):
		arr.extend(range(xlen*y+xs[0],xlen*y+xs[1]+1))
	arr = [m+1 for m in arr]
	return arr

##### Sets directory of full-res tiles and gets metadata ######
dc = DirectoryChooser("Choose directory where full-res tiles are stored...")
imgDir = dc.getDirectory()
metadata = IJ.openAsString(imgDir+"tile_info.txt")
p = re.compile(r'X Tiles: (\d+)')
m = p.search(metadata)
if m is None:
	xtiles = 0
else:
	xtiles = int(m.group(1))
p = re.compile(r'Y Tiles: (\d+)')
m = p.search(metadata)
if m is None:
	ytiles = 0
else:
	ytiles = int(m.group(1))
if not os.path.exists(imgDir + "temp"):
开发者ID:stalepig,项目名称:deep-mucosal-imaging,代码行数:31,代码来源:Explore_full_resolution.py

示例8: calculate_memory_recs

		theSize = os.path.getsize(theFile)
		sumSize = sumSize + theSize
	return sumSize

def calculate_memory_recs(dirsize,maxmem):
	values = []
	maxchannel = maxmem / 10
	maxtot = long(maxmem * 0.3)
	for i in range(1,6):
		if (maxtot/i > maxchannel):
			values.append((maxchannel*i)/1048576)
		else:
			values.append(maxtot/1048576)
	return values

dc = DirectoryChooser("Choose directory with OME.TIF files...")
sourceDir = dc.getDirectory()

if not(sourceDir is None):
	if not os.path.exists(sourceDir + "resized"):
		os.mkdir(sourceDir + "resized")

	dirSize = get_directory_size(sourceDir)
	dirSizeMB = dirSize / 1048576
	memoryObj = Memory()
	memFiji = memoryObj.maxMemory()
	memFijiMB = memFiji / 1048576

	gd = GenericDialog("Set Parameters...")
	gd.addNumericField("Sizing_ratio (Final disk space / Initial disk space):",0.25,2)
	gd.addMessage("Directory size: " + str(dirSizeMB) + "MB")
开发者ID:stalepig,项目名称:deep-mucosal-imaging,代码行数:31,代码来源:Batch_resizer.py

示例9: DirectoryChooser

from ij.io import DirectoryChooser
from ij.gui import GenericDialog
from ij import IJ
from ij import WindowManager
import os
import glob

dirChooser = DirectoryChooser("Choose directory of images to normalize...")
dirPath = dirChooser.getDirectory()
scaleXs = []
if dirPath is not None:
	if not os.path.exists(dirPath + "resized"):
		os.mkdir(dirPath + "resized")

	gd = GenericDialog("Settings...")
	gd.addNumericField("Final scale factor:",0.5,2)
	gd.addCheckbox("Convert multichannel to RGB:",True)
	gd.showDialog()
	if (gd.wasOKed()):
		common_scale = gd.getNextNumber()
		convert_to_rgb = gd.getNextBoolean()
		filecollection = glob.glob(os.path.join(dirPath, '*.tif'))
		if (len(filecollection) > 0):
			for path in filecollection:
				theImage = IJ.openImage(path)
				calibration = theImage.getCalibration()
				scaleXs.append(calibration.pixelWidth)
				theImage.close()
			lc_scale = max(scaleXs)
			print lc_scale
			for path in filecollection:
开发者ID:stalepig,项目名称:deep-mucosal-imaging,代码行数:31,代码来源:Normalize_image_sizes.py

示例10: selectInputDir

	def selectInputDir(self):
		inputDialog = DirectoryChooser("Please select a directory contaning your images")
		inputDir = inputDialog.getDirectory()
		for imageFile in os.listdir(inputDir):
			self.files.append(inputDir + imageFile)
开发者ID:rejsmont,项目名称:FijiScripts,代码行数:5,代码来源:mColoc3D.py

示例11: run

def run():

  IJ.log("Correct_3D_Drift")
    
  imp = IJ.getImage()
  if imp is None:
    return
  if 1 == imp.getNFrames():
    print "There is only one time frame!"
    return

  options = getOptions(imp)
  if options is not None:
    channel, virtual, multi_time_scale, subpixel, process, only_compute = options
    
  if virtual is True:
    dc = DirectoryChooser("Choose target folder to save image sequence")
    target_folder = dc.getDirectory()
    if target_folder is None:
      return # user canceled the dialog
    if not validate(target_folder):
      return
  else:
    target_folder = None 

  # compute shifts
  IJ.log("  computing drifts..."); print("\nCOMPUTING SHIFTS:")

  IJ.log("    at frame shifts of 1"); 
  dt = 1; shifts = compute_and_update_frame_translations_dt(imp, channel, dt, process)
  
  # multi-time-scale computation
  if multi_time_scale is True:
    dt_max = imp.getNFrames()-1
    # computing drifts on exponentially increasing time scales 3^i up to 3^6
    # ..one could also do this with 2^i or 4^i
    # ..maybe make this a user choice? did not do this to keep it simple.
    dts = [3,9,27,81,243,729,dt_max] 
    for dt in dts:
      if dt < dt_max:
        IJ.log("    at frame shifts of "+str(dt)) 
        shifts = compute_and_update_frame_translations_dt(imp, channel, dt, process, shifts)
      else: 
        IJ.log("    at frame shifts of "+str(dt_max));
        shifts = compute_and_update_frame_translations_dt(imp, channel, dt_max, process, shifts)
        break

  # invert measured shifts to make them the correction
  shifts = invert_shifts(shifts)
  print(shifts)
  
  
  # apply shifts
  if not only_compute:
    
    IJ.log("  applying shifts..."); print("\nAPPLYING SHIFTS:")
    
    if subpixel:
      registered_imp = register_hyperstack_subpixel(imp, channel, shifts, target_folder, virtual)
    else:
      shifts = convert_shifts_to_integer(shifts)
      registered_imp = register_hyperstack(imp, channel, shifts, target_folder, virtual)
    
    
    if virtual is True:
      if 1 == imp.getNChannels():
        ip=imp.getProcessor()
        ip2=registered_imp.getProcessor()
        ip2.setColorModel(ip.getCurrentColorModel())
        registered_imp.show()
      else:
    	registered_imp.copyLuts(imp)
    	registered_imp.show()
    else:
      if 1 ==imp.getNChannels():
        registered_imp.show()
      else:
        registered_imp.copyLuts(imp)
        registered_imp.show()
  
    registered_imp.show()
  
  else:
   
    if imp.getRoi(): 
      xmin = imp.getRoi().getBounds().x
      ymin = imp.getRoi().getBounds().y
      zmin = 0
      xmax = xmin + imp.getRoi().getBounds().width - 1
      ymax = ymin + imp.getRoi().getBounds().height - 1
      zmax = imp.getNSlices()-1  
    else:
      xmin = 0
      ymin = 0
      zmin = 0
      xmax = imp.getWidth() - 1
      ymax = imp.getHeight() - 1
      zmax = imp.getNSlices() - 1  
    
    save_shifts(shifts, [xmin, ymin, zmin, xmax, ymax, zmax])
#.........这里部分代码省略.........
开发者ID:tischi,项目名称:fiji-correct-3d-drift,代码行数:101,代码来源:Correct_3D_Drift_Plus--ImgLib2.py

示例12: DirectoryChooser

import glob
import os.path

from ij import IJ, ImagePlus, ImageStack, WindowManager
from ij.io import DirectoryChooser

from edfgui import ExtendedDepthOfField, Parameters

dc = DirectoryChooser("Set input directory")
files = glob.glob(dc.getDirectory() + "/*.tiff")

dc = DirectoryChooser("Set output directory")
outputDir = dc.getDirectory()

# EDF parameters
params = Parameters()
params.setQualitySettings(params.QUALITY_HIGH)

for f in files:
    imp = ImagePlus(f)

    # output name
    head,tail = os.path.split(f)
    base,ext = os.path.splitext(tail)
    output = os.path.join(outputDir,base + "_edf.tif")
    print output

    # make all-in-focus image
    edf = ExtendedDepthOfField(imp,params)
    edf.process()
开发者ID:UH-LMU,项目名称:lmu-scripts,代码行数:30,代码来源:edf_batch.py

示例13: range

		except:
			IJ.log("failed")
			os.rmdir(outputName)
			wList = WindowManager.getIDList()
			for i in range(len(wList)):
				currImage = WindowManager.getImage(wList[i])
				currImage.close()
			returnVal = 1
	else:
		IJ.log("skipped")
		returnVal = 2

	return returnVal
	

dc = DirectoryChooser("Choose root directory")
rootPath = dc.getDirectory()
if rootPath is not None:
	gd = GenericDialog("Batch mode options...")
	gd.addStringField("Filename extension","lsm",6)
	gd.showDialog()
	if (gd.wasOKed()):
		extension = gd.getNextString()
		for root, dirs, files in os.walk(rootPath):
			LSMfiles = filter(lambda x: check_if_filetype(x,extension),files)
			if len(LSMfiles)>0:
				LSMpaths = map(lambda x: generate_path(x,root),LSMfiles)
				explodeStatuses = map(run_explode,LSMpaths)
				resizePaths = map(get_first_in_tuple,filter(filter_by_return_status,map(lambda x,y:(x,y),LSMpaths,explodeStatuses)))
				if len(resizePaths)>0:
					resizeStatuses = map(run_resize,resizePaths)
开发者ID:stalepig,项目名称:deep-mucosal-imaging,代码行数:31,代码来源:Walk_ERSC.py

示例14: get_files_and_analyze

def get_files_and_analyze(folder):

  count = 0
  timeseries = []
  for root, directories, filenames in os.walk(folder):
    #print directories
    for directory in sorted(directories):
      #print directory
      if not (("field" in directory)): # "field is specific to the folder where the image files are"
        continue
      else:
        print os.path.join(root, directory)
        analyze(os.path.join(root, directory), 3, 7, 1)

  
          
if __name__ == '__main__':
  dc = DirectoryChooser("Choose top directory containing all Matrix Screener images")
  foldername = dc.getDirectory()
  #od = OpenDialog("Click on one of the image files in the folder to be analysed", None	)
  #filename = od.getFileName()
  #foldername = od.getDirectory()
  #print foldername
  
  print "\n\n\n\n\n\n"
  
  #foldername = "/g/almf/software/scripts/imagej/Data_MatrixScreenerImport"
  
  if None != foldername:
    print "foldername = "+foldername
    get_files_and_analyze(foldername)
开发者ID:tischi,项目名称:scripts,代码行数:31,代码来源:2015-11-25--Tischi--Load_zProject_Save_MatrixScreenerData.py

示例15: reload

homedir=IJ.getDirectory('imagej')
jythondir=os.path.join(homedir,'plugins/Evalulab/')
jythondir=os.path.abspath(jythondir)
sys.path.append(jythondir)

import PoreDetectionTrueColor
reload(PoreDetectionTrueColor)
from PoreDetectionTrueColor import runPoreDetection

import MessageStrings
reload(MessageStrings)
from MessageStrings import Messages

import Utility
reload(Utility)

if __name__ == '__main__':
	dlg=DirectoryChooser(Messages.ChooseImageDirectory)
	print dlg.getDirectory()

	imageList=Utility.getImageListFromDirectory(dlg.getDirectory())

	for imageName in imageList:
		fullImageName=os.path.join(dlg.getDirectory(), imageName)
		image=IJ.openImage(fullImageName)
		image.show()
		runPoreDetection(image, data, ops, display)
		image.close()
		
	
开发者ID:bnorthan,项目名称:TrueNorthImageJScripts,代码行数:28,代码来源:PoreDetectionTCBatch_.py


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