Login  Register

Re: Reading in Image Files (Hopefully a "re-inventing the wheel" sort of question)

Posted by Harry Parker on Apr 22, 2008; 5:05pm
URL: http://imagej.273.s1.nabble.com/Reading-in-Image-Files-Hopefully-a-re-inventing-the-wheel-sort-of-question-tp3696471p3696475.html

Hello Dwight,

I tried opening your sample images.
I was able to get ImageJ to read them by simply adding a space after each comma and deleting the headers with a text editor.
You can do add the spaces easily with any programmer's text editor's Search and Replace feature.

If you have many images like that could write a little script to do that to all your files. (Or get a programmer friend to do it.)
It would be about 5 to 10 lines in Python or Perl, for example.
 
--  
Harry Parker  
Senior Systems Engineer  
Digital Imaging Systems, Inc.

----- Original Message ----
From: Dwight Bartholomew <[hidden email]>
To: [hidden email]
Sent: Tuesday, April 22, 2008 12:13:22 PM
Subject: Reading in Image Files (Hopefully a "re-inventing the wheel" sort of question)

There are a couple of types of image files I'm having trouble reading.

 

1) The comma-deliminated floating-point file:

         Nrows of lines with Ncols of floating-point number separated by
commas

         Example:

0.359534,0.36763,0.365069,0.377957,0.369861, <etc>

0.385474,0.396379,0.397619,0.399188,0.39291, <etc>

0.398032,0.403897,0.406541,0.411498,0.403815, <etc>

<etc>

   

   When I try to read the file (import as a "text image"), I get an
image that is Nrows x 1.

   I tried writing a PlugIn that reads in each line, splits the string
using the split() function and put each number into an array but WOW
that takes a really long time!  There MUST be a faster way and I've got
a feeling this has been done before.

 

2) The comma-deliminated integer file with 4 lines of header
information:

         Example:

This is the first line of header info

This is the second line of header info

This is the third line of header info

This is the fourth line of header info

23828,23768,24002,23808,23904,23970,<etc>

23861,23569,23673,23714,23988,23671, <etc>

<etc>

   

   This is a similar problem.  I can read in the file, drop the first 4
lines, and start splitting the lines but it takes TOO LONG.  There must
be a faster way.

 

Sincerely,

Dwight Bartholomew

 





      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ