X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Apr 2008 08:12 AM by  anon
Problem with ENVI_SETUP_HEAD with INHERIT option
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
09 Apr 2008 08:12 AM
    I have two images (TIFF)... 1) original_image 2) final_image And I want that the final_image inherits the original_image map info. But when I use the ENVI_SETUP_HEAD routine with the INHERIT option my final_image is shifted 8 pixels to the right in correspondence to the original_image. The code I am using is more or less the following... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Get the size of the original image ENVI_OPEN_FILE, original_image_path, r_fid = original_fid ENVI_FILE_QUERY, original_fid, dims = o_dims, ns = o_ns, nl = o_nl, nb = o_nb ; Create a final image (with zeros) with the same size as the original image final_image = INTARR(o_ns, o_nl) ; HERE I PUT SOME ONES IN THE FINAL IMAGE ; Here I save the image as a Tiff fname = 'C:\final_image.tif' WRITE_TIFF, fname, final_image ; Inherit information from the original image pos = [0] inherit = ENVI_SET_INHERITANCE(original_fid, o_dims, pos, /FULL) ; Enter the data into ENVI ENVI_SETUP_HEAD, fname = fname, $ ns = o_ns, $ ; number of samples in the file. nl = o_nl, $ ; number of lines in the file nb = 1, $ ; number of bands in the file interleave = 0, $ ; BSQ output data_type = 1, $ ; 8 bits data offset = 0, $ ; no offsets inherit = inherit, $; file inheritance /WRITE, /OPEN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Any ideas??? Best regards,

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    09 Apr 2008 08:12 AM
    Hi Paulo, When you use /FULL with inherit, the output file is going to inherit all the properties of the input file. If you only need the output file to inherit the map information, then I would suggest the following: ;select and query the input file envi_select, fid=fid, dims=dims, pos=pos envi_file_query, fid, ns=ns,nl=nl ;get the map structure of the input file o_map=envi_get_map_info(fid=fid) ;generate the output file o_image = intarr(ns, nl) ;set the inheritance so that the output file inherits the map structure inherit = envi_set_inheritance(fid, dims, map_info=o_map) ;enter the data into memory envi_enter_data, o_image, inherit=inherit, r_fid=r_fid There is no need to create a TIFF file and then assign an ENVI header file to it. Just generate the ENVI file in memory, then output the file to TIFF using the ENVI routines. This will create a geotiff with the proper structure: envi_output_to_external_format, fid=r_fid, dims=dims, pos=0, $ /TIFF, out_name = 'new_tiff.tif' Will this help?
    You are not authorized to post a reply.