Sometimes the data which occupies a raster you produce may be sparse. For example, if performing anomaly detection or feature extraction, the class pixels may only occupy a very limited set of locations in the image, but the extent of the image is still set to that of the original image being analysed. The remainder of the image may be filled with NoData (or a DN value, such as 0, representing "background"). If lossless compression is being used these superfluous pixels may not cause additional diskspace to be consumed, but the larger than necessary extent may cause issues when further processing combines this data with other data layers.
So it's useful to calculate a new boundary extent which minimizes the extent of the NoData. To phrase it differently. the minimum bounding box of the "real" data extent is calculated and used to clip the data to the most efficient extent that preserves the information present in the image.
Consider this image:
The outer blue rectangle represents the extent of the image. The black pixels are NoData. So we really only want an image whose extent is the yellow rectangle. The NoData pixels beyond the yellow extent can be discarded.
For a single input image it would be relatively easy to manually draw a box to subset the data to the desired extent. However if we have numerous input images to be clipped in this manner we want an automated way to calculate the necessary boundary.
Hence the following Spatial Model
nodata_minimizing_subset_v16_5_1.gmdx |
The screenshot below shows the input image on the left having a large collar of superfluous background around the valid class values. The image on the right shows the automatically generated and clipped data extent of the output of the provided spatial model. Note that for both images NoData was replaced with a valid DN value of 0 (and an opaque color of Black) so that the data extent was visible against a View background that was set to Red.