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

Home » Public Forums » archive » Re: does the image size matters?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: does the image size matters? [message #39763] Mon, 14 June 2004 13:19
Chris[1] is currently offline  Chris[1]
Messages: 23
Registered: January 2003
Junior Member
"Adhara" <adharac@hotmail.com> wrote in message
news:4cbae60f.0406140728.4606308c@posting.google.com...
> Thank you, let me explain you the situation:
> 1. I did the program first to run for one array, as follows:
>
> archivo = READ_ASCII(FILEPATH('gv04.bit', ROOT_DIR='c:\',$
> SUBDIRECTORY=['RSI','IDL55','lib']))
>
> archivo = READ_ASCII(FILEPATH('gv04.bit'))
> WRITE_TIFF,'gv04.tif',archivo.FIELD01
> end
>
> 2. It worked for 50x50,and I actually produced the image. I tried the
> same program but for 200x200, and an error message appears saying:
> % Tag name FIELD01 is undefined for structure <Anonymous>.
> % Execution halted at: $MAIN$ 5

IDL has a peculiar naming procedure for the field element in the structure
returned by "read_ascii" when you do it without a template. Put a "stop"
after yopur call to "read_ascii", and when the program halts, type in

help, archivo, /struct

This will tell you the field name (I think it will be something like
field001)

Chris
Re: does the image size matters? [message #39767 is a reply to message #39763] Mon, 14 June 2004 08:28 Go to previous message
adharac is currently offline  adharac
Messages: 23
Registered: April 2004
Junior Member
Thank you, let me explain you the situation:
1. I did the program first to run for one array, as follows:

archivo = READ_ASCII(FILEPATH('gv04.bit', ROOT_DIR='c:\',$
SUBDIRECTORY=['RSI','IDL55','lib']))

archivo = READ_ASCII(FILEPATH('gv04.bit'))
WRITE_TIFF,'gv04.tif',archivo.FIELD01
end

2. It worked for 50x50,and I actually produced the image. I tried the
same program but for 200x200, and an error message appears saying:
% Tag name FIELD01 is undefined for structure <Anonymous>.
% Execution halted at: $MAIN$ 5
C:\RSI\IDL55\lib\transform.pro

4. The image was not produced

5. The file of [50,50] is exactly like the one [200,200] except for
the size. When opened in Excel all the numbers of one row appear in
the same cell. If I change the extension, and open it in notepad, the
numbers appear separated by tabs. (Ascii file, isn't it??)

6. Then I used the following program to do it for 69 files:
files=FindFile('*.bit')
for j=0,N_Elements(files)-1 DO BEGIN
cadena2=string([j])
archivo = READ_ASCII(cadena2)
cadena = 'gv' + string([j]) + '.tif'
WRITE_TIFF,cadena,archivo.FIELD01
endfor

end

7. I tried: print, Archivo. The 255 and zeros appear (not properly
aligned, zeros have more decimals than 255s),however, this did not
show when opening the original file with excel or notepad...I think
the problem is here....not?

8. If that is the case, how can I get rid of those extra zeros that I
didn't creat!!??

Regards,
Adhara
Re: does the image size matters? [message #39768 is a reply to message #39767] Mon, 14 June 2004 08:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Adhara writes:

> Thank you, let me explain you the situation:
> 1. I did the program first to run for one array, as follows:
>
> archivo = READ_ASCII(FILEPATH('gv04.bit', ROOT_DIR='c:\',$
> SUBDIRECTORY=['RSI','IDL55','lib']))
>
> archivo = READ_ASCII(FILEPATH('gv04.bit'))
> WRITE_TIFF,'gv04.tif',archivo.FIELD01
> end
>
> 2. It worked for 50x50,and I actually produced the image. I tried the
> same program but for 200x200, and an error message appears saying:
> % Tag name FIELD01 is undefined for structure <Anonymous>.
> % Execution halted at: $MAIN$ 5
> C:\RSI\IDL55\lib\transform.pro
>
> 4. The image was not produced
>
> 5. The file of [50,50] is exactly like the one [200,200] except for
> the size. When opened in Excel all the numbers of one row appear in
> the same cell. If I change the extension, and open it in notepad, the
> numbers appear separated by tabs. (Ascii file, isn't it??)
>
> 6. Then I used the following program to do it for 69 files:
> files=FindFile('*.bit')
> for j=0,N_Elements(files)-1 DO BEGIN
> cadena2=string([j])
> archivo = READ_ASCII(cadena2)
> cadena = 'gv' + string([j]) + '.tif'
> WRITE_TIFF,cadena,archivo.FIELD01
> endfor
>
> end
>
> 7. I tried: print, Archivo. The 255 and zeros appear (not properly
> aligned, zeros have more decimals than 255s),however, this did not
> show when opening the original file with excel or notepad...I think
> the problem is here....not?

I don't think so. :-)

> 8. If that is the case, how can I get rid of those extra zeros that I
> didn't creat!!??

Judging from the mail this morning, I think we probably need
a tutorial on formatting data. :-)

But do this. Forget READ_ASCII. Try this:

OpenR, lun, 'gv04.bit', /Get_Lun
array = FltArr(50,50) ; Or maybe this is (200,200). You tell me.
ReadF, lun, array
Free_Lun, array
Help, array

Does that work? When you display it as an image, does
it look correct?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: does the image size matters? [message #39769 is a reply to message #39768] Mon, 14 June 2004 07:45 Go to previous message
adharac is currently offline  adharac
Messages: 23
Registered: April 2004
Junior Member
Thank you, let me explain you the situation:
1. I did the program first to run for one array, as follows:

archivo = READ_ASCII(FILEPATH('gv04.bit', ROOT_DIR='c:\',$
SUBDIRECTORY=['RSI','IDL55','lib']))

archivo = READ_ASCII(FILEPATH('gv04.bit'))
WRITE_TIFF,'gv04.tif',archivo.FIELD01
end

2. It worked for 50x50,and I actually produced the image. I tried the
same program but for 200x200, and an error message appears saying:
% Tag name FIELD01 is undefined for structure <Anonymous>.
% Execution halted at: $MAIN$ 5
C:\RSI\IDL55\lib\transform.pro

4. The image was not produced

5. The file of [50,50] is exactly like the one [200,200] except for
the size. When opened in Excel all the numbers of one row appear in
the same cell. If I change the extension, and open it in notepad, the
numbers appear separated by tabs. (Ascii file, isn't it??)

6. Then I used the following program to do it for 69 files:
files=FindFile('*.bit')
for j=0,N_Elements(files)-1 DO BEGIN
cadena2=string([j])
archivo = READ_ASCII(cadena2)
cadena = 'gv' + string([j]) + '.tif'
WRITE_TIFF,cadena,archivo.FIELD01
endfor

end

7. I tried: print, Archivo. The 255 and zeros appear (not properly
aligned, zeros have more decimals than 255s),however, this did not
show when opening the original file with excel or notepad...I think
the problem is here....not?

8. If that is the case, how can I get rid of those extra zeros that I
didn't creat!!??

Regards,
Adhara
Re: does the image size matters? [message #39778 is a reply to message #39769] Sun, 13 June 2004 19:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Adhara writes:

> Hello, excuse the inconvenience if my message disturbs you..
>
> I just have one question....
> I finally was able to transform the bitmap into images. As a trial, I
> did that at first with 50x50pixels and it worked just fine. However,
> for the real thing, I need it for 200x200 but it is not running...The
> error message is:
>
> %READ_ASCII:File " 0" not found.
> %Error occurred at:READ_ASCII 731 c:\rsi\idl55\lib\read_ascii.pro
> % $MAIN$ 13 c:\RSI\IDL60\lib\transform.PRO
> % Execution halted at: $MAIN$ 13
> c:\RSI\IDL60\lib\transform_bit_image.pro
>
>
> MY CODE IS AS FOLLOWS:
>
> files=Findfile('*.bit')
>
> for j=0,N_Elements(files)-1 DO BEGIN
> cadena2=string(files[j])
> archivo=READ_ASCII(cadena2)
> cadena='gv'+string([j])+'tif'
> WRITE_TIFF,cadena,archivo.FIELD01
> endfor
>
> end
>
> Thank you for your kind help,

Are you sure that your "bit" files are ASCII files
and not binary files? This is the kind of message
READ_ASCII would give if it appeared the file contained
binary data rather than ASCII data. Also, are you sure
the variable cadena2 is the name of one of your files?
Have you printed the variable files to be sure you
are finding the files you think you are finding?
(And no need to covert files to a string variable.
It *is* a string variable already.)

Cheers,

David

P.S. Did you create the "bit* files yourself? What
commands did you use to write the files?
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: addition
Next Topic: dates transformation

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

Current Time: Wed Oct 08 16:03:51 PDT 2025

Total time taken to generate the page: 0.00610 seconds