Skip to content

Instantly share code, notes, and snippets.

@miyanari
Forked from miura/tiff_loder.py
Created September 6, 2013 11:46
Show Gist options
  • Save miyanari/6462738 to your computer and use it in GitHub Desktop.
Save miyanari/6462738 to your computer and use it in GitHub Desktop.
'''
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