1
votes

It seems that there is no official plugin at ImageJ or Fiji on how to import text image sequence. As I searched, it just possible by using macros. I found this script by searching:

dir = getDirectory("Choose directory");
list = getFileList(dir);
run("Close All");
setBatchMode(true);
for (i=0; i<list.length; i++) {
 file = dir + list[i];
 run("Text Image... ", "open=&file");
}
run("Images to Stack", "use");
setBatchMode(false);

I tried to use this script, so I saved it in a text file (ImportTextImageSequence.txt). Then opened Fiji, Plugins>Macros>Install... and select above text file. I saw a short message afterwards:

1 macro installed.

Then I went to Plugins>Macros>Run... and again chose the .ijm installed file (ImportTextImageSequence.ijm) at '/opt/Fiji/plugins/'. A new window was opened with title "Choose directory". It looks the macro is working, but I do not know which directory I should choose afterwards. I tried to choose the directory containing my text images (image_01.txt, image_02.txt, ...) but it gave me this error message:

Line 2 is not the same length as the first line.

Also, when I tried to open by File>Import>Image Sequence..., I saw this message:

The folder does not apper to contain any TIFF, JPEG, BMP, DICOM, GIF, FITS or PGM files.

which means that text image sequence is not installed at this part of Fiji at least.

I searched a lot but could not find anyone has explained the procedure in details. I am novice on using macros in Fiji. Maybe I'm missing some simple things. I would be thankful if anyone can help me.

P.S. My Fiji is updated at CentOS 7 and I used it earlier without any problems in image processing and also importing TIFF image sequences.

1
Your macro worked for me when I was running it from the script editor and tested it on the Blobs sample image after saving it via File > Save As > Text Image... several times with different names in a new folder. Did you try opening one of your images manually? The error message indicates that the contents of one of your files is incompatible (different number of entries per line). - Jan Eglinger
It becomes solved finally! You are right. Actually, my text images were the same and compatible because I could open all manually. I created a new folder and just put the text image file in that, and it works. Previously, there were other files as well in the folder, and I guess the macro read those unrelated files first. So that's why I got the error message about inconsistency between line 1 and 2. So I think it is safer put all text image files exclusively in one specific folder. Thanks so much for your help. - Amir

1 Answers

0
votes

The problem finally becomes solved!

I created a new folder and just put the text image files in that, and it works. Previously, there were other files in the folder as well, and I guess the macro read those unrelated files first. So that's why I got the error message about inconsistency between line 1 and 2:

Line 2 is not the same length as the first line.

In sum, I suggest any who wish to use this macro that it is safer put all text image files exclusively in one specific folder, and do not put other files in that folder. These steps is sufficient to run the macro: Plugins>Macros>Run...

As I mentioned before, a new window will be opened and you just need to select the folder that contains all the text image files.