comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Help needed with reading ASCII data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Help needed with reading ASCII data [message #18139 is a reply to message #18131] Fri, 03 December 1999 00:00 Go to previous messageGo to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Scott Reid wrote:
> I'm completely new to IDL, and I have a set of data in ASCII format. It
> is extracted from MRI data. It is a file which contains 3 columns of
> data. The first column is the x, the second is the y coordinate and the
> third is just a scaled magnitude value between 0 and 1. There are 38808
> rows of data, and the matrix size is (49, 36) and there are 22 time
> phases. I want to know if anyone has had experience in reading in data
> of this type, and how to put it into an array that can be read by IDL.
> I know how to open the data and display it, with the following
>
> openr, 1, filepath(..)
> :
> : HELP WITH THE READING OF THE ACII DATA PLEASE!!!!!!
> :
> :
> h=fltarr(49,36,22)
> close, 1
> loadct, 3
> h = rebin(h, 32, 32, 22)
> frames = fltarr(256, 256, 22)
> window, 1, TITLE='Bloodflow animation', xsize=256, ysize=256
> for i=0, 22 do begin surface, h[*, *, i], zrange=[0, 1] & frames[0,0,i]
> = tvrd() & end
>
> If anyone could help me with reading the ASCII data and putting it into
> an array which IDL can read, I would be most grateful

I'm assuming your data file looks something like this:

0, 0, 0.998
1, 0, 0.976
2, 0, 0.876

It sounds like you're not really interested in the x and y coordinates,
since they are probably the same for all 22 time phases. In this case,
you can read the array in one hit:

;- Read the data file
openr, lun, 'mri.dat', /get_lun
data = fltarr(3, 38808)
readf, lun, data
free_lun, lun

;- Extract the magnitude array
h = data[2, *]
h = reform(h, 49, 36, 22)

;- Visualize the data as an image sequence
mag = 5
for index = 0, 21 do tvscl, rebin(h[*, *, index], mag*49, mag*36, 1,
/sample)

Cheers,
Liam.

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: do I really need to use loops on objects?
Next Topic: POLYFILLV for 3D to create volumes

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 05:01:30 PDT 2025

Total time taken to generate the page: 2.00176 seconds