Login  Register

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

Posted by DwightBart on Apr 22, 2008; 4:13pm
URL: http://imagej.273.s1.nabble.com/Reading-in-Image-Files-Hopefully-a-re-inventing-the-wheel-sort-of-question-tp3696471.html

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