open text image sequence

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

open text image sequence

Christoph Waltner
Hello,

I want to open a lot of text images with imageJ. Tiff or bmp data files I can open with File/Import/Image Sequence.
Why I can not do this with text images, and knows sombody a solution for my problem?

Thanks a lot

Christoph

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: open text image sequence

Rasband, Wayne (NIH/NIMH) [E]
On Jun 21, 2012, at 10:53 AM, Christoph Waltner wrote:

> Hello,
>
> I want to open a lot of text images with imageJ. Tiff or bmp data files I can open with File/Import/Image Sequence.
> Why I can not do this with text images, and knows sombody a solution for my problem?

You can import a sequence of text images as a stack using a simple macro, such as the one at

   http://rsbweb.nih.gov/ij/macros/ImportTextImageSequence.txt

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: open text image sequence

amirhosein999
Can you please go through details on how we should use this script in ImageJ or Fiji. I tried to do that but couldn't. Maybe because I'm not much familiar with using macros in Fiji. Here is the things that I've done so far:

I saved this script in text file (ImportTextImageSequence.txt):
------------------------------------------------------------
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);
------------------------------------------------------------
And 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. It looks that just you guys have discussed about this macro here. I would be thankful if you clarify this issue.

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.
Reply | Threaded
Open this post in threaded view
|

Re: open text image sequence

Jerome Mutterer-3
Dear amirhosein999

You're getting this error message because the first two lines in your text
image image_01.txt do not contain the same number of elements.
Text images files have one line of values per horizontal line of pixels, so
every line is expected to contain exactly the same number of values.
Sincerely,

Jerome






On 3 September 2015 at 19:14, amirhosein999 <[hidden email]>
wrote:
>
> Can you please go through details on how we should use this script in
ImageJ

> or Fiji. I tried to do that but couldn't. Maybe because I'm not much
> familiar with using macros in Fiji. Here is the things that I've done so
> far:
>
> I saved this script in text file (ImportTextImageSequence.txt):
> ------------------------------------------------------------
> 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);
> ------------------------------------------------------------
> And 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. It looks that just you guys have discussed about this macro
here. I
> would be thankful if you clarify this issue.
>
> 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.
>
>
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/open-text-image-sequence-tp4999149p5014235.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html




--
Jerome Mutterer
CNRS - Institut de biologie moléculaire des plantes
12, rue du Général Zimmer
67084 Strasbourg Cedex
www.ibmp.cnrs.fr

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: open text image sequence

amirhosein999
Hi Jerome,

Thanks for your response. Number of elements in all lines are the same, and I can open and see each text image separately. Here is the image number 1 of this series:

https://www.dropbox.com/s/2jij6nt168gn02z/Japan_0001.txt?dl=0

I would like to import 200 images which their format is the same as this one. My problem is importing all at once because it take a significant time to open all 200 images manually.

Cheers,
Amir
Reply | Threaded
Open this post in threaded view
|

Re: open text image sequence

Jerome Mutterer-3
Dear Amir,
Yes your image imports nicely, so it should work as well from your macro.
You could add a print statement to try and diagnose the problematic file;
...
 file = dir + list[i];
print (file);
 run("Text Image... ", "open=&file");
....

Jerome


On 3 September 2015 at 20:22, amirhosein999 <[hidden email]>
wrote:

> Hi Jerome,
>
> Thanks for your response. Number of elements in all lines are the same, and
> I can open and see each text image separately. Here is the image number 1
> of
> this series:
>
> https://www.dropbox.com/s/2jij6nt168gn02z/Japan_0001.txt?dl=0
>
> I would like to import 200 images which their format is the same as this
> one. My problem is importing all at once because it take a significant time
> to open all 200 images manually.
>
> Cheers,
> Amir
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/open-text-image-sequence-tp4999149p5014237.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
Jerome Mutterer
CNRS - Institut de biologie moléculaire des plantes
12, rue du Général Zimmer
67084 Strasbourg Cedex
www.ibmp.cnrs.fr

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: open text image sequence

amirhosein999
Dear Jarome,

It becomes solved finally!!
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 my finding is shortly as: it's safer put all text image files exclusively in one specific folder.

Thanks again. Have a good day.

Amir