Raster Forge: Interactive Raster Manipulation Library and GUI for Python

Raster Forge is a Python library and graphical user interface for raster data manipulation and analysis. The tool is focused on remote sensing applications, particularly in wildfire management. It allows users to import, visualize, and process raster layers for tasks such as image compositing or topographical analysis. For wildfire management, it generates fuel maps using predefined models. Its impact extends from disaster management to hydrological modeling, agriculture, and environmental monitoring. Raster Forge can be a valuable asset for geoscientists and researchers who rely on raster data analysis, enhancing geospatial data processing and visualization across various disciplines.


Motivation and Significance
Raster grids are one of the most common data structures for image representation [1,2].Constructed as a matrix of cells or pixels, they are also often associated with the storage, processing and representation of spatial data.Their importance lies in their ability to allow direct matrix computations, thus enabling several important processing techniques, such as segmentation and classification [3,4,5], resampling [6] and interpolation [7].Multispectral images are particularly suited for representation within raster grids, as each cell can store intensity values across different wavelengths.Moreover, this structure is also very significant for its ability to provide an approximate representation of spatial phenomena, especially when coupled with appropriate geographic information [8].
Python is an extremely versatile language with thousands upon thousands of software for a wide variety of applications.Among these are some very influential tools that allow the manipulation of raster data, from powerful libraries such as OSGeo GDAL [9], Rasterio [10] and OpenCV [11], to fully fledged Geographic Informaiton Systems (GISs) like the GRASS GIS [12], ArcGIS [13] and QGIS [14].
While these tools are undoubtedly powerful and feature-rich, they can present certain barriers to entry.For instance, some may find them difficult to install or use, especially those new to GIS or lacking technical expertise.Even seemingly straightforward libraries like Rasterio or OpenCV can present hurdles, as their functionalities often require some degree of research before successful implementation.In addition, the costs of licensing proprietary software such as ArcGIS can be prohibitive for individuals or organizations with limited budgets.
In this paper we present Raster Forge, an easy to use library and Graphical User Interface (GUI), which aims to fill this gap for a beginner-friendly raster manipulation tool for spatial analysis.The library is powerful, direct and thoroughly documented, making its usage very straightforward.Additionally, its intuitive GIS eliminates the need for extensive research beforehand, allowing users to employ it quickly and effortlessly.
Raster Forge places great emphasis on the geospatial capabilities inherent in the raster structure.Although primarily designed to aid in wildfire management, care has been taken to ensure its versatility for more general applications.

Software Description
Raster Forge is divided into two parts: the library and the GUI.The library of implemented functions is detailed in Subsection 2.1, while the GUI application is presented in Subsection 2.2.

Library
The library component is comprised of two container classes, Layer and Raster, which are used to represent a single grid of information and a collection of such grids, respectively.These classes are described with additional detail in Subsection 2.1.1.The processing functions are primarily designed to work with Layer objects, but they also support NumPy arrays (NDArray) [20] as inputs and outputs.

Containers
The Layer class holds the data and metadata of a single raster map, including geographic information and direct statistics, as shown in Table 2.The architecture of this object ensures that all relevant information is easily accessible through its properties.A data import function has also been developed to facilitate the extraction of a single band as a Layer from a raster file (see Table 3).
The Raster class acts as a container for a group of Layers and is associated with an uniform pixel size-or scale-that applies to all constituent layers for uniformity.The properties of this class are described in Table 4, and its main responsibilities include the bulk import of raster data and the manipulation of the Layer collection, as highlighted in Table 5.

Composites
This feature allows the creation of true and false colour composites.It includes gamma correction functionality, allowing the user to select the gamma value to be applied to each individual layer through a power law transformation, I out = I γ in , where I out represents the output intensity or colour value, I in represents the input intensity or colour value, and γ represents the gamma value applied for adjustment.

Multispectral Indices
Users can choose from a broad range of indices provided by the Spyndex [21] package and compute them directly using defined Layers.It also allows the application of a threshold to the index output, which facilitates the generation of binary masks.

Topographical Features
A user is able compute both the slope and the aspect (orientation of slopes) of a region defined by Digital Elevation Model (DEM) data.This implementation utilizes the direct slope calculation formula given by equation 1 and the aspect calculation given by equation 2. In these equations, the variable array represents a set of values, usually a DEM or a grid that represents the surface.The variables x and y represent the spatial dimensions or coordinates within the array.

Distance Field
The distance field is computed from the given dataset, and each pixel of the image is labelled with the distance to the nearest obstacle pixel (non-zero pixel).The data can also be pre-binarized through a provided threshold before processing.

Height Map
Generates a map that displays the vertical distance between the Earth's surface, as recorded in a Digital Terrain Model (DTM), and the highest recorded point, as represented in a Digital Surface Model (DSM).This spatial data provides a three-dimensional perspective to flat vegetation coverage maps.

Fuel Map
Combining vegetation cover, distance fields, canopy height, water features and man-made structures data, and a standard tree height benchmark, this functionality can produce a detailed fuel map for the geographic region of interest.The process integrates three distinct fuel models, including solely vegetative, standalone trees, and mixed vegetation, resulting in a depiction of fuel distribution across the landscape.

Graphical User Interface (GUI)
The GUI has been developed using PySide6 [22] and comprises three distinct panels, as shown in Figure 2. One panel is dedicated to importing data and managing Layers, another panel facilitates configuring and triggering processes, while the third panel serves as a data viewer, allowing users to visualize the layers being worked on.
In this context, a layer refers to an array or group of arrays, which are treated as cohesive data groups.
To simplify importing data, a dedicated window has been designed to enable users to select a file, as depicted in Figure 3. Within this window, users can preview the file's composition, including the number of bands it contains.Users can select bands to import and specify the desired scale.Additionally, the window displays the predicted width and height of the resulting array, aiding users in assessing the computational resources required for any further processing.
After the layers are imported, they are displayed on the Layer list, as depicted in Figure 4.Each layer offers four distinct functionalities: viewing the layer, editing the layer identifier, accessing layer information, and deleting the layer.Layer information is presented in an information window (see Figure 5) consisting of three tabs: metadata, statistical data, and a value histogram.
Once the layers are loaded, they can be used in various processes.All processing functions in the library are accessible through the GUI.When selecting a process, an adaptive panel displays all necessary inputs.The process can be initiated once all inputs are fulfilled, as shown in Figure 6.Once activated, the data is displayed      on the viewer and can be saved in various formats: as a layer for reuse in other processes, as an image with the applied colormap, or as a raw TIFF file containing all geographical information of the area.The information window for the currently viewed data is available directly on the viewer panel, even if it has not been saved as a layer yet.

Impact
Raster Forge has had impact in a few projects already.The software has been used to compute terrain feature maps from Unmanned Aerial Vehicle (UAV) imagery [23].This permitted to easily showcase results including multispectral index and vegetation coverage maps, as well as water and man-made structures masks.An early iteration of this software was also used to compute fuel type maps-along with the components necessary to build those maps, such as canopy height, vegetation coverage and soil bareness-that were integral in processing UAV data for testing/validation of a wildfire simulation model [24].Finally, in a similar way to the previous solution, the library component of this software is also currently being used in the development of a web wildfire simulation application under the DAIS Project [25].Expected Raster Forge short-term future impact centers around providing faster processing of large-scale aerial data for several ongoing studies.The software is being utilized to aid the construction of topographical and land-cover datasets for quickly producing terrain feature maps, such as elevation, canopy height, and vegetation density.These datasets will then be employed to train a diffusion model with the aim of generating synthetic topographical and land-cover data for wildfire model testing.In addition, Raster Forge is also being used to generate fuel maps and their sub-components (distance fields, vegetation density, man-made structures, and water feature masks, etc.) to test and validate in-development land cover and fuel type classification methods.These fuel maps are also being employed as auxiliary data to support the conceptualization and preliminary testing of a novel time and space continuous Cellular Automata (CA) wildfire model.The impact on the described studies is already being felt, as the ease-of-use and capabilities of Raster Forge are significantly expediting the data harmonization stage, thus substantially reducing the expected development times.
From the emphasis placed on the geographical aspect of each raster, Raster Forge potential impact will likely be felt in the field of remote sensing, particularly where it intersects with wildfire management.However, we believe that Raster Forge has the capability to streamline raster data processing across many other fields of study in which raster data manipulation is a fundamental concept, including medical imaging [26,27], architecture [28,29], and planetary [30,31] and interplanetary [32,33] remote sensing, broadening its potential impact.

Conclusions
In conclusion, Raster Forge provides a solution for manipulating raster data, specifically designed for remote sensing applications such as wildfire management.The Raster Forge library offers a range of functions for raster processing, including composite generation, multispectral index computation, topographical feature extraction, and fuel map creation.Its included GUI is user-friendly, streamlines the use of the functionalities of the library and simplifies data import, layer management, process configuration, and result visualization.This enhances accessibility for users with varying levels of expertise.Raster Forge has potential applications in diverse fields such as disaster management, hydrological modeling, agriculture, and environmental monitoring, positioning itself as a valuable tool for geospatial data analysis and visualization tasks.

Figure 2 :
Figure 2: The GUI is arranged into three distinct panels: the layers panel located at the top-left, the processes panel positioned at the bottom-left, and the viewer panel situated on the right.

Figure 3 :
Figure 3: Layer import panel showcasing its initial state (a) and after selection of a file (b).The predicted values for width and height dynamically adjust based on the chosen scale.

Figure 4 :
Figure 4: Upon importing layers, the graphical user interface (GUI) offers access to layer functionalities.For each layer, four functionalities are available, namely: view layer, edit layer's name, access layer information, and delete layer.

Figure 5 :
Figure 5: Layer information panel composed of three tabs: metadata, statistical insights, and value histogram.

Figure 6 :
Figure 6: Creating a (a) true color composite, and a (b) multispectral index map.The adaptive panel inputs are located within the processes panel, alongside the functionalities accessible within the view panel once an image is being viewed.These include zoom options, colormap selection, and various saving actions

Table 1 :
[20]ary raster manipulation processes.NDArray is an array type provided by NumPy[20]and represents a multidimensional, homogeneous array of fixed-size items.

Table 5 :
Raster object methods.Layer from the Layers Dictionary.