Hi Jeff,
There is a way, its just not exposed to users because it uses an object reference (so use at your own risk!). In order to associate a DEM to an image programmatically, you need to use the object reference, o_dem. This "object" holds a FID, POS, and DIMS in a single entity rather than making them separate. Here is an example:
==========================
pro associate_dem
;open and image and DEM file
image = 'bhtmref.img'
dem = 'bhdemsub.img'
envi_open_file, image, r_fid=ifid, /no_realize
envi_open_file, dem, r_fid=dfid, /no_realize
;query the files - the o_dem object is always valid
envi_file_query, ifid, o_dem=o_dem
envi_file_query, dfid
;set properties of o_dem
o_dem->setproperty, fid=dfid, pos=0L
;create the new header with the association
envi_write_file_header, ifid
;if the file is open, you will need to remove it
;and load the new image with the new header
envi_file_mng, id=ifid, /remove
envi_file_mng, id=dfid, /remove
envi_open_file, image, r_fid=new_fid, /no_realize
end
|