Hi, Peter,
I think writing an image file is not difficult. But reading a file has some
problem:
If we use ENVI function: ENVI_GET_DATA, from my experience, it can only read
one band out each time.
If we use:
imgdata = ENVI_GET_DATA(fid=fid, dims=dims, pos=indgen(nb))
Though the image has several bands, it can only read the first band into
imgdata.
So if you have some code to read the header written in IDL, could you please
send to my email address:
julia65201@yahoo.com.
Thanks,
Julia
"Peter Scarth" <p.scarth@xmg.net> wrote in message
news:ap32uu$vtk$1@bunyip.cc.uq.edu.au...
> Hi Julia,
> Assuming that you have ENVI on the system, you can use something like the
> following (pseudocode?) to read an ENVI image, and write the processed
> results back to an ENVI format file. Check the ENVI help for more info on
> the batch functions. If you don't have ENVI you will have to write some
code
> to read the header. I have a kludgy solution I can send if you want.
>
> Peter
> --
> (Change xmg to gmx to reply!)
>
>
> PRO envi_batch_processing_demo
> COMPILE_OPT strictarr
>
> ; Restore the ENVI save files and initialise
> ENVI, /restore_base_save_files
> ENVI_BATCH_INIT
>
> ; Open, query and read the entire image into an array
> ; Change dims and/or the pos variables to read in a subset
> ENVI_OPEN_FILE, 'test.img', r_fid=fid
> ENVI_FILE_QUERY, fid, ns=ns, nl=nl,nb=nb,$
> interleave=interleave,data_type=data_type,offset=offset
> dims = [-1, 0, ns-1, 0, nl-1]
> imgdata = ENVI_GET_DATA(fid=fid, dims=dims, pos=indgen(nb))
>
> ;
> ; Processing goes here to produce processed_data
> ;
>
> ; Write the output into a file...
> ; A simpler way might be to use the
> ; WRITE_ENVI_FILE procedure available at
> ; http://www.rsinc.com/services/output.cfm?tip_id=2787
> fname = 'processed.img'
> OPENW, unit, fname, /get_lun
> WRITEU, unit, processed_data
> FREE_LUN, unit
>
> ; Create an ENVI header for convenience
> ; Change ns, nl, nb, data_type, interleave and offset below
> ; if your processed_data differs from the input in type or size!
>
> ENVI_SETUP_HEAD, fname=fname, ns=ns, nl=nl, nb=nb, $
> interleave=interleave, data_type=data_type,$
> offset=offset, /write
>
> ENVI_BATCH_EXIT
> END
>
>
>
>
> "Julia" <julia65201@yahoo.com> wrote in message
> news:ap2fi4$3oq$1@dipsy.missouri.edu...
>> Hi, there,
>>
>> After some operations in ENVI, I output the resulting image using the
> format
>> '.img'. It's an multispectral image.
>> The '.hdr' head file is like this:
>> ENVI
>> description = {
>> image [Fri Oct 18 11:01:10 2002]}
>> samples = 116
>> lines = 261
>> bands = 4
>> header offset = 0
>> file type = ENVI Standard
>> data type = 4
>> interleave = bsq
>> sensor type = Unknown
>> byte order = 0
>>
>> My question is: how can I read this file using IDL functions?
>> Now I am doing this using the following:
>> imgdata = READ_BINARY('test.img', DATA_TYPE = 4, DATA_DIMS = [116, 261,
>> 4]).
>>
>> But I need to specify the data type and dimensions of the image. How can
I
>> read it more generally that I need to specify nothing? Is there other
>> functions in IDL?
>>
>> Any suggestion will be appreciated.
>>
>> Regards,
>>
>> Julia
>>
>>
>>
>
>
>
>
|