PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 22 Jun 2022 04:00 PM by  Tom Nordheim
Noise spike/bad pixel removal
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages


New Member


Posts:1
New Member


--
07 Jun 2022 07:35 PM
    This should be a pretty basic one: I have a small number of hyperspectral image cubes where there are occasional artifacts in individual spatial pixels. These usually come in the form of one or several spectral bands that have obviously erroneous values (e.g. large noise spikes) and are usually easy to spot when manually inspecting the cubes using the z profile tool. However, the affected spectral bands are not identical across a scene, so I cannot simply simply remove or flag the bands across the entire cube. What I'm wondering is if there is a convenient/quick way to manually set the data number values for individual channels of a specific spatial pixel to a data ignore value and to write this back to the hyperspectral cube. Ideally, this would be something like a NaN flag so that ENVI does not count these pixels when performing operations like computing ROI statistics. Thanks in advance for your help!


    Veteran Member


    Posts:2364
    Veteran Member


    --
    09 Jun 2022 11:24 AM

    It does seem straight-forward but essentially what you are asking for is a multiband mask to match the multiband file.

    There isn’t a tool to identify and update “bad” pixels within a hyperspectral scene. There is a 'Replace Bad Values' tool where you can set pixel values but it does not work per band.
    It would not be that difficult to implement a routine to do this in IDL, if the pixels you are looking for are easy to find (i.e. a certain value far outside the data mean). If you can find them, you could replace those pixels with NaNs or other unique value that can be set to the 'data ignore value' and ENVI would correctly ignore those pixels for most processes.

    ENVI does support a pixel value state for *any* pixel in a raster, so if the raster has multiple bands, your pixel value state is three dimensional as well but we don’t support *saving* this information to disk. ENVI has only ever supported the idea of a single band “mask”.
    https://www.l3harrisgeospatial.com/docs/programmingguideworkingwithrasters.html#RastPixelState


    New Member


    Posts:1
    New Member


    --
    22 Jun 2022 04:00 PM
    Hi Mari. Thank you for your answer. I was able to do replace the values in question using pygdal. However, now I am running into a related issue. If I set the value for a specific band in a specific spatial pixel to either 'Nan' or to the data ignore value specified in the header, ENVI will then ignore that spatial pixel completely when I compute a mean spectrum over an ROI. How would I get around this? The idea is to be able to get useful mean spectra of a spatial region, not letting spurious values in a specific band of a specific spatial pixel affect the mean. However, the way it currently seems to be working, it throws out that entire pixel in the ROI calculations, which would essentially be the same as just removing that whole pixel using a mask.
    You are not authorized to post a reply.