Re: ENVI File Question [message #55787] |
Wed, 12 September 2007 15:43 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Any idea why this wouldn't be
> shown in the Available Bands list, too?
Ahhh, forget it! Not my day. A typo with "map_info"
going to "mapinfo". Is it time for a beer yet? :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: ENVI File Question [message #55788 is a reply to message #55787] |
Wed, 12 September 2007 15:40  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jean H. writes:
> You can write the image AND the header at the same time, using
> ENVI_WRITE_ENVI_FILE
>
> here is an example... please note that some info has been read when
> opening another file (the headerInfo structure)... I am not sure how to
> build the map info on its own!
>
> ENVI_WRITE_ENVI_FILE, data, data_type=1, nb = nbBands, nl=data_sizeY, $
> ns=data_sizeX,OUT_NAME = workingDirectory + "fileName.dat", $
> BNAMES = "band Name", class_names = headerInfo.class_names, $
> lookup=headerInfo.lookup, map_info=headerInfo.map_info,num_classes =
> headerInfo.num_classes
Good suggestion, Jean. And I notice that this also automatically
adds the new image to the Available Bands list, which is great.
BUT, even though I get a map info structure from the GeoTiff
files when I open them,(I open with ENVI_OPEN_DATA_FILE and
I get the map structure with ENVI_GET_MAP_INFO, and check to
be sure it is valid), the map information is not there in the
Available Bands list as it is for the GeoTiff files. (I pass
the map info information along with the MAPINFO keyword
in ENVI_WRITE_ENVI_FILE.) Any idea why this wouldn't be
shown in the Available Bands list, too?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: ENVI File Question [message #55794 is a reply to message #55788] |
Wed, 12 September 2007 13:51  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
David Fanning wrote:
> Folks,
>
> I have an ENVI file question. I just want to open a Geotiff
> file, do some small amount of processing on it, and save
> it as an image file ENVI can read. This seems about as
> straightforward as it can be.
>
> I found an ENVI procedure named ENVI_SETUP_HEAD that looks
> like what I need to create the ENVI header for this very
> simple file. My program runs, my ENVI_SETUP_HEAD command
> gets called. All appears well, but the header file never gets
> created. (Or at least it doesn't get created in the same
> place as my image file!)
>
> Here is the output from my program:
>
> Image Filename: /home/fanning/b2.img
> ENVI Header Filename: /home/fanning/b2.img.hdr
>
> The image file is there. The header file is not.
>
> Do I have to do something else to write the header?
>
> Cheers,
>
> David
David,
You can write the image AND the header at the same time, using
ENVI_WRITE_ENVI_FILE
here is an example... please note that some info has been read when
opening another file (the headerInfo structure)... I am not sure how to
build the map info on its own!
ENVI_WRITE_ENVI_FILE, data, data_type=1, nb = nbBands, nl=data_sizeY, $
ns=data_sizeX,OUT_NAME = workingDirectory + "fileName.dat", $
BNAMES = "band Name", class_names = headerInfo.class_names, $
lookup=headerInfo.lookup, map_info=headerInfo.map_info,num_classes =
headerInfo.num_classes
jean
|
|
|
|