X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 24 Aug 2016 08:50 AM by  anon
ENVIMosaicRaster reports inconsistent number of bands, GUI runs without error
 5 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
24 Aug 2016 08:50 AM
    I am trying to mosaic 75 tif images in ENVI 5.3 using the "new" API. When I do this, I receive the following error: "The input scenes must have the same number of bands" although it is clear that each file has the same number of bands and all are BSQ. Each image was written using IDL's write_tiff and planarconfig=2 When I try to mosaic the same files using the referenced option from the old gui, the same images mosaic without complaint. Any ideas?

    Deleted User



    Basic Member


    Posts:228
    Basic Member


    --
    24 Aug 2016 09:46 AM
    Hi Michael, It's hard to say what might be going wrong without seeing your code. Can you reduce it down to the smallest number of lines to reproduce the problem, and post it here? Are you double checking the number of bands in each raster after you open them as ENVI rasters, after writing them in IDL? - Peg

    Deleted User



    New Member


    Posts:
    New Member


    --
    24 Aug 2016 01:41 PM
    The code (below) was lightly modified from an example. I should have mentioned that I was checking on the number of bands using the line: print,n_elements(raster.metadata['Band Names']) to check on the number of bands and the values printed are actually the number of rows (or columns- don't remenber). However, when the same file is opened in the GUI, the files open with the correct number of bands and are able to be mosaicked. scenes = !NULL FOR i=0, N_ELEMENTS(files)-1 DO BEGIN raster = e.OpenRaster(files[i],data_ignore_value=0) print,n_elements(raster.metadata['Band Names']) scenes = [scenes, raster] ENDFOR mosaicRaster = ENVIMosaicRaster(scenes, $ RESAMPLING = 'Bilinear', $ COLOR_MATCHING_ACTIONS = ['reference',$ replicate('adjust',n_elements(scenes)-1)], $ COLOR_MATCHING_METHOD = 'histogram matching', $ COLOR_MATCHING_STATS = 'overlapping area')

    Deleted User



    Basic Member


    Posts:228
    Basic Member


    --
    25 Aug 2016 01:36 PM
    I just put your code into a procedure, and ran it on a directory of images that I've mosaicked before. It ran without a hitch. Here is the code I used. It is only very slightly modified from what you sent: ************************* pro mosaictest e=envi() files=file_search('C:\Data\Testing\test1', '*.dat') scenes = !NULL FOR i=0, N_ELEMENTS(files)-1 DO BEGIN raster = e.OpenRaster(files[i],data_ignore_value=0) print,n_elements(raster.metadata['Band Names']) scenes = [scenes, raster] ENDFOR mosaicRaster = ENVIMosaicRaster(scenes, $ RESAMPLING = 'Bilinear', $ COLOR_MATCHING_ACTIONS = ['reference',$ replicate('adjust',n_elements(scenes)-1)], $ COLOR_MATCHING_METHOD = 'histogram matching', $ COLOR_MATCHING_STATS = 'overlapping area') end ******************************************* Would you mind me what you see when you print your file variable? Also, what is printed out from the for loop? How many bands does each image have? I assume it prints that number for each loop? Best, Peg

    Deleted User



    New Member


    Posts:
    New Member


    --
    26 Aug 2016 09:18 AM
    I made the changes you suggested but still no solution. When I print out the number of band names (which I am using to tell me how many bands the file has), rather than printing the correct value it prints out the number of columns. This would seem to indicate that I made an errorwhen I exported the files from an earlier step in processing. However, when I open the file using the ENVI GUI, it opens with the correct number of bands and the correct number of bands is reported in the metadata. Furthermore, when I mosaic through the GUI it works. So, my observation is that envimosaicbatch is treating the files differently than the GUI and failing. M

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    26 Aug 2016 10:08 AM
    What is reported if you open the raster and print the number of bands for each file? print, raster.nb
    You are not authorized to post a reply.