compute_sliding
- eolab.georastertools.processing.sliding.compute_sliding(input_image: str, output_image: str, rasterprocessing: RasterProcessing, window_size: tuple = (1024, 1024), window_overlap: int = 0, pad_mode: str = 'edge', bands: List[int] | None = None)[source]
Apply a sliding window raster processing operation on an input image and save the result.
This function processes a raster image in small sliding windows, allowing efficient memory management for large datasets by processing chunks. The specified rasterprocessing operation is applied to each window, with options for padding and overlapping windows.
- Parameters:
input_image (str) – Path to the input raster image file to be processed.
output_image (str) – Path to save the output raster image after processing.
rasterprocessing (RasterProcessing) – A processing object defining the algorithm and parameters to apply on each window of the input image.
window_size (tuple(int, int), optional) – Size of each window for processing, default is (1024, 1024).
window_overlap (int, optional) – Number of pixels to overlap between consecutive windows, default is 0.
pad_mode (str, optional, default="edge") – Padding mode for the edges of the windows, default is “edge”. Refer to `numpy.pad <https://numpy.org/doc/stable/reference/generated/numpy.pad.html`_ documentation for valid modes.
bands (List[int], optional) – List of specific bands to process. If None, all bands in the input image will be processed.
- Raises:
ValueError – If specified band indices are out of range for the input image.
Note
This function supports concurrent processing and makes use of a thread pool for efficient handling of multiple windows. Window padding at the image boundaries is applied as specified, and sliding window indices are computed internally.