Some software packages offer an option for applying a mask to the image to exclude certain areas from these calculations (for example, clouds and cloud shadows should be excluded). You can use overlay options or a raster calculator to produce mask images to do the same. In the same way, reclassify the affected band by using Reclass/Reclassify to create a boolean mask image in which the pixels where some class of land cover are present have a value of 1 and the rest have a value of zero.