X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 10 Aug 2009 06:15 PM by  anon
band math - replace values
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
10 Aug 2009 06:15 PM
    Normal 0 MicrosoftInternetExplorer4 I have an image where all the edges have been assigned a value, for example -999, and all other values are DN greater than zero. I would like to add the -999 part of my image (so all the edges) to another image but not add all the DN values. Does anyone know a way I could do this?? For example I firstly stack the two images, where: B1 is the image with the -999 edges B2 is the image I would like to keep all original values but change wherever values on BI are -999   Replace B2 with B1 only where B1=-999 Or B2=B1 when B1=-999   Any help would be greatly appreciated

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    11 Aug 2009 10:47 AM
    You could do something like this in Band Math: -999*(b1 eq -999)  + b2*(b1 ne -999) The first part of the equation creates a mask where everything but areas of -999 are 0.  The second part sets all areas in band 2 to 0 where they were not equal to -999 in band 1.  Then you add the 2 files together. You could also easly do this with masking.  Just create a mask from band 1 of areas that equal -999.  Then apply this mask to band 2.  When you apply a mask, you can set the background value to a value of your choice.
    You are not authorized to post a reply.