Skip to content

Instantly share code, notes, and snippets.

@miura
Created September 6, 2013 11:21
Show Gist options
  • Save miura/6462538 to your computer and use it in GitHub Desktop.
Save miura/6462538 to your computer and use it in GitHub Desktop.
loading multiple tif files and store them in a list.
'''
loading multiple tif files and store them in a list.
'''
import os
from ij import IJ
from ij.io import DirectoryChooser
def run():
srcDir = DirectoryChooser("Choose!").getDirectory()
IJ.log("directory: "+srcDir)
imps = []
for root, directories, filenames in os.walk(srcDir):
for filename in filenames:
if not filename.endswith(".tif"):
continue
print filename
fullpath = os.path.join(root, filename)
print fullpath
imp = ImagePlus(fullpath)
imps.append(imp)
return imps
imps = run()
print len(imps)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment