(Still a newbie, but more knowledgeable than before)
I am having trouble reading images from a only few files out of a series of files. The image file info is below. The "xxxx.fpf" files consist of a header followed by a matrix of single precision IEEE floating-point values, each representing one point of the image. A C-style description of the header layout can be found in the header file fpfimg.h, available in the installation directory. The image point values are stored starting from the top left corner, row by row.

(The following line is from the header file referred to above)

Float 32 bit IEEE floating point number, sign + 23 bit mantissa + 8 bit exponent,Representing numbers in the range +/- 1038

My code boils down to this:
   c4f =: _1 & (3!:5)   NB. 4 chars to float


   dat=:  freads  fn                      NB. reads the file
   i1=:  (pixeloffset)}.  dat          NB. drop header
i2=:c4f {.i1 NB. converts to float This seems to work on 43 files, but on the 44th file, I get a length error. Looking at i1, it is not mod 4. When I either curtail it to be mod 4 or pad it to be mod 4, it reads but the image looks like an old TV with the horizontal hold mis-set. To add to the confusion, the viewing software from the vendor reads all the files wonderfully. So I am guessing I am doing something wrong. Any suggestions?

Dave Porter

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to