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

Home » Public Forums » archive » Re: save image from ENVI to TIFF file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: save image from ENVI to TIFF file [message #52189] Mon, 15 January 2007 15:07 Go to previous message
Jeff N. is currently offline  Jeff N.
Messages: 120
Registered: April 2005
Senior Member
You don't need the loop if you're extracting consecutive bands, and you
don't really even need the call to MAKE_ARRAY(). This can often be
done in one step:

WRITE_TIFF, 'output_filename.tif', ENVI_GET_DATA(...)

The trick is to give ENVI_GET_DATA() and WRITE_TIFF() the right
keywords, and the value of those keywords depends on the size of the
input image and the size of the subset of that image you're trying to
extract. I typically use ENVI_FILE_QUERY to get the number of samples,
lines, and bands of my input image and put them in variables like ns,
nl, and nb, respectively. You can then build a DIMS array for spatial
dimensions and a POS array for band positions. So, if you wanted to
just write the first three bands of an image out to a tif file without
spatial subsetting, try something like this:

dims = [-1,0, ns - 1, 0, nl - 1]
pos = [0,1,2]
WRITE_TIFF, 'output_filename.tif', ENVI_GET_DATA(FID=fid, DIMS=dims,
POS=pos)

But, of course, you will probably need to set the TRUE keyword to
WRITE_TIFF() based on the interleave of the input data (or depending on
how you called ENVI_GET_DATA). The basic idea is that you've got to be
able to completely and correctly describe the subset of the input image
cube that you want to write out. If you do this, you shouldn't have
much trouble with either WRITE_TIFF() or with
ENVI_OUTPUT_TO_EXTERNAL_FORMAT. I'd say 95% of the time i have trouble
with this sort of task it's b/c a keyword i thought i had right is
actually wrong, so just keep working on those keywords and you'll get
it. One piece of advice: ALWAYS have both the ENVI and IDL help
running while you write code :)

Hope that helps,
Jeff
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to highlight procedure and function names in idlwave-mode?
Next Topic: Re: accessing image data from Windows-clipboard

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

Current Time: Fri Oct 10 10:14:40 PDT 2025

Total time taken to generate the page: 1.44260 seconds