## 3 Image Processing Workflow
### Mineral Correction  
Once QEMSCAN and MAPS images are aligned, MAPS imaging has the capability of conducting feature recognition and correction on various minerals. Owing to the grayscale of MAPS images, the information mainly reflects the density characteristic of each pixel; thereby, the grayscale shade of each point on a MAPS image is reflective of the compositional density. For instance, dark to black areas mainly represent porosity or organic content in rocks, and, in general, porous sections appear lower on the grayscale. Lighter areas mainly represent high-density minerals in rocks, such as pyrite. As a result, greyscale information should provide the best visual determination of mineral type, through which the threshold method can be used for judgment. In addition, because most minerals are composed of some combination of Si, K, Na, Al, and Mg, the middle grayscale range (e.g., 100-200) included numerous mineral types. These minerals can have close grayscale values. Therefore, the grayscale information should be used in combination with other characteristics, such as the grayscale texture of the particular mineral, and the determination of mineral type. Based on this, mineral correction is performed through a combination of these characteristics and QEMSCAN mineral identification results. Figure 2: Schematic diagram showing affine transformation on a solid object. According to the aforementioned analyses, the correction of minerals should initially combine QEMSCAN and MAPS images mainly with mineral type data from a grayscale range. Correction should also be inclusive of the distribution of characteristics of various minerals, and comprehensive particle morphology. Specifically, minerals can be classified into the following categories, using different correction methods (Table 1):  
Type I: Compositions with distinct grayscale features; threshold segmentation can be directly conducted on MAPS grayscale images to classify components or minerals, such as those having organic material, pores, and pyrite. At the same time, because segmentation along edges typically has one grayscale gradient band, other targets require certain expansion operations after thresholding to restore the objective of determining the actual morphology. Type II: For minerals with more dispersed particles, better particle contour morphology, small grayscale range, or low grayscale ratio (that is, when the MAPS image is segmented at a threshold, the target mineral will not be segmented together with other minerals, which will result in over-segmentation). These include, but are not limited to, minerals such as apatite, rutile, and siderite. Firstly, the MAPS image can be segmented by grayscale information and multiple target areas with smooth contours and edges can be obtained. Following this, the obtained area and the corresponding area of the mineral on the QEMSCAN image are compared and judged by morphological methods. The method is described as follows: In Figure 3A, the blue region represents a MAPS image after threshold segmentation into several regions, whereas the orange region represents the target mineral corresponding to the QEMSCAN image. The total surface area S2 of the orange region in a blue region was determined and the proportion of S2 in the surface area S1 of that blue region was calculated. A threshold (th) of that proportion was established (e.g., 80%). If S2/S1 \(\geq\) th, the S1 area was identified as the target mineral and was expanded to a certain degree to obtain relatively realistic mineral particles (regions labeled a and e of Figure 3A). In the other case, the pattern was not associated with the target