Three-Dimensional Separation and Characterization of Fractures in X-Ray Computed Tomographic Images of Rocks

Open fractures can affect petrophysical properties of their host rock masses, as well as fluid transport and storage, so characterization of them is important to both industrial and research scientists. X-ray Computed Tomography (CT), a non-destructive technique for 3D imaging of various materials, shows such fractures well in rock samples. However, separation and characterization of fractures in CT data is complicated when a scanned sample contains narrow and intersecting fractures, because narrow fractures become blurred when thinner than the scanner resolution and their value approximates that of the matrix, and because intersecting features are difficult to individually characterize. In this paper, we present a new approach for an objective and efficient characterization of the fracture network inside CT scans of rock samples. We have developed algorithms, implemented as Python scripts, that measure fracture aperture-related parameters, and that separate connected fractures and fracture intersections within CT images of the sample. The CT images are composed of stacks of 2D images in the plane parallel to X-Y (equally spaced), where each pixel has a value related to the attenuation of the X-rays within the materials that make up the sample at that location and is generally displayed using a gray-scale colormap. As the gray values in the reconstructed images drop within fractures, our algorithm is able to identify such drops and record the lowest gray value in every drop as a Fracture Trace Point (FTP). For every FTP, parameters related to the local fracture width and the three-dimensional orientation of the FTPs surrounding it are measured. A second step involves the separation of individual fractures and their intersections points. This allows information about a number of FTP measurements on the same fracture (or intersections) to be combined to characterize that feature. We demonstrate that our methods better quantify fractures and their intersections through analysis of an experimentally-deformed granite sample, within which we characterize fracture size, orientation, and intensity. The methodologies can be also used to characterize sub-planar features in other types of datasets. Python implementations of our algorithms are freely available on GitHub repositories.


INTRODUCTION
Open fractures are three-dimensional (3D) structures that are typically planar-like. The fracture walls also typically have rough and irregular surfaces that strongly affect how natural fluids can flow through or be stored in them. Fluids flow through them on convoluted paths that follow the minimum resistance generated by the local pressure gradients, which strongly depend on the local fracture aperture and roughness (Liu et al., 2016;Luo et al., 2016;Makedonska et al., 2016;Zambrano et al., 2019). Number of fractures, their sizes and geometries also impact generation of space and connections thus the storage and transmissivity of fluids (Long and Witherspoon, 1985;Hyman et al., 2016;Liu et al., 2016;Makedonska et al., 2016;March et al., 2018). To truly characterize these fracture properties, it would be best to observe them in their undisturbed state through the surrounding rock massin other words to image their geometry in 3D rather than physically breaking them apart.

X-ray Computed Tomography Technique
A 3D imaging technique commonly used in geology is X-ray Computed Tomography (CT). This is a non-destructive methodology that allows various types of geological information to be extracted from 3D images of solid objects (Wennberg et al., 2009;Kyle and Ketcham, 2015;Voorn et al., 2015;Schmitt et al., 2016). The interior of the scanned sample is imaged by analyzing the attenuation of X-rays due to scattering and absorption as they pass through the sample, which is measured by the detector of the X-ray CT scanner.
For geological materials, the dominant physical processes responsible for X-ray attenuation are the photoelectric effect and Compton scattering (Ketcham and Carlson, 2001). These processes are primarily a function of the atomic number (Z) of the sampled material they are passing through and so are most sensitive to differences in composition. Thus, CT images are ideal for exploration of the 3D distribution of different phases in geological samples. The outcome of a scanning and reconstruction operation is a two-dimensional stack of equally-spaced images, which can be assembled by specific software into a three-dimensional image where the basic unit is called a voxel (volumetric picture element). Each voxel has a unique gray value that is related to the attenuation of the X-rays within the material making up the core at that location. An example of the gray scale variation within a scanned rock is displayed by the different phases of a felsic lava in Figure 1A. However, an absolute correlation between gray values and the attenuation coefficient of the materials is not possible. This is because scanning artifacts (particularly Beam Hardening, a common artifact that makes scan borders brighter for every phase) and effects of scanner resolution, such as the Partial Volume Effect (Ketcham, 2006), mean that any phase will present a different gray value in different parts of the scan, even though its attenuation coefficient is a constant (Ketcham and Carlson, 2001).
Different CT configurations may be used depending on the scale of interest and on the information the work is designed to extract: synchrotron-hosted systems can image small samples (< 1 cm), and generate voxels in the range of nm-µm (Withers, 2007;Fusseis et al., 2014); micro(desktop)-CT (µCT) is typically used for geological hand specimen (i.e., centimeter)-sized samples generating images with a voxel size of ∼10-20 µm 3 (Voorn et al., 2015); while medical CT scanners can easily scan core sized samples generating voxels in the mm range (Williams et al., 2017;Williams et al., 2018).
The analysis of CT images commonly follows this workflow: pre-processing, segmentation, labeling, and quantification. During the pre-processing phase, the image is commonly cropped and filtered to reduce both the size of the data (with a corresponding decrease in computation time) and image noise for a better segmentation of the feature of interest (FOI) ( Figure 1B). To best separate the FOIs during the segmentation process, the image is binarized into two materials around a threshold, where voxels with a gray value within the threshold will be set to a value of 1, and all others to 0 (Wildenschild and Sheppard, 2013) ( Figure 1C). In the next step, the objects with value of 1 (i.e., the FOIs) are separated and each is assigned a different label value ( Figure 1D) so that individual measurements may be performed on each labeled object during the last step of the analysis (Kaestner et al., 2008;Wildenschild and Sheppard, 2013). Three-dimensional characterization of number, size, orientation, geometry, and shape of the FOIs can then be undertaken (Ketcham, 2005;Voorn et al., 2015;Schmitt et al., 2016).

METHODS
The work described in this paper was carried out to optimize fracture separation and characterization in the complex fracture networks typically found in CT images of natural materials. We Frontiers in Earth Science | www.frontiersin.org November 2020 | Volume 8 | Article 529263 2 investigate the capabilities of the algorithms developed through analysis of a fractured granite rock imaged with a medical CT scanner with a voxel size of 0.097 mm × 0.097 mm × 0.4 mm.

Limitations of Computed Tomography for Fracture Analysis
Separating narrow planar features through segmentation of FOIs in CT scans is a common problem in the image analysis of rock samples. Small features are typically blurred to some extent due to the Partial Volume Effect (PVE), which increases their gray value and thus reduces their contrast with the surroundings (Ketcham and Carlson, 2001;Ketcham, 2006;Ketcham et al., 2010;Voorn et al., 2013). PVE is a consequence of the true resolution of the scanner, which can be described in one-and two-dimensions by measuring the Line Spread Function (LSF) or Edge Response (ER), and the Point Spread Function (PSF), respectively (Smith, 1997;Smith, 2003;Ketcham, 2006). Therefore, using a classical methodology of thresholding based on greyscale, these features can only be separated if we set the threshold above brighter (high gray value) voxels. This operation increases the amount of noise in the binary image and widens larger fractures, which could result in overestimation of the true rock porosity, creation of artificial connections, and loss of small features if the local background value is within the threshold range applied.
Previously, a few approaches have been proposed to overcome this problem (Peyton et al., 1992;Johns et al., 1993;Verhelst et al., 1995;Christe, 2009;Ketcham et al., 2010;Voorn et al., 2013), but these all suffer from one or more of the following limitations; i) they are not easily applied to complex datasets (e.g., they are only able to properly analyze one fracture in a whole 3D image), ii) they require expensive commercial software, or iii) long computation times, iv) they are not automated, and v) they are not based on published code. For this reason, we are publishing the documentation and the associated Python source code for a methodology we have developed for the analysis of simple or complex networks of fractures in CT data. The algorithm we implement and demonstrate through analysis of a real dataset allow the extraction of local fracture information (aperture and orientation) efficiently and quickly, even if a high threshold gray value causes widening of bigger structures and loss of small features in a darker background.
CT images of natural samples typically contain complex networks of intersecting fractures that are difficult to define in three dimensions. The main difficulty is separating individual fractures and performing discrete measurements for every planar feature in the system. Two or more fractures connected in three dimensions (3D) are typically labeled as a single object and characterized as a whole. During measurement of the segmented FOIs, unique values describing size, shape, and orientation of every label (object) are returned. If these measurements refer to a substantial number of such "composite objects", the results will be biased, and the geological interpretations limited. The algorithm we have developed examines a binary image of a fracture network and performs a 2D skeletonization of each slice (Lee et al., 1994). It can then deconstruct connected fractures in this skeletonized binary image and isolate individual fractures in intricate systems so that reliable and detailed measurements can be performed. Our approach also allows fracture intersections to be described and explored, which can facilitate better understanding of fluid transmission in rocks (Long and Witherspoon, 1985;Liu et al., 2016).
The algorithms presented in this work are implemented in Python, an open-source programming language widely used in the scientific community for various computing purposes, including image processing, and can be executed from the command line (Oliphant, 2007;Van der Walt et al., 2014;Gouillart et al., 2016). The source codes of the algorithms applied in this paper are available online (https://github.com/ fscpp) in the repositories named "Fracture-Trace-Point-Analysis" (Fracture Trace Point Analysis) and "Fracture-Separation-Analysis" (Fracture Separation Analysis), and we encourage collaborative application of them to characterize planar features in new datasets.

Fracture Trace Point Analysis
Despite the blurring caused by the PVE, the gray value generally falls below "background" within open fractures ( Figure 2). The code takes advantage of this by running a series of horizontal and vertical traverses across each slice of the CT image, identifying each drop in gray value as the signal of a fracture if it presents a valley and two adjacent peaks. For each drop, the pixel with the lowest gray value is marked as a "Facture Trace Point" or FTP. The algorithm can pick all the possible valleys in the signal;  however, depending on the FOI to characterize, the user intervenes by providing a binary image and selecting to focus only on the fractures of interest. The total dataset of FTPs contains the local centers of all fracture traces in the images, which are then separated for further analysis.

Fracture Aperture
Every drop in the gray value comprises two peaks and one valley, the latter corresponding to the FTP. Several methods have been previously proposed to calculate the aperture of a fracture. The standard method is based on the "Full-Width-Half-Maximum (FWHM)", which assumes the fracture width at the half-height between the air and the rock matrix gray values ( Figure 2). The method is reliable for features larger than the scanner resolution and close to the air value (Peyton et al., 1992;Ketcham, 2006;Ketcham et al., 2010). However, this method may not work when the fracture is narrower than the scanner resolution, which can be described (in pixels) by the Point Spread Function (PSF), Line Spread Function (LSF), or Edge Response (ER) (Smith, 1997;Smith, 2003;Ketcham, 2006;Ketcham et al., 2010). The ER is easy to measure and yields a simple description of the onedimensional resolution of the instrument based on the distance of blurring (i.e., smoothing) occurring along the (theoretically sharp) transition between two different materials (e.g., air-matrix). More precisely, the ER is the distance (in pixels) between 10% and 90% of this transition. LSF is another onedimensional parameter of resolution and corresponds to the derivative of the edge response. PSF is a 2D parameter of resolution containing information about the resolution in all directions, but it is difficult to measure (Smith, 1997;Smith, 2003). Two alternative methods that rely on using the loss (blurring) of the signal to compute the aperture of a fracture are the Missing Attenuation (MA; Johns et al., 1993) and Peak Height (PH; Verhelst et al., 1995) methods. These methods were evaluated by Keller (1998), Van Geet and Swennen (2001), Vandersteen et al. (2003), Mazumder et al., (2006), and Ketcham et al. (2010). MA considers the area of the drop, whereas PH is the measure of the height between the matrix value and the FTP ( Figure 2). Both parameters can be used to convert the area and height of the anomaly (i.e., attenuation deficit) to the true size of the fracture because they are approximately linearly correlated (Johns et al., 1993;Van Geet and Swennen, 2001;Ketcham, 2006). MA can be applied on heterogenous samples and is less noisy for wide fractures but (similarly to FWHM) it is influenced by the direction of measurement and must be corrected for the apparent dip effect if the traverse is not orthogonal to the fracture. Conversely, PH cannot be applied to features larger than the sample resolution, thus requiring a prior calibration. Since this parameter is dependent on the height of the negative anomaly, it is only reliable for homogeneous materials that present peaks of similar gray values. PH is, however, less noisy than MA for small apertures and does not require corrections for the orientation of the fracture (Vandersteen et al., 2003;Ketcham, 2006;Mazumder et al., 2006;Ketcham et al., 2010).
During each traverse, our code records the 3D location (x, y, and z) of every FTP. The ER (10-90% of the valley-peak distance), and the FWHM (px), PH (dimensionless), and MA (dimensionless) related to the drop are then analyzed ( Figure 2). Even if small structures are hidden because they lie in a low gray value area where they are surrounded by a matrix that has a value within the threshold applied, the FTPs related to these features can always be detected as long as they have a peakvalley-peak structure. A subsequent step measures the threedimensional orientation of any of these voxels in order to convert the apparent aperture to the true one.
The sample we analyzed here is not homogeneous and unsuitable for PH analysis, so the latter method was not considered for aperture measurements from that dataset.

Fracture Orientation
The separated fracture trace points are recorded in a new 3D image that is subsequently queried for a voxel-by-voxel orientation analysis. A cubic crop of customized size (set by the user to an appropriate value for the dataset) is set around every FTP, including all neighboring FTPs ( Figure 3). The threedimensional arrangement of these neighborhood FTPs is investigated using a Principal Component Analysis (PCA). PCA is a widely-applied computational method that detects the principal structures in complex datasets (Shlens, 2014). We apply it first by computing the covariance matrix for the FTPs inside the cropped cube. The three-dimensional data yield a 3 × 3 symmetrical matrix (M), representing the covariance between dimensions (1) The three principal components (i.e., eigenvectors) of M [PC 1 , PC 2 , PC 3 ] are determined. These principal components are orthogonal to one another and describe the variance of the data: PC 1 indicates the direction of the main distribution Frontiers in Earth Science | www.frontiersin.org November 2020 | Volume 8 | Article 529263 mean, PC 2 the second direction, and PC 3 the third (Woodcock, 1977;Vollmer, 1990). As a result, PC 1 and PC 2 are vectors lying in a plane that best fits the data points and PC 3 is the normal of that plane (green vector in Figure 3A). We define a reference system with two vectors parallel to north and a zenith ("+y" and "−z," respectively, in Figure 3B) and extract the orientation (dip angle and dip direction) of the analyzed FTPs by measuring the angles between PC 3 and these vectors. Many rock cores come from (near) vertical boreholes, so depth increases along the long axis of the core (i.e., the z-axis). For this reason, we set the north vector on the y-axis and the zenith on the z-axis (+y and −z vectors, respectively, in Figure 3B).

Outcome of the Fracture Trace Point Analysis
At the end of the analysis, the measurements performed on the FTPs are stored in text files reporting the location (image x, y, z), the gray value of the FTP, the Edge Response (ER) value, aperture-related parameters (FWHM, MA, PH), and orientation for every fracture trace point. To give an idea of the amount of data that can be generated, consider a sample with CT volume of 100 × 100 × 100 voxels (image x-, y-, z-axis) containing a single fracture perpendicular to the x-axis. In this case, 100 fracture trace points will be analyzed in each slice, and there will be around 10 4 FTPs. This amount of data allows a very detailed and local characterization of the studied fracture system.

Fracture Separation Analysis
A second algorithm analyzes a binary image containing connected fractures. It implements several processes to identify and separate intersections and individual planar features so these connected features can be individually characterized. Several inputs need to be provided by the user in order to best fit the analysis to the shape of the features to separate.

Separating Intersections and Fracture Segments
For every slice of the binarized image, a 2D skeletonization is performed ( Figure 4A) (Lee et al., 1994). This minimizes the subsequent computation time by reducing the number of nonzero values, simplifies the geometry of the structures (so they assume a linear aspect), and preserves the continuity of the fractures along the z-axis (which does not happen with a 3D skeletonization that shrinks the image along every axis). The results of this processing are referred to as a "fracture trace". A 3 × 3 window is then centered on the x-y position of each fracture trace pixel and isolates the local structure inside the window area. The number of regions present in the window is related to shape of the structure inspected. For pixels relating to a single fracture, one (in case of fracture tips) or two regions are measured ( Figure 4B); while three or more labels are measured if there is a connection between fractures within the window ( Figures  4C,D). In the latter case, the pixels in the window are removed from the image, which thereafter leads to disconnected twodimensional fracture segments ( Figure 4E). Once the whole fracture system is decomposed in this way, individual planar features are reconnected by examination of similarities between fracture sections.

Connecting Fractures
Once intersections have been removed and fractures separated into segments, the algorithm estimates slice-by-slice the 2D centroid and 2D orientation (by means of the first principal component PC 1 ) of each segment. The centroid is the average position of the segment, calculated as the mean coordinates of its constituent points. At each intersection, the segments enclosed in a small 2D window centered at the intersection are analyzed. The segments are paired (set to the same value) provided they meet geometrical and orientation criteria. In detail, the segments present in the window are inspected in twos and the algorithm creates all the potential pairs if the difference in orientation between these is lower than a user-defined threshold (orientation criteria). Then, the algorithm decomposes the cropping window in quadrants of Cartesian planes where the connection is the origin. Generally, the disassembled segments lie in different quadrants, as do their centroids. Thus, the algorithm chooses the pair of segments whose centroids lie in diagonal quadrants, since they commonly belong to the same structure (geometrical criteria), and labels them with the same value. Additionally, the algorithm: Frontiers in Earth Science | www.frontiersin.org November 2020 | Volume 8 | Article 529263 5 (i) measures the local orientation of the segments close to the intersection (customizable in pixels) for a more robust pairing of irregular features (i.e., non-planar and/or bending FOIs); (ii) performs a check of the connections already made in the previous slice in order to preserve the three-dimensional continuity of the fracture pairing; and (iii) checks if segments are parallel to one another and so, even if they fit the both orientation and geometry criteria for pairing, they are not paired because they lie on two different planes.
The thresholds and window sizes requested as inputs by the algorithm should be chosen by the user to best describe the geometry of the FOIs under analysis. For example, the twodimensional shape of the fractures and vicinity of intersections points can affect the value of the thresholding parameters applied (e.g., orientation thresholding and window size, respectively).
After all segments have been linked in each slice, new centroids and orientations are measured. The algorithm then uses these data to connect the features in 3D. Every element present in the nth 2D slice is compared to the closest one in the (n+1)th slice by means of k-nearest neighbors (k-NN) (Mladenović and Hansen, 1997;Maneewongvatana and Mount, 1999). If a connection is not established by this rigorous correlation method, the algorithm then considers connections based on centroid distance. The assumption is that fracture segments that lie in the same plane in 3D are close to one another. Therefore, the segment in the nth slice can be paired with the related one in the next slice if the latter presents a similar orientation, a similar size, and its centroid is within a specific distance from the first. Slice-by-slice, 2D segments are paired along the z-axis until all the 2D fracture traces lying on the same plane are uniquely labeled ( Figure 5B).
Finally, the orientation of each individual fracture can be measured using the third principal component (PC 3 ), which corresponds to the fracture's normal direction.
Pixels related to the removed intersections can also be paired in 3D and labeled by checking all those connecting two different fractures along the z-axis. In this way, their orientation can be computed using the first principal component (PC 1 ), which describes the line that best fits these connection points.

RESULTS AND DISCUSSION
In combination, the FTP detection and fracture separation methods we have designed and coded yield characterizations of fracture systems that are substantially more detailed than any previously described. In this work, every point in the separated fractures and fracture intersections is related to its closest FTP using the k-NN algorithm, but only the FTPs within a specific distance threshold (6 pixels radius) that are not already paired are used for subsequent analyses. This ensures that local structural variations are only assessed and compared for individual features.

Test Sample
The test dataset we use here to demonstrate the algorithm's capabilities is a fractured granite imaged with a Siemens medical X-ray CT scanner SOMATOM Definition AS with a beam energy of 120 keV and a voxel resolution of 0.097 mm × 0.097 mm × 0.4 mm. The sample was imaged within 512 × 512 × 180 voxels; of those 180 slices, only 160 were of reasonable quality for extracting quantitative information (slices at top and bottom of the core were darker and blurred). Then, 100 test slices were chosen in the most fractured part of the sample to demonstrate the capabilities of our algorithms and provide a small dataset that Frontiers in Earth Science | www.frontiersin.org November 2020 | Volume 8 | Article 529263 6 future users can easily practice with on personal computers. The test data can be downloaded from the repository named "Testsample-and-scripts" on Github. The image was first processed using the commercial image processing software Avizo® (Thermo-Fischer Scientific, 2018) through the following steps: a filter was used to remove beam hardening artifacts; a region of interest (ROI) with a size of 370 × 370 × 100 voxels was cropped ( Figure 6A); a binary image of the fractures was obtained ( Figure 6B); from this image FTPs were detected and individual fractures separated ( Figures 6C-E).
A total number of 29 fractures were detected in the sample. Of these, the largest 5 account for ∼96% of the volume of the system ( Figure 6E). Since these five features provide a substantial number of data points (FTPs) to analyze and the characterization of all the fractures is beyond the scope of this paper, only these 5 features are examined in further detail. They are assigned the names F-1, F-2, F-3, F-4, and F-5, in order of decreasing size.

Fractures Aperture and Roughness
Filtering of the data is necessary to obtain a reliable correlation between missing attenuation (MA) and true aperture. To set an appropriate filtering protocol, first, the width of the edge response (ER) was measured in traverses across several fractures, yielding an average ER value of ∼11 px. From previous studies is known that FWHM measured on features bigger than the scanning resolution value and close to air value should reflect the true fracture aperture of the FTP at that position (Johns et al., 1993;Van Geet and Swennen, 2001;Ketcham, 2006;Ketcham et al., 2010). Consequently, FTPs with an ER higher than 11 px in size and a low gray value were considered in this calibration. The apparent dip effect for FWHM and MA was also corrected for, using a local orientation computed by principal component analysis.
In the end, the corrected FWHM and MA from the filtered FTPs were plotted and a linear best fit was made to the data. This can be used to assess the fracture aperture from the MA recorded in smaller fractures, where FWHM cannot be used (Figure 7).
FTPs data were grouped for each fracture by means of k-NN and, using the linear fit equation from Figure 7, the aperture was measured for every FTP lying on the fracture plane. The arithmetic means (a m ) and standard deviations (σ a ) of the apertures were measured ( Table 1). F-1 is the largest fracture, both in terms of size and mean aperture (0.313 mm); followed by F-2 (0.184 mm). F-3, F-4, and F-5 have similar apertures, in the range 0.125-0.134 mm. . The binary image was skeletonized and analyzed in order to disassemble the fracture system into segments (C) then these segments were re-connected when they were recognized to lie on the same fracture plane based on criteria described in Fracture Separation Analysis (D,E). The skeleton of the segments (C,D) has a theoretical width of 1 pixel; however, for visualization purposes, their width was slightly increased. The surface roughness (or just roughness) is the deviation of a surface from a perfect planar geometry. A variety of 2D and 3D methods and parameters exists to measure roughness (Gadelmawla et al., 2002). In this work, we have measured the roughness of the separated fractures in the same way as suggested by Zimmerman et al. (1991) and applied by Keller (1998), as the ratio between the fractures' standard deviations and the arithmetic means of their apertures (σ a /a m ). In the case of a perfectly parallel-sided fracture, the standard deviation value is zero, therefore roughness is also 0. The results of this analysis ( Table 1) show that F-1 has the least rough surface (0.568) within the 5 inspected fractures, and that F-3 is the roughest (0.720). F-2, F-4, and F-5 have similar, intermediate values of roughnesses (around 0.700).

Fracture Intensity
Fracture intensity is one of the most important parameters to describe a distribution of fractures, but it is not always easy to characterize. Several standards that have been developed to describe the intensity in one, two, and three dimensions are explained in more detail by Dershowitz and Herda (1992). In this work, fracture intensities are estimated by a method where, for each slice, total fracture trace length is divided by the rock trace plane area (Figure 8). This yields P 22 which is accepted as a reliable 2D measure of intensity, and can also return information about how fractured a rock sample containing open or closed fractures is along the z-axis (Dershowitz and Herda, 1992;Aliverti et al., 2003). P 22 was measured both for individual fractures and for the entire set of fractures to better understand the way that individual fractures impact the bulk dataset.
We find that the intensity of the bulk fracture system within this sample increases along the z-axis (black line in Figure 8), but that this increase can be attributed to the combined effect of the 5 largest individual fractures. The other 24 small fractures identified within the sample, and colored in gray in Figure 8, are fairly smooth and not subjected to further no analysis since their contribution to the global density profile (in black) is negligible. However, of the large fractures, only F-1 and F-2 transect the whole sample, whereas F-3 and F-4 develop at slices ∼10 and ∼40, and end around slice 70 and 90, respectively, and F-5 extends from slice ∼65 to the bottom of the sample. The appearance and disappearance of these large fractures has a significant impact on the bulk 2D fracture intensity.
The 3D fracture intensity can also be approximated by the parameter P 32 , which is the area of fractures per unit volume of rock (Dershowitz and Herda, 1992). It can be computed by FIGURE 8 | Two-dimensional fracture intensity variation across the core (P 22 ) for the whole fracture system (black line) and individual fractures (colored lines). P 22 is measured for each slice as the total fracture trace length divided by trace plane area (mm/mm 2 ). summing the area of all the voxels contained in fracture traces and dividing them by the total volume of the scanned rock. In our sample, P 32 is equal to 7.36 × 10 −3 mm −1 , indicating a moderately damaged rock (Rogers et al., 2015) .

Fracture Orientation
It is difficult to precisely estimate the individual orientations of a set of (sub)-planar FOIs that are connected in a binary image. This is because all the sub-structures making up an object are included in the analysis. If a single label includes two intersecting or bifurcating fractures, the orientation measured is the average of these two features, rather than that of any individual feature. We have recognized that it is possible to separate and measure the orientations of the intersecting features by defining a 3D cropping window around each FTP. We measure the local orientation of each FTP only within this window. The method is robust except in very close proximity to intersection points, when FTPs belonging to other fractures fall within the cropping window and can affect the analysis. However, the number of FTPs related to these connection points are dependent on the size of the cropping window and extremely small if compared to the ones recorded in the fracture planes.
We illustrate orientation distributions of the poles to planes measured at each FTP and on individual planes in the test sample in Figure 9. The dominant trends of the poles to plane for the FTP orientations (in an arbitrary reference frame) are ENE-E, and two lesser concentrations trend ESE and S. The dips of all features are generally greater than 60°(i.e., their poles mostly plunge < 30°). Measuring poles to planes from individual fractures ( Figure 9B) provides similar results to the FTPs local analysis but reveals small features that are partially hidden in the former analysis. Indeed, poles trending SSE and NW were not evident in the very small number of data points derived from the FTPs local analysis ( Figure 9A). Larger structures comprise more FTPs, so the contour plots ( Figure 9A) are somewhat biased, but they still provide important information about the minor structures in the system.
Additionally, local strike and dip variations of each fracture can be explored using the orientation measurements of their FTPs. We measured both the standard deviations and arithmetic means of the dip angles and dip directions (σ da , σ dd ) of the FTPs of individual fractures. The results for the biggest fractures are shown in Table 2. The dip angles estimated for F-1 exhibit the highest variation (∼8°), while those for the other fractures are similar and smaller (between ∼4°and ∼6°). Conversely, the strike direction angle considerably varies in F-3 and F-5 (70.5°a nd ∼53°, respectively); while, F-1, F-2, and F-4 have similar values ranging from a minimum of ∼39°to a maximum of 45°.

Intersections
During the fracture separation analysis, intersections are removed from the binary image, but the algorithm records their coordinates so that they can be inspected and characterized in similar ways to fractures. Intersection points are grouped based on the labels they are connected to, and their orientation is computed as the best fitting line (PC 1 ) by principal component analysis. The results are plotted ( Figure 10A), in a way that highlights intersection length (along the z-axis) using both the color and size of the diamonds, revealing that only 3 have substantial lengths, of 60, 52, and 41 voxels. All the intersections plunge steeply, and most trend between S and NW. In order to check the accuracy of the measurements made on fractures and intersections, the orientations of the latter were also geometrically calculated as the intersection lines between the planes they are connecting ( Figure 10B). These two approaches return similar results, and the data cluster in the same region of the stereonet, validating our automated analytical method.
Apertures were also calculated using MA (as described in Fractures Aperture and Roughness) for FTPs identified to be related to intersections by the k-NN algorithm ( Table 3). Since our aim is to show the applications of the methods involved in this paper, rather than describing all possible FOIs, the aperture was calculated only for the biggest intersections, which are named by their size: I-1, I-2, and I-3. These features connect the five large fractures analyzed above, in particular: I-1 connects F-1 and F-2; I-2 connects F-1 and F-3; and, I-3 connects F-2 and F-5. The mean apertures of these intersections are, respectively, 0.276 mm, 0.182 mm, and 0.172 mm. The mean apertures of all other intersections range from a minimum of 0.036 mm to a maximum of 0.502 mm.

Advantages and Constraints
The methods described in this paper provide a different and more detailed characterization of fractures in CT images than any preceding study. Particular advances we have made include: (1) The FTP algorithm allows the tracking of the fractures through the images, and the preservation of the structures that would have been hidden by high thresholding values in other analyses.
(2) This algorithm also extracts a substantial amount of local data, referenced in CT space, that can be used to compute critical fracture parameters, such as mean aperture, roughness, and fracture intensity. These data could also be analyzed in ways we have not described, and thus further applications may be developed by those who use our script in the future. (3) It is possible to extract information about the orientations of different features from either a whole connected system or individual FOIs by means of the orientations measured at the FTPs.
(4) Fracture aperture parameters such as MA, PH, and FHWM are automatically recorded from a whole CT dataset. In case of calibrated cores, PH may also be used to better characterize smaller features. (5) The fracture separation algorithm separates the skeleton of individual features inside a system made up of more structures (e.g., fractures). This allows a better characterization of the FOI orientations inside the system. (6) The algorithm is flexible and the input threshold values for pairing segments in 2D and 3D can be defined by the user, based on the geometries present in the image, for a better analysis. (7) The source code implementing our algorithm is made freely available to the research community. This allows for comparative evaluation and further development of the approaches in the future.
Disadvantages in the algorithms applied: (1) The binary image used for filtering the FTPs must be only composed of fractures. If pores and/or noise are present, FTPs related to these features will be included in the data and bias the analysis. Image denoising filters ( Figure 1B), which can reduce the noise inside the image, and morphological (e.g., closing) and/or shape-based filters, which can remove pores from binary images, are not currently implemented via our Python scripts but should be applied manually before using our algorithms.
(2) Large fractures may create some noise during the FTP analysis, providing some FTPs orthogonal to the real fracture trace. These points represent the extension of the fracture that returns a wide valley-shaped signal. However, the number of these points is low if compared to the FTPs lying on the true fracture plane. (3) The fracture separation analysis is sensitive to orientation and geometry, so performs better if the FOIs have a geometrical shape (i.e., linear in 2D) and are not parallel to the x-axis of the 2D image. The way the algorithm measures 2D fracture trace dip means fractures comprising segments that are close to horizontal but with opposite dip azimuths will not be rejoined even though they probably are one feature. To overcome this, we recommend manual observation of the image before implementing the Python script. If the user observes that most fractures are parallel to the x-axis, all slices should be rotated by 90°around the z-axis before analysis, so these fractures will be orthogonal to x. (4) Since the pairing process occurs only at intersection points and the size of the segments is a critical parameter for the 3D pairing, the features in the binary image must be continuous  both in 2D and 3D in order to avoid gaps that subdivide individual features and bias the analysis. (5) To maintain continuity through 3D pairing, the fracture separation algorithm uses the k-NN algorithm and the segment orientations to inspect the points surrounding the connection in both the slice under analysis and the previous one. Consequently, the script works better if fractures have distinct orientations, are not too physically close to other intersection points in 2D, and/or are not spatially overlapping between slices. The latter situation is particularly a problem for images comprising non-cubic voxels, as are commonly generated by medical CT scans, thus cubic voxel images are preferable for a such analysis. We cannot quantify the effect in our test dataset since only a non-cubic voxel scan exists; but, in future, sensitivity tests of the algorithm should be carried out on scans of the same sample with cubic and non-cubic voxels.

Computation Time
The analyses we report here were carried out on a 6-core Intel Core i7-8750H @ 2.2 GHz processor with 32 Gb RAM memory. On this platform, the FTP algorithm collected a total of ∼116,000 FTPs from an image of size 370 × 370 × 100 in approximately 35 s. The time required for subsequent analysis of any dataset will be influenced by the size of the image (more and larger rows and columns to inspect) and the number of FTPs recorded. The fracture separation algorithm is slower than the FTP one, but the processing time achieved for our trial dataset was still short, at approximately 6 min. This running time is highly influenced by the size of the image, the number of orientations and spatial coordinates collected. The final processing time increases exponentially for both large images and complex structures. On a cubic image of 1000 × 1000 × 1000 voxels, the computation time of the fracture separation analysis can be more than 12 h, while the FTP analysis is less than 8-10 min (for a computer with the same processor described above). However, the computation time can be improved, for both the algorithms, by optimization of the Python code in future.

CONCLUSION
We have created an algorithm that detect fracture trace points (FTPs), and separates and recombines fractures in 3D CT datasets. We have demonstrated the individual and combined capabilities of the FTP and fracture separation approaches to characterize the fracture network in a trial dataset. The algorithm represents a substantial advance over previous works particularly because: (1) In three-dimensional X-ray CT scans of rocks, tight fractures are difficult to extract. To separate these features with standard thresholding techniques, the threshold range of gray values has to be increased, which leads to widening of large features, creation of artificial connections, and loss of small features into a darker background. Our FTP algorithm overcomes this problem by automatically isolating fracture traces and measuring local aperture-related parameters and one-dimensional fracture intensity in the gray scale image.
Additionally, other information about the pixels surrounding each FTP are used to record local orientations. These can be used to better define the geometry of the fracture system studied even if individual features cannot be analyzed.
(2) It has previously been difficult to individually inspect connected fractures in a scanned rock. We have developed a method to separate connected fractures so that the orientations, sizes and shapes of individual fractures can be described.
The algorithms run quite fast and can potentially be applied individually or in combination on other CT datasets. The data generated could also be queried in ways not described in this paper to assess other aspects of fracture systems in future studies. For example, our algorithms could be applied to one set of fractures imaged at a range of different voxel resolutions to test whether the fracture parameters it measures display fractal behavior (c.f., Hirata, 1989;Miller et al., 1990).

DATA AVAILABILITY STATEMENT
The datasets generated for this study are available on GitHub (github.com/fscpp).