title: ImageJ: Open a series of text images as a stack
body: <p>In ImageJ, I can open a series of images (tif, png, jpg, etc.) as a stack by using File>>Import>>Image Sequence...</p>
  
  <p>And I can open a text image (.txt file containing a matrix of pixels) using File>>Import>>Text Image...</p>
  
  <p>But how can I open a series of text images as a stack? </p>
  
  <p>Some people have offered a <a href="http://rsbweb.nih.gov/ij/macros/ImportTextImageSequence.txt" rel="nofollow">Macro</a> that does this, but it does not work very well, because it also opens all of the images individually and, if you have other images open, then those are incorporated into the stack as well (try running the macro twice in a row). </p>
  
  <p>It would be nice if there was a macro or plugin that would import the text images into a single stack (ignoring other open images) and not also bring up the individual images. Basically, it should operate just like Import>>Image Sequence. </p>
  
  <p>Here is the current macro as a starting point, though I'm not sure this is the best place to start. Thanks!</p>
  
  <pre class="lang-bs prettyprint-override"><code>dir = getDirectory("Choose directory");
  list = getFileList(dir);
  run("Close All");
  setBatchMode(true);
  for (i=0; i&lt;list.length; i++) {
     file = dir + list[i];
     run("Text Image... ", "open=&amp;file");
  }
  run("Images to Stack", "use");
  setBatchMode(false);
  </code></pre>