SHape Analyser for Particle Engineering (SHAPE): Seamless characterisation and simpliﬁcation of particle morphology from imaging data ✩ , ✩✩

The mechanical and rheological behaviour of particulate and granular assemblies is signiﬁcantly inﬂuenced by the shape of their individual particles. We present a code that implements shape characterisation of three-dimensional particles in an automated and rigorous manner, allowing for the processing of samples composed of thousands of irregular particles within affordable time runs. The input particle geometries can be provided in one of the following forms: segmented labelled images, three-dimensional surface meshes, tetrahedral meshes or point-clouds. These can be complemented with surface texture proﬁles. Shape characterisation is implemented for three key aspects of shape, namely surface roughness, roundness and form. Also, simpliﬁed particle shapes are generated by the code which can be used in numerical simulations to characterise the mechanical behaviour of particulate assemblies, using numerical approaches such as the Discrete Element method and Molecular Dynamics. Combining these two features in one automated framework, the code allows not only to characterise the original granular material but also to monitor how its morphological characteristics change as the shape of the particles is simpliﬁed according to the chosen ﬁdelity level for the application of interest.

(e.g. [6,7]), Civil Engineering (e.g. [8]), Pharmaceutical Engineering (e.g. [9,10]), Chemical Engineering (e.g. [11]), Agricultural Engineering (e.g. [12]) and Geosciences (e.g. [13,14]). Several studies of particulate materials have demonstrated the significant influence of particle morphology (i.e. form, roundness and roughness) on the static and dynamic mechanical behaviour of assemblies of particles such as shear banding (e.g. [15,16]), jamming (e.g. [3]), flowability (e.g. [12]) and processability (e.g. [17]). In this study, particle morphology is categorised using three independent aspects of shape, namely form, roundness and roughness, as defined in [18]. Form is a first order morphological property, reflecting the relative proportions of a particle. Roundness is a second-order aspect of particle morphology, related to the sharpness of corners and edges, and is therefore appended on top of the form features. Surface roughness is a third-order aspect of shape, related to asperities which are appended on top of roundness features. It should be noted that roughness is scale dependent, so the level at which this aspect of shape is measured and studied depends on the problem of interest.
Regarding the characterisation of particle form, the classification system proposed by Zingg [19] is being predominantly used in both research and practice, mainly due to its simplicity. Based on two independent ratios of the three main dimensions of the particle, Zingg classified the shape of pebbles in four distinct categories, namely: oblate (or flat), compact (or equant), prolate (or elongated) and blade-like (or triaxial). The ratios of these dimensions -short (S), intermediate (I ) and long (L)-are used in the Zingg plot of Fig. 5b). The ratio S/I is related to how flat a particle is, while the ratio I/L is related to how elongated it is. According to the Zingg classification system: a particle is oblate if S/I < 2/3 and I/L > 2/3; a particle is compact if S/I > 2/3 and I/L > 2/3; a particle is blade-like if S/I < 2/3 and I/L < 2/3; a particle is prolate if S/I > 2/3 and I/L < 2/3. Particle shape characterisation has been an active research topic since the beginning of the 20th century [20,21]. Traditionally, a set of shape indices were employed to describe the main morphological aspects of particulate materials, mostly in 2-D [22]. However, the results of 2-D shape analyses are largely influenced by the plane chosen for the projection of the real particle [23,24]. In the last two decades, the field has made important progress thanks to new experimental techniques, e.g. micro Computed Tomography (μCT), laser scanning, white light interferometry and more advanced algorithms combining 2-D images to reconstruct 3-D particle geometries, which in general allowed more precise particle shape analyses. On the other hand, this progress has made apparent the limitations of the indicators proposed in the 20th century, so, that several new indicators have been proposed in the last decade [25,26]. At the same time, no consensus has yet been reached in the scientific community about a set of universally accepted shape indicators to fully characterise a particle shape. Therefore, a software able to calculate the main indicators in the literature for particles imaged from a variety of experimental techniques is a potentially transformative tool since it provides the community with the opportunity to estimate shape indicators efficiently and conveniently for current and future datasets of particles. In this way, researchers will be able to identify over time the best set of shape indicators for their specific particulate material of interest. Also, this software has the potential to significantly benefit industry, which still heavily relies on 2-D image analyses [27][28][29][30].
The numerical modelling of particulate materials for engineering applications is currently dominated by the conventional Discrete Element Method (DEM) with particles modelled as spheres, since detecting contact is mathematically and computationally vastly easier, compared to non-spherical particles. Nevertheless, various approaches have been proposed to model real 3-D parti-cles accounting for their shape, the main ones being: polyhedral particles [31,32], superquadrics [33], clusters of spheres held together [34,35] or NURBS [36]. In principle, any particle can be discretised as a polyhedron and the more complex the shape, the higher the number of faces required for a faithful representation. A new mathematical formulation extending the concept of potential particle [37] to 3-D polyhedra [38,39] allows the efficient DEM modelling of hundred thousands of particles of any convex shape [40]. In this framework, a concave particle can also be simulated as a cluster of convex polyhedra linked by unbreakable bonds [41]. For the successful modelling of a particulate material, the right balance between computational efficiency and geometric and mechanical accuracy has to be struck. For instance, the geometry of a single particle, imaged by a laser scanner, can be very accurately captured by thousands of faces, but if a DEM simulation of some thousand particles was attempted, the computational time would be unaffordable. Therefore, in the context of DEM analysis of particulate matter, particle shapes need to be simplified, so that the numerical simulation of interest can be performed without compromising the representativeness of the sample, i.e. the mechanical behaviour of the numerical sample still needs to be a faithful replica of the real sample in terms of the experimental response observed.
Various mathematical techniques can be used to simplify the morphology of a particle. Zhou et al. [42] demonstrated the capacity of Spherical Harmonics, a generalisation of the Fourier transformation in the 3D space, to generate particles of variable fidelity levels. Ouhbi et al. [43] used statistical techniques and the Proper Orthogonal Decomposition in particular, which is a variant of Principal Component Analysis, to generate particles of controlled morphological accuracy. In addition, mesh-reduction techniques, such as edge-collapse, can be employed to generate simplified particle morphologies. Comparisons among these methods are currently missing from the existing literature.
The proposed code is expected to be of interest to the community, since it can be used to link particle shape to mechanical behaviour, through the calculation of various shape indices, not only for the original material but also for the simplified particles it generates and which can be used in numerical analyses. To achieve this, we propose a down-sampling of the original particle geometries at discrete resolution intervals, i.e. fidelity levels, with simultaneous monitoring of the inescapable alteration of some shape features, to ensure the preservation of the main morphological profile.
This approach ensures that the selected particle shapes are not oversimplified and thus that they retain an association to the real particles, morphologically-wise. With this, the modeller can make an informed choice on the trade-off between accuracy and computational speed for numerical simulations of particulate materials. A variety of shape descriptors is available, while outputs are provided in multiple formats, compatible with the syntax of some widely used DEM and FEM codes.

Software description
The code comprises two main modules, implementing particle shape characterisation and particle shape simplification, with the latter aiming to generate polyhedral particles for numerical simulations. An additional auxiliary module provides utility functions, calculating geometric properties of the polyhedral particles and performing basic geometric transformations.

2.1.
Software architecture SHAPE provides a particle shape characterisation routine for all aspects of particle shape, namely surface roughness, roundness and form [18]. In addition, the code includes a module to generate simplified geometries of three-dimensional particles derived from imaging data, for different levels of simulation fidelity. The particle geometries are analysed using the particle shape characterisation module, allowing the user to prescribe the level of particle simplification on the basis of target shape descriptor values. SHAPE can work for large assemblies of particles, providing a fully automated framework from digital imaging to numerical simulation. Fig. 1 shows the main architectural features of SHAPE. Available imaging data of a particle can be inserted in the code either as a point cloud, a surface or tetrahedral mesh [44], or a segmented volumetric image. If a point cloud is given as input, the particle surface is reconstructed either using the Delaunay triangulation algorithm or using the Crust method, proposed in [45] and implemented in Matlab by Giaccari [46]. If a segmented volumetric image is used, it is transformed into a surface mesh using an implementation of the refined Delaunay triangulation algorithm developed in CGAL [47], which is provided by the iso2mesh code [48]. In particular, the functions surf2vol and vol2surf of iso2mesh are used for transformations between surface and voxelated representations of the particles. Geometrical characteristics of the particle can be calculated, such as its centroid, volume, surface area, inertia tensor, radius of its largest possible inscribed sphere and radius of its smallest bounding sphere. Shape characterisation follows, which is detailed in the next section. If only characterisation is of interest, outputs of the shape analysis can be extracted and statistics can be provided for the original geometry of the material at this point.
What comes next is a shape simplification procedure, employing mesh-reduction techniques. The user can choose at this stage whether the simplified particle needs to be convex, and the convex hull of the particle is employed in such a case. Preserving geometrical characteristics during the simplification of a particle can be of interest. To this end, SHAPE offers the option to apply an isochoric transformation of the simplified particle, in order to match the volume of the original one. The isochoric transformation operates a homothetic scaling of the simplified particle, multiplying the coordinates of its vertices by a scale factor of 3 where V represents the volume of the particle for both the original and the simplified fidelity levels.
Applying this scaling law on the simplified geometry preserves the volume of the particle across fidelity levels, albeit the same is not achieved for the surface area nor the inertia tensor of the particle. It should be noted, that scaling the particle homothetically to achieve an overall isochoric transformation from the input object to the simplified particle does not affect the parameters related to shape characterisation, like sphericity, convexity, flatness and elongation, but it does change the size of the particle, so the user should be careful in prescribing scale factors which might deviate significantly from unity, as the particle size distribution may be affected.
Then, simplified particles are generated using the Iso2Mesh code [48], which includes binaries of CGAL [47] and TetGen [49] to implement mesh manipulations, including mesh-reduction. It should be noted that only some mesh-generation and editing tasks are outsourced in Iso2Mesh and this external dependency is not used to its full extent.
The outputs of the code include shape characteristics for each particle and statistics of their values if a whole sample is analysed. Additionally, the simplified particle geometries are exported in various formats, supported by some of the most widely used FEM and DEM codes.

Shape characterisation
To date, particle shape characterisation is not a straightforward procedure. A plethora of indices (or so-called descriptors) exist, aiming to measure some basic aspects of shape, which often provide contradicting results if compared. It becomes evident that the outputs of such a characterisation are highly dependent on the definition of the chosen indices. To this end, SHAPE calculates a variety of widely accepted indices, aiming to offer a comparison among their values and provide the user with an integrated view over the morphological characteristics of the material of interest.
In many studies, shape characterisation is often limited to the form of the particles, while in reality the importance of roundness and surface roughness are reported to be influencing the mechanical behaviour as well [50][51][52][53]. Roundness can be seen here as the complementary percentage of angularity. SHAPE supports two definitions of roundness and two definitions of angularity. In cases where the particle size is relatively small and its morphology is derived through laser scanning or computed tomography, the available imaging resolution is not satisfactory to measure its surface roughness. It is common practice to achieve this by employing tools like white light interferometry. SHAPE calculates five indices related to surface roughness (texture), based on available data of the surface profile.
Surface roughness data are given in the format of a point cloud. The input can contain some larger local features (depending on the size of the region of interest), which are related to the roundness or form of the particle. These features can be decoupled from roughness through the application of filtering, to remove the smaller curvatures (corresponding to the largest radii), associated to roundness and form. In this filtering process, it is integral to choose a cut-off wavelength wisely, in order not to filter out features related to roughness. To this end, Li et al. [54] demonstrate a method to estimate the cut-off wavelength via measurements of roughness, which can be used to decouple roughness from roundness. Fig. 2 demonstrates the main structure of the shape characterisation module. A list of all the supported shape indices can be found in Table 1.

Software functionalities
SHAPE is meant to provide an integrated framework which links particle shape characterisation with the generation of polyhedral geometries in numerical simulations, supporting the creation of simplified particles at measurable fidelity levels affordable by some of the most popular state-of-the-art numerical solvers. Its main functionalities can be summarised as particle shape characterisation of 3-D particles for all shape aspects and generation of simplified polyhedral geometries.
The supported output formats for the simplified particles are compatible with the following numerical tools: • the DEM solver YADE [59], supporting the formats of the particle classes Polyhedra, PotentialBlock and Poten-tialParticle; • the FEA solver Abaqus [60], supporting the C3D4 element type; • the DEM solvers 3DEC [ • the DEM solver BlazeDEM [64].
In addition, several utility functions are provided, calculating some key geometric parameters, detailed in Table 2. Last, a set of functions is available, dedicated to provide graphs and statistics of the particle shape characterisation analysis of a sample.

Sample code snippet
The morphological analysis of large samples, composed of hundreds or thousands of particles, necessitates the implementation of a robust data structure, to make post-processing of the results easier. To this end, SHAPE has been designed following an objectoriented structure, briefly demonstrated in Fig. 3. Fig. 4 shows the reduction of shape resolution of a real soil grain for five fidelity levels, using the simplification module of the code. The simplified shapes in this paradigm are created starting from the convex hull of the original particle, meant to be used by DEM codes, where the particles may need be convex. Fidelity is quantified in this particular case in terms of number of triangular faces of the mesh constituting the particle surface, while in a wider perspective, the user can choose a different measure of simulation fidelity to represent the detail of resolution of the particles.

Example 2: Shape characterisation results for a sample of 50 railway ballast particles
In this example, we demonstrate results from a particle shape characterisation analysis of 50 railway ballast grains. The particle Flatness [58] f Unitless Fig. 4. Simplification module: Reduction of shape resolution for five user-defined fidelity levels.
geometries have been scanned by Xiao et al. [69] using a handheld laser scanner. Fig. 5a shows the alteration of the degree of true sphericity for the 50 ballast grains, starting from the origi-nal particle, the convex hull and then for descending fidelity levels from 200 to 25 triangular faces on the surface of each particle. Fig. 5b demonstrates a Zingg plot for the original particle shapes  [19], along with isolines of intercept sphericity values [55], allowing for a classification of the particles' morphology for the whole sample.

Example 3: Characterisation of images with noise
The products of digital imaging are always influenced to some degree by the existence of numerical noise. Regardless of the technique used to digitise the geometry of a particle, (e.g. computerised tomography or laser scanning) or the format of the output (3D images and point clouds, respectively), defects are always present. Preparing imaging data at a pre-processing stage is typical before using them for shape characterisation or numerical simulations of any type, including tasks such as: filtering, removing of isolated elements (e.g. pixels or points) or applying smoothing and refining techniques.
Wiebicke et al. [70] studied how defects of realistic images derived using computerised tomography can affect the segmentation of individual particles. Starting from computer-generated synthetic-images of spherical assemblies, they generated realistic-like images, with the addition of Gaussian noise and blur. Gaussian noise and blur are the two elements present in every real image captured using computerised tomography.
This example demonstrates a sensitivity analysis, where a 3D image of an ellipsoidal particle is analysed using SHAPE. Then, blur and noise of different levels are added, to identify the effect of the induced noise on the form characterisation of the overall image. Blur is created by applying Gaussian filtering of varying standard deviations. Fig. 6 demonstrates an ellipsoid with radii 150 × 75 × 105 mm, where increasing levels of blur and Gaussian noise are added. Fig. 7 demonstrates the absolute error values of various morphological parameters for each level of blur and noise.

Example 4: Characterisation of concave particles
This example means to demonstrate the capacity of SHAPE to characterise the morphology of particles with concavities. To establish a meaningful comparison, the morphology of a ring torus was characterised, where analytical expressions exist for several of its geometrical characteristics.  The analysed torus shown in Fig. 8 has a horizontal ring of radius 3.0 cm and a vertical section of radius 1.0 cm. To tessellate the surface of this particle, 300 subdivisions are considered along its horizontal ring and 100 subdivisions along each of its sections, resulting in a particle with 30,000 vertices and 60,000 faces.
The geometrical parameters of the torus calculated analytically and by SHAPE, along with the corresponding errors are reported in Table 3. The errors are consistently below 0.5%. To further investigate the source of errors, the generated mesh of the torus was reanalysed using Meshlab [71]. It emerges that Meshlab and SHAPE provide very similar results and therefore, the errors can be attributed to the tessellation of the torus into a discrete mesh.

Impact
In practice, particle shape characterisation is typically carried out based on a handful of selected shape indices, while different interpretations of these indices exist in literature, aiming to describe the same shape aspects. The effectiveness of these indices to characterise the particle shape is still an open discussion and researchers and practitioners use the indices they find more representative subjectively, since to date, a consensus does not exist.
This piece of software is meant to facilitate a framework where the user can have easy access to a -growing-variety of different shape indices, while they can monitor possible differences between indices which are meant to characterise the same shape aspects. For instance, different interpretations of sphericity can lead to different results, while all of them are meant to represent how closely a particle resembles a sphere. That is, this software is expected to provide a better comprehension in the study of particle shape characterisation, providing a pool of available shape indices. Users are encouraged to request or further develop the implementation of more shape indices they might be using in their work.
Utilising the ability of this software to process not just single particles, but whole particulate assemblies of three-dimensional particles, the authors intend to provide the community with a comprehensive tool to study the effect of particle shape in a quantitative and effective manner. This will facilitate the incorporation of 3D shape characterisation in industrial standards and guidelines.

Conclusions
A new open-source software is presented to perform shape characterisation of three-dimensional non-spherical particles. The following conclusions about the significance and reach of the work can be drawn: 1. SHAPE provides seamless characterisation and simplification of particle morphology, considering three key aspects of particle shape, namely form, roundness and surface roughness. This allows the characterisation of large particulate assemblies composed of thousands of particles, without human intervention. 2. For each aspect of shape, the code can calculate the most relevant shape descriptors, along with multiple approaches to calculate the main particle dimensions. This means the code can be employed for the many practical applications involving granular materials across the spectrum of the engineering and physical sciences.  3. The user is in control of the morphological simplification of each particle processed by setting acceptability thresholds for the error measured by the code for each shape index.
Having developed a shape analyser, which can also generate simplified shapes to be used in numerical simulations, we believe this tool will be of use to researchers and practitioners alike investigating the influence of particle shape on the mechanical behaviour of granular assemblies at any scale of interest, including but not limited to powders, sands, silts, ballast, rockfills, and the many byproducts of process engineering. SHAPE provides a user-friendly platform where future shape indices developed by the research community can be tested and pave the way for the development of new industrial standards based on 3-D particle characterisation.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.