comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Reading in a bunch of bytes

Reading in a bunch of bytes
type: item
description: I hope someone out there can point out the stupid thing I'm doing that causes this to fail, cause all my hair is on the floor around my chair at present. I have a binary file of 2 256x128x64 arrays of longs that are interleaved by rows. Here's what I do to try and read it: openr,1,'file' s = fstat(1) data = bytarr(s.size) ; s.size = 8388608 = 256*128*64*4 readu,1,data close,1 xsize = 256 ysize = 128 zsize = 64 junk1 = fltarr(xsize,ysize,zsize) junk2 = fltarr(xsize,ysize,zsize) offset = xsize*4. ; 4 bytes/pixel k = 0 for i = 0,zsize-1 do begin for j = 0,ysize-1 do begin off1 = offset*long(k) off2 = offset*long(k+1) junk1 = long(data,off1,xsize) junk2 = long(data,off2,xsize) k = k + 2 endfor endfor end Everything looks good to me, but I always end up offsetting past the end of the data. Any help would be greatly apreciated! Thanks in advance, -- /*********************************************************** ********/ Phil Williams, Ph.D. Research Instructor Children's Hospital Medical Center "One man gathers what Imaging Research Center another man spills..." 3333 Burnet Ave. -The Grateful Dead Cincinnati, OH 45229 email: williams@irc.chmcc.org URL: http://scuttle.chmcc.org/~williams/ /*********************************************************** ********/
creator: Phil Williams
date: 1996-07-02T07:00:00-00:00