Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have previously asked an as yet unanswered question about how to fix an issue with slow import of multigigabyte TIFF image stacks: Slow import of multigigabyte TIF image stacks.

I've been attempting a work-around for this problem by using ImageJ to unpack my TIFF stacks into a directory of files with names of the form "TestStack0001.tif", "TestStack0002.tif", and so forth. I've uploaded an example here: https://www.dropbox.com/sh/hsix254u4046uhz/EundGlze43 (please ignore the apparently faulty preview images!).

Is there a simple way for me to import all of the files in this directory, treating the images as sequential elements in an array? Since I'm hoping to ultimately do this for directories with tens of thousands of files, is there a way of doing this without a slowdown as a function of the directory size?

share|improve this question
You are asking about something like array = Import /@ FileNames["*.tif"]? –  Kuba Aug 5 '13 at 8:53
If this is a matter of the time taken to list all files in the directory this may be helpful. –  Mr.Wizard Aug 5 '13 at 8:56
@Kuba Yes, something just like that. However, are the images imported properly in order of their file names? –  Sparse Pine Aug 5 '13 at 9:10
@Kuba As per a comment by Simon Woods on my previous question, maybe we'd want to write something like Flatten[Image`ImportExportDump`ImageReadTIFF /@ FileNames["*.tif"]]; since this yields a ~20x speedup. –  Sparse Pine Aug 5 '13 at 9:16
"The list of files returned by FileNames is sorted in the order generated by the function Sort. " so it should be. –  Kuba Aug 5 '13 at 9:18
show 2 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.