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

Home » Public Forums » archive » Re: How to edit the file of classification
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: How to edit the file of classification [message #66867] Fri, 12 June 2009 04:48
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
mengran wrote:
> Hi, everyone.
>
> I want to open and edit a envi standard classification file in IDL.
> But I don not know using which function to open it ,and then get the
> data into a variable to edit it, finally save the edited data as a
> envi standard classification file.
>
> Could you please help me ? Thanks a lot!
>
> best wishes!
>
> mengran


Hi Mengran,

you can do something like this, provided you have Envi.

envi, /restore_base_save_files
envi_batch_init

;Open the file in envi
ENVI_OPEN_FILE, fileToOpen, /NO_REALIZE , R_FID=FID

;Read the header
envi_file_query, fid, ns=dimX, nl=dimY, nb=nbBands, $
DATA_TYPE=dataType, OFFSET = HeaderOffSet, $
LOOKUP= lookup, class_names = classNames, $
num_classes = numClasses
map_Info = ENVI_GET_MAP_INFO(FID=FID)

headerInfo = {ns:dimX, nl:dimY, lookup:lookup, $
map_info:map_Info, class_names:classNames, $
num_classes:numClasses}

;Read the data in IDL
data = read_binary(fileToOpen,data_Start = HeaderOffSet, $
data_Type=dataType, data_Dims=[dimX,dimY],ENDIAN = "native")

;Do something on your data

;Save your file (check the nb.. you may want to read it from the file,
in the header structure)
ENVI_WRITE_ENVI_FILE, data, data_type=dataType, nb=1, nl=headerInfo.nl,$
ns=headerInfo.ns,OUT_NAME = outFilName, $
BNAMES = 'modified band', class_names = headerInfo.class_names, $
lookup=headerInfo.lookup, map_info=headerInfo.map_info, $
num_classes = headerInfo.num_classes


Jean
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to edit the file of classification
Next Topic: Re: map_proj_* help

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

Current Time: Wed Oct 08 19:00:07 PDT 2025

Total time taken to generate the page: 0.00625 seconds