Software for micromorphometric characterization of soil pores obtained from 2-D

Studies of soil porosity through image analysis are important to an understanding of how the soil functions. However, the lack of a simplified methodology for the quantification of the shape, number, and size of soil pores has limited the use of information extracted from images. The present work proposes a software program for the quantification and characterization of soil porosity from data derived from 2-D images. The user-friendly software was developed in C++ and allows for the classification of pores in terms of size, shape, and combinations of size and shape. Using raw data generated by image analysis systems, the software calculates the following parameters for the characterization of soil porosity: total area of pore (Tap), number of pores, pore shape, pore shape and pore area, and pore shape and equivalent pore diameter (EqDiam). In this paper, the input file with the raw soil porosity data was generated using the Noesis Visilog 5.4 image analysis system; however other image analysis programs can be used, in which case, the input file requires a standard format to permit processing by this software. The software also shows the descriptive statistics (mean, standard deviation, variance, and the coefficient of variation) of the parameters considering the total number of images evaluated. The results show that the software is a complementary tool to any analysis of soil porosity, allowing for a precise and quick analysis.


Introduction
Soil micromorphology is becoming widely used for the characterization of soil porosity with the aid of digital techniques for the processing and analyzing of images.Analysis in two dimensions (2-D) are frequently employed to investigate soil porosity, due to their low cost and easy access (Pires et al., 2008(Pires et al., , 2009;;Passoni et al., 2014).
The analysis of soil images has been considered an efficient technique for evaluating soil structure and soil porosity by using soil thin sections and blocks of soil (Deeks et al., 1999;Cooper et al., 2010).The direct observation of soil porosity is important to an understanding of how management practices affect the physical quality of soil (Clemente et al., 2005;Bagheri et al., 2012;Rasa et al., 2012).
Image processing software allows for the construction of custom applications to extract specific data from an image.In the case of soil images, the target may be quantitative data extracted from the pore system.The Noesis Visilog software was used for evaluating the pore system of weathered soils when they are subjected to wetting and drying cycles (Pires et al., 2009).The opensource software ImageJ was successfully used to quantify the total porosity (%), total number of pores and pore size distribution for two Brazilian soils by using soil samples impregnated with resin (Passoni et al., 2014).
The lack of a simple methodology for the quick quantification of the shape, number, and size distribution of the pores has hampered the use of image-based micromorphological studies of soils.The aim of this study is to present and describe a software program that provides a quick and easy analysis of soil porosity from data extracted from 2-D images.

Materials and Methods
A software program, named SPIA (Soil Pore Image Analysis), was developed to classify soil porosity according to size, shape or the combination of size and shape from raw data obtained by image analysis image analysis Note processes using the Noesis Visilog 5.4.software which was written in C++, using orientation to objects and the Qt 5 framework.This structure allows for the development of software that can be applied to different operational machines/systems (multi-platforms) with little or no alteration in the source code.

Input data to SPIA
The input data for SPIA were obtained from soil blocks which were first dried and then impregnated with a solution containing polyester resin, styrene monomer, catalyst, and a fluorescent pigment, following the procedures described by Murphy (1986) and Castro et al. (2003).The soil blocks (undisturbed samples) were collected using cardboard boxes with dimensions of 0.07 m × 0.12 m × 0.06 m.
For the quantification of porosity, soil blocks were illuminated with ultraviolet light and photographed with a digital camera featuring a charge-coupled device (CCD) image sensor, coupled to a binocular microscope.A large number of photomicrographs of 12 mm × 15 mm (180 mm 2 ) were randomly obtained from each soil block.We digitalized these images with a spatial resolution of 1024 × 768 pixels, each pixel corresponding to an area of 156.25 µm 2 , a spectral resolution of 256 shades of grey, using a 10× optical lens.Each image was subjected to void segmentation by grayscale thresholding.Subsequently, the images were converted to binary form and labeled by the image analysis program, Noesis Visilog 5.4.The labeling operation allowed for recognition and individualization of voids in each binary image using a connection factor.
Next, the Noesis Visilog 5.4 quantified both the basic and derived variables.The first refers to the image void space (assumed to be pores) and includes the area, number of objects, and for each object, its perimeter, horizontal and vertical Feret diameters, as well as its horizontal and vertical projections.The derived variables are a combination of two or more basic variables which allow for a complete characterization of the soil pores (Murphy et al., 1977a).These variables are then used to classify the void spaces, according to a combination of shapes and sizes.SPIA was developed to optimize this procedure.Alternative image analysis software can be used to generate the input file although SPIA requires a standard format for the input file.Figure 1 presents an example with five observations of the variables required and the sequence that needs to be followed to prepare the input file for SPIA.
Image analysis is only able to provide quantification of macro and mesopores.Smaller pores are not quantified because their sizes are beyond the resolving power of the optical microscope (Bullock et al., 1985).According to Bullock et al. (1985), mesopores have diameters between 50 and 500 µm while the diameters of macropores fall in the range of 500 to 5000 µm.Thus, in the text the total area of pores are related to pore diameters between 50 and 5000 µm.
The input files were generated using Noesis Visilog.However, other software can be used provided the data file is in a standard format.

Data calculated by SPIA
SPIA classifies the pore space based on a combination of their shape and size with the equivalent diameter (EqDiam) classes.The output of SPIA comprises the total number of pores and the percentage of the total area of pores occupied for each combination case.The software also presents descriptive statistics (mean, 1 st quartile, median, 3 rd quartile, minimum and maximum values, standard deviation, variance and the coefficient of variation) of the output parameters for the total number of images evaluated.
The shapes are defined according to Cooper et al. (2010).The authors classified the pores into three groups: rounded (channels and isolated vughs), elongated (planar voids) and complex (packing voids and chambers).
Two indices are used to establish the void shape.The first index, I 1 , is used to distinguish rounded from elongated voids (Equation 1).A value of 1 for I 1 defines a perfectly circular pore, values greater than 1 indicate that the shape of the pore deviates from the circular (Bouma et al., 1977).
The second index, I 2 (Equation 2), used in conjunction with I 1 , allows for greater accuracy in the assignment of a pore to a specific shape group.
where N I represents number of intercepts of an object in the direction i (i = 0°, 45°, 90°, and 135°); D F , Feret diameter of an object in the direction j (j = 0° and 90°); m, number of i directionsand n, number of j directions.
Table 1 presents the rule used for the classification of the pores according to shape, using the I 1 and I 2 indices.Pores with I 1 ≤ 5 are classified as rounded.For pores where 5 < I 1 ≤ 25, an inspection of the second index I 2 is required to determine whether the pore should be classified as elongated or complex.All pores with I 1 > 25 are classified as complex, regardless of the value of I 2 .
The pores of each shape group were divided into three different size classes (Table 2).
Next, SPIA calculates the number of pores in each class and the percentage of the total area of pores corresponding to these pore classes (Ptsize) (Equation 3).The total area of pores (Tap) was calculated as the ratio of the area of all pores to the total area of the image (Hallaire and Cointepas, 1993).The Tap value is a function of the resolution of the image and the area corresponding to a single pixel.
where CP represents Crofton perimeter (calculated by the image analysis software).The Crofton perimeter counts the intercept numbers along major directions and corrects for non-square pixels.
Once the individual pores have been classified, the software calculates the number of pores for each combination of shape and equivalent diameter and the percentage of the total area of pores corresponding to these pores (PtEqDiam) (Equation 5).

Pt
ASEq where ASEq represents area of the pores of a specified shape and equivalent diameter and AT, total area.Finally, SPIA presents minimum and maximum values for pore area and equivalent diameter over the range of pores in an image.

Results and Discussion
Figure 2 presents the user interface of SPIA.Fields are provided for the width and height of the images, which represent the image resolution, and for Pixel width and Pixel height, which define the size of a pixel.The button Add file opens a new window through which the user can select the input file to be added to the list of files for processing.Figure 2 as an example, five loaded input files (e.g.D:\Spia_Input /input1.txt).The user can remove a file from the list by selecting it and clicking on the button Remove File.Processing of the data in the input files is initiated by clicking on the button Process files.
SPIA generates four main output files, containing the results of the calculations and analysis performed.
The files count-summary-type_size and ptsize-summary-type_size present the results for the characterization of pores according to their shape and size.The count-summary-type_size presents the number of pores according to shape and size (NPore) (Figure 3).The ptsize-summary-type_size presents the percentage of Tap (Ptsize ) corresponding to that shape and size of pore (Figure 4).The last file columns of both files display the summary statistics of the processed images.The summary columns contain means and totals of Pt size (MeanPt size , To-Sci.Agric.v.73, n.4, p.388-393, July/August 2016 talPt size ) and the number of pores (MeanNPore and TotalN-Pore), followed by minimum, first quartile, median, third quartile, maximum, standard deviation (StdDev), variance (Var) and coefficient of variation for the Pt size (CV%).
The files count-summary-type_class and ptsize-summary-type class present the results obtained when the pores were classified by shape and equivalent diameter.The rows correspond to different combinations of shape and equivalent diameter, as indicated by the class labels in column A. The count-summary-type_class presents the number of pores according to shape and equivalent diameter (NPore) (Figure 5).The ptsize-summary-type_class presents the percentage of Tap (Pt size ) corresponding to shape and equivalent diameter (Figure 6).The subse-quent columns contain the same sequence as the file count-summary-type_size and ptsize-summary-type_size, described previously.
The file summary-minimax presents the minimum and maximum values for the area of a single pore in µm 2 and mm 2 , for the equivalent diameter (EqDiam), and for the WidthElong (Figure 7).The values are given for each input file; global maximum and minimum values can be found under the column "General" for all the loaded files.
Finally, SPIA generates a file called results which contains the names of the files loaded (File) the total area of pores (Tap_µm 2 ) and the number of pores (Npore) for each file (Figure 8).The number of errors found during the loading of each file is also reported (ErrorsFound).This is followed by the sum of the Tap (µm 2 ) and the sum of the number of pores (NTotalPore) for the loaded files.

Conclusions
We developed a user-friendly software (SPIA) for the analysis of soil porosity that uses data extracted from 2-D images.SPIA was shown to be a complementary tool in the analysis of soil porosity by digital image analysis.One of the advantages is that SPIA produces quick and precise quantifications and summaries of soil porosity, through a combination of pore classification by shape and size.The proposed software can be used for different applications in soil studies that need to quantify and qualify the pore space.SPIA is made available free of charge for non-commercial purposes and it can be acquired through contact with the authors of this paper.Figure 3 − Sample output, file count-summary-type_size, from the analysis of five images pre-processed by Noesis Visilog; the pores were classified by shape and size according to Table 1.Future developments include the creation of graphs by the software.We hope that SPIA contributes to popularizing the application of soil micromorphometric studies through image analysis.

Figure 1 −
Figure 1 − Illustration of the standard format required as input file for SPIA.Index = object (pore) identification; FirstPointX and FirstPointY = Object (pore) coordinates in the image; Area μm 2 = pore area in μm 2 ; Shape_AP = pore shape index I 1 (refer to Equation 1 in this paper); CP = Crofton Perimeter; EqDiam = Equivalent Diameter; FD = Feret Diameter at a given angle (numbers following FD represent the angles of FD measurement); Intercept = number of intercepts measured on a pore at a given angle (numbers following Intercept represent the angles of measurement); Orientation = angle of orientation of the pore.

Figure 4 −
Figure 4 − Sample output, file ptsize-summary-type_size, from the analysis of five images pre-processed by Noesis Visilog; the pores were classified by type and size of pore (Pt size ).

Figure 5 −
Figure 5 − Sample output, file count-summary-type_class, from the analysis of five images pre-processed by Noesis Visilog; the pores were classified by shape and equivalent diameter.

Figure 7 −
Figure 7 − Sample output, file summary-minimax, from the analysis of five images pre-processed by Noesis Visilog.This file contains minimum and maximum values for the area of a single pore (in µm 2 and mm 2 ), for the equivalent diameter (EqDiam in µm), and for the width of the elongated pores (WidthElong, in µm).

Figure 8 −
Figure 8 − File example of the result output file from the analysis of five images pre-processed by Visilog.This file contains the total porosity; the total number of pores and the number of errors found during the processing of the data.

Figure 6 −
Figure 6 − Sample output, file ptsize-summary-type_class, from the analysis of five images pre-processed by Noesis Visilog; the pores were classified by shape and equivalent diameter.

Table 1 −
Classification of soil pores according to shape types.

Table 2 −
Classification of soil pores according to shape types and size classes.