How to extract an entire patch which having a particular pixel from a classified raster only and only if surrounded by a particular class.

Example. Suppose a patch/clump having pixel/class value 7 is to be extracted as a whole if surrounded with pixel value 5 and not the other class. Those clumps having pixel value 7 and surrounded by pixel values 5 will be selected for extraction.

Similar questions and discussions