X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Jul 2013 01:45 PM by  anon
Reading tiff images in IDL
 7 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
29 Jul 2013 01:45 PM
    Hi, I am very new in IDL so please forgive me if this a silly question. I have a tiff file + hdr which has been previously generated by ENVI. I wanna read it in IDL. It contains NDVI index data with floating point format with the range of -1.0 ~ 1.0 I tried to read it with read_tiff() but no luck. It says that the magic number is not valid. I should say that I am not sure if this is a true tiff file. this being said the file extension is .tif and I can open it in ENVI. I tried to use Query_tiff, and Query_image functions but they are not able to read the file and they both return 0. I tried read_* and query_* with all of their switches but no luck either. I can read the file with read_binary() function but it gives me some numbers which are less that 256 (probably 8 bit format) which is not correct. Also Edit header window in ENVI shows that the file type is ENVI standard. So if this is an ENVI standard file, I am not sure why I can not read it in IDL!? Any thoughts would be appreciated. Thanks e

    Deleted User



    New Member


    Posts:
    New Member


    --
    30 Jul 2013 01:58 PM
    Hi there, Since ENVI can read it, what does the following ENVI routine says when you run this routine from IDL?: http://www.exelisvis.com/docs/ENVI_FI... Does it show it as a TIFF file? Cheers, Fernando

    Deleted User



    New Member


    Posts:
    New Member


    --
    31 Jul 2013 08:48 AM
    Hi, Thanks for your response It does not show the TIFF and It returns "ENVI Standard" e P.S. I actually solved the problem with some other work around but it is still unsolved for me that why the files can not be read in IDL.

    Deleted User



    New Member


    Posts:
    New Member


    --
    31 Jul 2013 09:42 AM
    If the file was created in ENVI and has an associated *.hdr file it isn't a true TIFF file. What I would suggest it renaming the file extension to something more commonly associated with ENVI file formats such as *.dat or *.img. (*.tif extensions should only be used if you are actually using a tiff writing tool). So what you would have then would be for example: 'myndvifile.dat' and 'myndvifile.hdr'. Do not put these files in separate directories. They must always be together for ENVI to open the image file correctly. That said ENVI image files are binary files which is why you can open them with the 'read_binary' function. There is another way to open them. Consider the following pseudocode: filename='C:\whateverdir\myndvifile.dat' ;read_image,filename openr, lun, filename, /get_lun ;set up array to put image data into.(samples, lines) pic=fltarr(512, 512) readu, lun, pic ;How IDL reads the image window, 1, xsize=512, ysize=512, title='IDL Image' ;loadct, 39 tvscl, pic ; Change the way IDL reads the image so it's ;how ENVI would display it window, 2, xsize=512, ysize=512, title='Corrected IDL Image' tvscl,reverse(pic,2)

    Deleted User



    New Member


    Posts:
    New Member


    --
    31 Jul 2013 10:03 AM
    Hi there, Well, just to point out that if you see the information in the IDL Help for READ_TIFF, you can read the following:\ "Image dimensions may exceed the capacity of IDL integers and even unsigned integers (respective limits being 32,767 and 65,535). Therefore, it is a good idea to know your data or always use long integers." Could this be the issue? Cheers, fernando

    Deleted User



    New Member


    Posts:
    New Member


    --
    31 Jul 2013 12:14 PM
    Thanks for your response I actually wrote a small code to open my files and re-save them in TIFF format This solved the issue Cheers, e

    Deleted User



    New Member


    Posts:
    New Member


    --
    31 Jul 2013 12:17 PM
    My data have floating points format. e

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Jan 2014 01:21 AM
    Hi there Actually i am new in IDL too.And i have tried to read the tiff files using this tiff program.It supports to read or edit tiff files directly. You can also have a try if you want to do that .It offers a free trial for new users.Hope to help you.
    You are not authorized to post a reply.