X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 22 Apr 2008 12:00 PM by  anon
script to export image as individual bands?
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
22 Apr 2008 12:00 PM
    Hello, I need to export multiple bands from an envi image as individual .bil or .asc files to use in a predictive modeling program (Maxent). Can ENVI export a multi-band file to multiple single band files, or has anyone written a script written that can do this? -John

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    22 Apr 2008 12:00 PM
    You can do this using the menus or you can use ENVI's routine ENVI_OUTPUT_TO_EXTERNAL_FORMAT to output to ArcView BIL or ascii (grid, xyz). When using the GUI, you would use the 'Spectral Subset' button during file selection to output each band. With ENVI_OUTPUT_TO_EXTERNAL_FORMAT, you would loop through the POS array which holds the band positions of the input file. For example, the code below will output each band in a file to ascii grid format: ++++++++++++++++++++++++++ PRO ascii_out_example compile_opt idl2 ;select file to output file = 'C:\Program Files\ITT\IDL64\products\envi44\data\bhtmref.img' ;open and query file envi_open_file, file, r_fid=fid envi_file_query, fid, dims=dims, ns=ns, nl=nl, nb=nb pos=lindgen(nb) ;loop through each band and output to ascii grid for i = 0, nb-1 do begin out_name = 'asc_grid'+ strtrim(string(pos[i]+1), 1)+'.txt' envi_output_to_external_format, fid=fid, dims=dims, pos=pos[i], out_name=out_name, /ascii endfor END +++++++++++++++++++++++
    You are not authorized to post a reply.