You are on page 1of 9

Computer Physics Communications 254 (2020) 107381

Contents lists available at ScienceDirect

Computer Physics Communications


journal homepage: www.elsevier.com/locate/cpc

A MATLAB tool for computing the spherical harmonic fractal


dimension of the cerebral cortex✩ , ✩✩

Juan Ruiz de Miras a,b,c , , Guillermo Martínez-Lledó b , William Orwig c , Jorge Sepulcre c,d
a
Software Engineering Department, University of Granada, Granada, Spain
b
Department of Computer Sciences, University of Jaén, Jaén, Spain
c
Gordon Center for Medical Imaging, Division of Nuclear Medicine and Molecular Imaging, Department of Radiology, Massachusetts General
Hospital and Harvard Medical School, Boston, MA, USA
d
Athinoula A. Martinos Center for Biomedical Imaging, Department of Radiology, Massachusetts General Hospital and Harvard Medical
School, Charlestown, MA, USA

article info a b s t r a c t

Article history: Fractal dimension (FD) has become a very useful tool in neuroscience with a wide range of applications
Received 20 December 2019 in characterizing several neurodegenerative diseases. The most commonly used method for computing
Received in revised form 11 April 2020 the FD of brain tissues is box-counting. This technique performs very well on 2D images and 3D
Accepted 28 April 2020
volumes; however, it presents several drawbacks when processing cortical surfaces in 3D. In this study,
Available online 19 May 2020
we present a MATLAB program for computing the FD of 3D surfaces based on spherical harmonics. We
Keywords: developed a novel MATLAB program, called UJA-SHFD, based on a spherical harmonics FD algorithm
Fractal dimension which overcomes the limitations of the classical box-counting algorithm when processing 3D surfaces.
Spherical harmonics Moreover, spherical-harmonic-based FD (SHFD) enables the processing of both global (providing a
Cortical surface single FD value for the entire surface) and local level assessments in each cortical surface vertex.
MATLAB UJA-SHFD has been specifically designed and tested for processing cortical surfaces obtained from
FreeSurfer the FreeSurfer software suite. Nevertheless, the program can also process any kind of surface in the
Wavefront OBJ format. UJA-SHFD can be used both through a graphical user interface and at the
command line. The present study demonstrates the usefulness of UJA-SHFD through its application
to a neuroimaging study looking at the progression of brain atrophy in Alzheimer’s disease. UJA-SHFD
is a novel MATLAB program with the goal of developing neuroimaging analyses of FD computation for
the investigation of brain morphological changes in neurodegenerative and neuropsychiatric disorders.
The MATLAB source code of UJA-SHFD is freely available.
Program summary
Program title: UJA-SHFD
CPC Library link to program files: http://dx.doi.org/10.17632/wzzv2wc7fd.1
Licensing provisions: GNU General Public License version 3
Programming language: MATLAB, C++
Nature of problem: To compute the fractal dimension of 3D surfaces avoiding the common problems
of software based on the box-counting algorithm.
Solution method: Spherical harmonics are used to obtain a set of reconstructed surfaces approximating
the shape of the original surface. The areas of the reconstructed surfaces are used to obtain the global
fractal dimension of the original surface. The areas of the triangles associated to each vertex of the
reconstructed surfaces are used to obtain local fractal dimension maps.
© 2020 Elsevier B.V. All rights reserved.

✩ This paper and its associated computer program are available via the Computer Physics Communication homepage on ScienceDirect (http://www.sciencedirect.
com/science/journal/00104655).
✩✩ The review of this paper was arranged by Prof. Stephan Fritzsche.
∗ Correspondence to: Departamento De Lenguajes y Sistemas Informáticos - Universidad de Granada, C/ Periodista Daniel Saucedo Aranda S/N
C.P., 18071, Granada, Spain.
E-mail address: demiras@ugr.es (J. Ruiz de Miras).

https://doi.org/10.1016/j.cpc.2020.107381
0010-4655/© 2020 Elsevier B.V. All rights reserved.
2 J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381

1. Introduction

Fractal dimension (FD) is a quantitative parameter of the complexity of an object [1] and has been used extensively in neuroimaging
to identify morphological changes in the human brain [2]. The FD of an ideal fractal object in Rd can be calculated as follows [1]:
log (Nr )
FD = (1) (1)
log r

where Nr is the number of homotheties of size r d that are required to completely cover ( the
) object. However, when the object is not an
ideal fractal then the FD value is obtained as the linear regression of log(Nr) against log 1r for several values of r. When the homothethy
is a box (square in 2D or cube in 3D) then this method of calculating FD is known as box-counting [3].
FD has been widely used to study the brain structures. Pioneer studies used FD in 2D in order to analyze MRI data in several
neurodegenerative diseases such as multiple sclerosis [4] and stroke [5]. Currently, studies are focused in 3D and even 4D FD analyses.
A 3D FD analysis was performed in [6] looking for a new marker of white matter damage in small vessel disease. 3D FD of the gray
matter was also used to characterize frontotemporal dementia [7]. Cortical complexity, measured by means of FD, has been recently
applied in studies on bipolar disorder [8] and Huntington’s disease [9]. Subcortical and ventricular structures of the brain have also
been studied through FD analysis [10]. FD combined with several brain morphology measures has been shown to be a key biomarker
for early mild cognitive impairment diagnosis [11]. Even 4D FD analysis of the spatiotemporal cortical activations after transcranial
magnetic stimulation can differentiate between different states of consciousness [12].
Usually, studies of FD analyze a single FD value in order to characterize the shape of whole brains, hemispheres or regions of interest.
The box-counting algorithm is widely used to perform those FD analyses. There are existing methods and computer toolboxes, based
on the box-counting approach, which are used to calculate FD in the field of neuroscience [13–17]. However, it is well-known that
neurodegenerative disorders such as Alzheimer’s disease and other forms of dementia display distinctive structural changes along the
brain cortex, which cannot be adequately analyzed without techniques allowing high resolutions. Therefore, it seems sub-optimal to
evaluate FD only in widespread regions of interest while ignoring the rich structural landscape occurring in smaller units of the surface
space.
Recently, new methods have been developed to evaluate FD with a higher-resolution framework. For example, Jiang et al. [18]
developed a method for calculating the FD of a triangular reconstruction of the cerebral cortex using the box-counting method. This
method was applied to surfaces defined by the regions of interest in typical cortical parcellations. Another modification to the classic
box-counting method was presented by King [19] to estimate local FD values for regions of the cerebral cortex with a minimum size
of 15 mm isotropic voxels. A notable advancement in this line, put forth by Yotter and colleagues [8,20,21], applied spherical harmonic
reconstructions [22,23] to quantify local FD (SHFD). The key feature of this method is that it enables the user to estimate the FD of
a cerebral cortex surface at different scales: (1) global; a single FD value is computed for the whole brain hemisphere, and (2) local;
an FD value is obtained for each surface vertex. There are two main advantages of SHFD compared to the box-counting method [20].
For one, local results are much more precise because SHFD does not require down-sampling of the cortical surface. Additionally, SHFD
allows for FD estimations to be independent of the orientation of the surface, which overcomes one of the major drawbacks of the
box-counting method. The SHFD approach also presents a high test–retest reliability [24].
The novel SHFD method, developed by Yotter and collaborators, has been used in several recent neuroimaging studies. SHFD has
been applied to studying differences in brain cortex complexity between patients with schizophrenia and healthy controls [20], between
subgroups of schizophrenia defined by symptom profiles [21], between bipolar disorder patients and normal subjects [8] and between
Huntington’s disease patients and healthy controls [9]. Children’s arithmetic fluency has been associated to different SHFD patterns [25].
Our group has successfully applied SHFD to identifying cortical surface abnormalities in the progression from mild cognitive impairment
(MCI) to Alzheimer’s disease (AD) [26], obtaining better outcomes compared to other common imaging biomarkers, such as cortical
thickness [27] and local gyrification [28]. Other groups have also shown that shape characteristics of subcortical structures described
by SHFD might be useful biological markers of healthy aging [10].
To the best of our knowledge, there is only another publicly available software allowing for computing the SHFD of cortical surfaces:
the Computational Anatomy Toolbox 12 (CAT12) [29]. However, SHFD computation in CAT12 is only available as a predefined and not
configurable step in the cortical surface processing pipeline, so general surface meshes cannot be processed with CAT12 and SHFD
computation cannot be adapted to the kind of surface being processed. The aim of our work was to provide such general and flexible
software to the neuroscientific community. To accomplish this goal we coded our computer program UJA-SHFD in MATLAB, a cross-
platform standard in the biomedical field. UJA-SHFD can operate in two modes, interactively through a graphical user interface and at
the command prompt. Moreover, our software is completely integrated with the cortical surfaces provided by the common pipeline of
FreeSurfer (http://surfer.nmr.mgh.harvard.edu), one of the most widely-used computer programs for processing and comparing cortical
surfaces.
In the following sections, we first describe the algorithm for calculating FD of cortical surfaces using spherical harmonics. Then, we
show the main modules of our software, the functionality of its interface and a performance analysis on two different hardware/software
platforms, comparing the UJA-SHFD features to those of the box-counting algorithm and CAT12 software. Next we describe how to
download, install and call UJA-SHFD. Finally, we provide a step-by-step description of how UJA-SHFD was applied in a neuroimaging
study on the characterization of progression from MCI to AD.

2. Computational methods and theory

In this section, we describe how the fractal dimension of a cortical surface is calculated based on spherical harmonic reconstructions,
using the method developed by Yotter and collaborators [20]. The technical details of SHFD computation have been described in prior
publications [20,26,30]. That procedure is briefly described below.
J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381 3

Fig. 1. Cortical surface (pial) as obtained from FreeSurfer and several reconstructed surfaces for the SH functions with degree Lmax ranging from 1 to 60.

Genus-zero surfaces (spherical domains) can be decomposed into a set of spherical harmonics (SH) [31]. The SH functions {Ylm (θ , ϕ) :
|m| ≤ l ∈ N }{Ylm (θ , ϕ) : |m| ≤ l ∈ N } are orthonormal functions defined on the unit sphere as:
Ylm (θ , ϕ) = kl,m Plm cos (θ) eimϕ

2l+1 (l−m)!
where θ∈[0, π ], ϕ∈[0,2π [, kl,m is the constant 4π (l+m)!
, and Plm is the associated Legendre polynomial. A spherical function g : S 2 → R
can be expanded in terms of SH as:
∞ ∑

g (θ , ϕ) = l (θ, ϕ)
cl,m Y m (2)
l=0 |m|≤l

where the coefficients cl,m are the amplitudes of the corresponding SH functions.
A genus-zero triangulated 3D surface can be re-parameterized to spherical coordinates and then described by three spherical
functions which can be expressed in terms of SH functions. The corresponding coefficients (cl,m ) of these SH functions can be computed
using standard least-squares estimation up to a user-specified maximum degree (Lmax ). The original function can then be reconstructed
from these estimated coefficients, obtaining more accurate reconstructions as the value of Lmax increases.
In UJA-SHFD, the coefficients of the SH functions and the set of reconstructions of the original triangulated surface are computed
using SPHARM [22] up to a user-selected degree of Lmax . The algorithm in SPHARM obtains the surface reconstructions following three
steps: (1) A spherical parameterization is created from the original surface by mapping each point (x, y, z) on the surface to spherical
coordinates (θ , ϕ ): g(θ , ϕ ) = (x(θ , ϕ ), y(θ , ϕ ), z(θ , ϕ ))T ; (2) the spherical function is expanded in terms of SH functions (see Eq. (2)),
and their coefficients cl,m are estimated solving a linear system up to the degree Lmax ; and (3) the set of surface reconstructions is then
obtained by using the coefficients cl,m computed in step 2 and the bijective mapping in step 1.
Based on results from our experiments with cortical surfaces obtained from FreeSurfer (see Section 6), a default maximum value of
Lmax = 40 is set in UJA-SHFD. This value was determined from the observation that as Lmax increases the reconstructed surface quickly
converges to the original surface. Fig. 1 shows the triangulated surface of a left hemisphere and the corresponding set of reconstructed
surfaces from SH functions with degree Lmax ranging from 1 to 60. To note, the reconstructed surfaces have the same number of triangles
as the original surface (306,710 in the case of Fig. 1).
The global SHFD value for the surface is calculated from the set of reconstructed surfaces as the slope of the regression line for the
linear fragment of the log–log plot of degree Lmax vs. the normalized surface area of the degree-Lmax reconstructed surface. The range of
degrees Lmax for approximating the linear fragment of the log–log plot that we have set in UJA-SHFD as the default for computing the
global SHFD extends from Lmax = 11 to Lmax = 29. This default selection has been established based on the results from previous studies
for the case of cortical surfaces obtained from FreeSurfer [8,20,21,26]. Nevertheless, the user of UJA-SHFD can select other ranges of Lmax
for computing the slope of the regression line, especially in cases where the input surface does not come from the common pipeline of
FreeSurfer. The selection of this range of Lmax has a significant impact on the final result, so UJA-SHFD allows the user to easily adjust
this selection, as we will show in Section 3.
On the other hand, the local SHFD value for each vertex of the surface is calculated in UJA-SHFD as the slope of the regression line
for the linear fragment of the log–log plot of Lmax vs. the average area of all the triangles of the degree-Lmax reconstruction that share
that vertex. Previously, the average areas for all the vertices in each reconstruction are smoothed through a 30 mm Gaussian heat
4 J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381

Fig. 2. Data-flow diagram of UJA-SHFD. Striped-shaded processes are only available in GUI mode.

kernel [32]. A 30 mm Gaussian heat kernel is specified with the parameters σ = 900 and iterations = 1, which are adopted as default
values for the heat kernel smoothing in UJA-SHFD. Again, the user of UJA-SHFD can select other values for the heat kernel smoothing
if the input surface has a different topology.
The SHFD algorithm [20] does not compute exact FD as defined in Eq. (1), and therefore its interpretation is not as intuitive as
in the case of the box-counting algorithm. SHFD computation is not based on counting covering elements (homotheties in Eq. (1))
at different scales, but in averaging surface areas at different degrees Lmax . In local SHFD computation, the more folded the original
surface around the vertex is the wider the area covered by the triangles sharing that vertex is (as degree Lmax increases), because all the
reconstructions have the same number of vertices (see Fig. 1). Therefore, the slope of the regression line of the log–log plot of degree
Lmax vs. average area is higher for those vertices surrounded by highly folded surface zones. On the other hand, vertices belonging to
less folded regions of the original surface have smaller variations in their average areas when degree Lmax increases, and therefore the
slope of the regression line is lower.
Since the linear fragment of the log–log plot can be quite variable among all the vertices of a high-resolution cortical surface, we
selected as default values in UJA-SHFD the range of degrees Lmax that maximized the correlation and minimized the error of the linear
regression for most of the vertices (degrees from Lmax = 21 to Lmax = 40) [26]. As in the case of global SHFD, UJA-SHFD allows the
user to select the range of Lmax in order to compute the local SHFD easily and interactively, as we will show in Section 3. The results
obtained in UJA-SHFD with the global SHFD value and the visualization of the local SHFD map for the pial surface of the hemisphere
in Fig. 1 are also shown in Section 3.

3. Program description

The data-flow diagram of UJA-SHFD with its main modules is shown in Fig. 2. In this figure, the striped-shaded processes (3D
visualization and Linear Regression Selection) are only available in the GUI mode of the application, and the remainder of the processes
are also available in the console mode. The input to the program is a file with the surface to process (a pial or white cortical surface
in FreeSurfer format or a general OBJ file). The spherical parameterization of the surface and the coefficients of the SH functions up to
a maximum degree Lmax are obtained using SPHARM (Compute Spherical Harmonics process in Fig. 2), as described in Section 2. From
these coefficients, a set of maximum Lmax surface reconstructions are created as shown in Fig. 1. Both the original surface and the set
of reconstructions can be displayed for inspection in GUI mode (3D visualization process in Fig. 2).
The area of each surface reconstruction and the areas associated with each vertex in each reconstruction are computed (Compute
Areas in Fig. 2), then smoothed through heat kernel smoothing (Heat Kernel Smoothing in Fig. 2). At this point, the global SHFD is
computed and stored in a text file, along with the correlation of the linear regression used for the calculation (Compute Global SHFD in
Fig. 2). The local SHFD of each vertex is computed (Compute Local SHFD in Fig. 2) and stored as a surface map in the FreeSurfer overlay
format (Compute FreeSurfer Overlay in Fig. 2). If the user is running UJA-SHFD in GUI mode, then the global SHFD result and the local
SHFD map are displayed, as shown in Fig. 3.
J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381 5

Fig. 3. UJA-SHFD GUI displaying the global SHFD value and the local SHFD map for the cortical surface shown in Fig. 1.

Fig. 4. Interactive selection of the range of levels for computing the global SHFD in GUI mode.

UJA-SHFD in GUI mode also allows the user to interactively select the ideal range of levels to compute the regression line, from which
the SHFD value is estimated (Linear Regression Selection process in Fig. 2). To assist the user in making their selection, the correlation
value of the linear regression is computed and displayed for the selected range. That interactive selection can be performed by using
any vertex of the surface for the case of the local SHFD. Fig. 4 shows the UJA-SHFD window with the selection of the range of levels
for computing the global SHFD.
Additional functionality of UJA-SHFD in GUI mode includes the interactive inspection and manipulation of 3D surfaces and SHFD
maps, the generation of screenshots, and a graphical help of the application.

4. Software/hardware specifications and performance analysis

UJA-SHFD is a MATLAB program. Local SHFD values and global SHFD maps are computed from the surface reconstructions returned by
SPHARM through both MEX (MATLAB executable) functions compiled from C++. The graphical user interface of UJA-SHFD was designed
using MATLAB GUIDE (https://es.mathworks.com/help/matlab/creating_guis/about-the-simple-guide-gui-example.html).
UJA-SHFD has been tested on two different platforms: a desktop PC and a server for high performance computing. Our PC platform
is composed of a Microsoft Windows 10 operating system, an Intel Core i7-4702MQ 2.2 GHz CPU (4 cores — 8 threads) and 16 GB of
RAM. The Server platform runs on CentOS Linux 7.3 with two Intel Xeon E5-2650 2.60 GHz CPUs (16 cores — 32 threads) and 128 GB
of RAM.
In order to analyze the computational performance of the application Table 1 shows the times needed for computing the local SHFD
maps and the global SHFD values for two surfaces: (1) the FreeSurfer cortical surface shown in Fig. 1 (153,357 vertices and 306,710
faces), and (2) a simplified version of that surface downsized to 5002 vertices and 10,000 faces (see Fig. 5). Those times were obtained
by executing UJA-SHFD in console mode, without any user interaction on our two test platforms. Generating reconstructions with
SPHARM and smoothing the surfaces by applying heat kernel are the two steps which consume the majority of the whole process (97%
and 96% of the total time for computing Surface #1 on PC and Server platforms, respectively; and 96% and 97% of the total time for
computing Surface #2 on PC and Server platforms, respectively). Differences in processing time between platforms are ultimately due
6 J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381

Fig. 5. A simplified version of the cortical surface in Fig. 1 downsized to 5002 vertices and 10,000 faces.

Table 1
Computation times for obtaining the global SHFD values and the local SHFD maps for the FreeSurfer cortical surface
shown in Fig. 1 (Surface #1, 306,710 faces) and the surface in Fig. 5 (Surface #2, 10,000 faces). Time for 40 surface
reconstructions (maximum Lmax = 40).
Process Computation time
PC Server
Surface #1 Surface #2 Surface #1 Surface #2
Generating reconstructions (SPHARM) 4 h 13 min 15 min 24 s 1 h 31 min 8 min 17 s
Computing triangle areas 7 min 20 s 38 s 5 min 20 s 11 s
Heat kernel smoothing 1 h 34 min 2 min 24 s 53 min 1 min 23 s
Computing global SHFD 41 s 2 s 30 s 1
Computing local SHFD map 1 min 4 s 40 s 2 s
Total time 5 h 56 min 18 min 32 s 2 h 30 min 9 min 54 s

Table 2
Comparison between SHFD and box-counting-FD algorithms.
Feature SHFD Box-counting
Global Yes Yes
Resolution Regional Yes Yes
Local Yes No
Orientation independence Yes No
Computation time 2 h 30 min 15 s

* Times for processing with UJA-SHFD the cortical surface shown in Fig. 1 (306,710 faces and 153,357 vertices) on our Server platform. SHFD time includes global
(1 SHFD value) and local processing (153,357 SHFD values). Box-counting time includes only global processing (1 FD value).

to the fact that the Server platform has a much more powerful CPU than the PC platform. Time comparison between surfaces on the
same platform shows that the general processing depends almost linearly on the number of faces of the surface.
We have also compared the performance and features of our SHFD software to those of the box-counting algorithm. To that end,
we computed the voxelization of the cortical surface shown in Fig. 1 at a resolution of 256 × 256 × 256 voxels (equivalent to a
definition of 1 mm isotropic voxels, see Fig. 6). This voxelization was then successively divided by 2, counting the number of voxels,
Nr , in each voxelization of size r. Then the FD value was estimated as the slope of the linear piece of the regression line for the log–log
plot of Nr vs. 1/r. The process for calculating the FD value was computed in MATLAB R2013a as described in [14] using the surface
voxelization software provided in [33]. Table 2 shows the comparison of the main features of both algorithms for computing FD:
spherical harmonics as implemented in UJA-SHFD and box-counting. FD estimations at global and regional levels can be obtained with
both algorithms, however only SHFD is able to compute a local FD value for each surface vertex. SHFD computation does not depend on
the orientation of the surface, however we will obtain different values of FD by using the box-counting algorithm for the same surface
if its orientation changes. As an example, we executed three times the box-counting algorithm for the surface in Fig. 1 but with three
orientations (original, and rotated 35 and 55 degrees on the Z axis). Three different FD values were obtained with differences of up to
6%. Running-time differences between both algorithms shown in Table 2 are due to the fact that it is not possible to compute local FD
by using the box-counting algorithm, so only one value of global box-counting FD was calculated. However, SHFD algorithm is able to
compute FD at local level, therefore the time shown in Table 2 corresponds to the calculation of a FD map consisting of 153,357 SHFD
values.
Compared to UJA-SHFD, CAT12 software performed much faster for computing the SHFD map of the cortical surface (surface in
Fig. 1 was processed in 17.46 min on our server platform). The main reason for that better performance is that SHFD computation in
CAT12 always uses a fixed set of only ten surface reconstructions, where the minimum Lmax value is 11 and the maximum Lmax value
is 29. If our software calculated only those ten surface reconstructions, the computation time would be reduced in approximately a
71% regarding timing shown in Table 1 (44.7 min for computing surface in Fig. 1 on the server platform), obtaining a performance still
worse than but much closer to CAT12.
J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381 7

Fig. 6. Voxelization of the cortical surface in Fig. 1 (grid size: 256 × 256 × 256, number of voxels: 319,079).

The reported computation times in Table 1 make it very difficult to calculate the SHFD for large datasets of high-resolution surfaces,
unless each individual surface is computed in parallel on multi-core platforms. Section 6 shows how we have successfully used UJA-
SHFD in a study examining patients with Mild Cognitive Impairment progressing to Alzheimer’s disease, involving 187 subjects and
748 cortical surfaces. This example also provides detailed scripts for launching UJA-SHFD in parallel over a set of surfaces.

5. Availability of the program: download, installation and usage

The MATLAB source code of UJA-SHFD is publicly available and can be downloaded from https://www.ugr.es/~demiras/ujashfd. For
Windows, UJA-SHFD MEX-files were generated using Microsoft Visual C++ 2012, so Microsoft Visual Studio 2012 run-time libraries
are required. These run-time libraries can be downloaded from the Microsoft website: https://www.microsoft.com/en-US/download/
details.aspx?id=30679. No other special installation steps are needed.
There are two ways of executing UJA-SHFD: at the MATLAB prompt or as an operating system process. The latter is useful when
several surfaces have to be processed in parallel, as we will show in Section 6. Calling UJA-SHFD from the MATLAB prompt has the
following syntax:
>> uja_shfd: Start UJA-SHFD in GUI mode.
>> uja_shfd parameters: Start UJA-SHFD in console mode. The parameters syntax is:
surface_file [‘max_L’ max_level_value]
[‘min_L_reg_local’ min_level_value_for_local_SHFD]
[‘max_L_reg_local’ max_level_value_for_local_SHFD]
[‘min_L_reg_global’ min_level_value_for_global_SHFD]
[‘max_L_reg_global’ max_level_value_for_global_SHFD]
[‘sigma’ sigma_value_in_HK_smoothing]
[‘iterations’ number_of_iterations_in_HK_smoothing]
Default values are: ‘max_L’: 40, ‘min_L_reg_local’: 21, ‘max_L_reg_local’: 40, ‘min_L_reg_global’: 11,
‘max_L_reg_global’: 29, ‘sigma’: 1, and ‘iterations’: 900. These default values were selected following our experimental
tests, as described in Section 2.
Two examples (a FreeSurfer surface lh.pial and an OBJ surface lh_sim_10K.obj) can be downloaded from https://www.ugr.es/
~demiras/ujashfd. These two examples are pre-processed, meaning that the processes Compute Spherical Harmonics, Compute areas and
Heat Kernel Smoothing are already computed and the results of these processes are included in the example files. This pre-processing
saves the user a lot of computation time (several hours as shown in Table 1 for surface #1), so these two examples can be used to test
the application quickly:
>> uja_shfd ‘‘path_to_examples’’/ujashfd_examples/lh.pial
This command processes the FreeSurface cortical surface lh.pial with the default parameters. The map with the local SHFD will
be stored in FreeSurfer overlay format in the file lh.pial_localSHFD_1_900_21_40. The global SHFD will be stored in the text file
lh.pial_globalSHFD_11_29.txt.
>> uja_shfd ‘‘path_to_examples’’/ujashfd_examples/lh_sim_10K.obj
‘min_L_reg_global’ 1 ’max_L_reg_global’ 40
This command processes the OBJ surface lh_sim_10K.obj with default parameters except for min_L_reg_global (l = 1) and
max_L_reg_global (l = 40). The map with the local SHFD will be stored in FreeSurfer overlay format in the file
lh_sim_10K.obj_localSHFD_1_900_21_40. The global fractal dimension will be stored in the text file lh_sim_10K.obj_globalSHFD_1_40.txt.
UJA-SHFD, like any MATLAB program, can also be launched as an independent process in order to perform batch or parallel processing
of several surfaces. In that case, MATLAB has to be called without its GUI (-nodisplay, -nosplash and -nodesktop parameters) and
including UJA-SHFD as the script parameter as follows:
matlab -nojvm -nodisplay -nosplash -nodesktop -r ‘‘uja_shfd surface parameters’’
In the next section, we will use this type of invocation for processing in parallel all the surfaces involved in a study on a large sample
of individuals.
8 J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381

Fig. 7. Some results of the SHFD study on MCI and AD [26]. (A) Average map of local SHFD for the AD group in inflated surface. (B) Vertex-wise comparisons of
local SHFD between AD and MCI groups in inflated surface. P-values are shown for vertices presenting statistically significant differences between groups (non-gray
areas). P-value colorbar is displayed in -log10 (p-value) format.
Source: Adapted from Fig. 5 and Supplementary Figure 1 in [26].

6. Application of the program: SHFD in progression from mild cognitive impairment to Alzheimer’s disease

Previous studies of FD analysis in AD used single FD values to characterize the whole brain or hemisphere shape [34,35]. However,
considering that neurodegenerative disorders present distinctive structural changes along the cortical mantle, our primary motivation
for developing the UJA-SHFD software was to analyze the potential of FD for characterizing the atrophy progression in AD with higher
spatial resolution.
Once the processes of UJA-SHFD were developed and implemented, we used them to analyze the global and local SHFD of 33
AD patients, 122 MCI patients and 32 healthy controls (HC) [26]. The results of this analysis suggested that SHFD may be a useful
complement to other measures such as cortical thickness and the gyrification index in the monitoring of longitudinal changes in AD.
We found that global SHFD was reduced in AD and future MCI converters (MCI patients that developed AD in the end) compared to
HC. Global SHFD was found to be lower in MCI converters compared to MCI non-converters (MCI patients that remained stable in their
disease). We also found that the medial temporal lobe presented reduced local SHFD in AD compared to HC and MCI. Moreover, in
areas such as the medial frontal lobe, local SHFD was reduced in MCI converters compared to MCI non-converters.
In order to perform this study, cortical surface segmentation and extraction of the MRI data for the 187 subjects were performed
using the standard FreeSurfer recon-all command. Then we launched the UJA-SHFD processing in parallel for the 748 surfaces
corresponding to those subjects (four surfaces per subject: two FreeSurfer surfaces, pial and white, for each hemisphere) by using
the following c-shell code:
foreach dir ($SUBJECTS_DIR/*)
pbsubmit -c ‘ matlab -nojvm -nodisplay -nosplash --nodesktop \
-r \"uja_shfd {$dir/surf/lh.pial}\"’
pbsubmit -c ‘ matlab -nojvm -nodisplay -nosplash --nodesktop \
-r \"uja_shfd {$dir/surf/rh.pial}\"’
pbsubmit -c ‘ matlab -nojvm -nodisplay -nosplash --nodesktop \
-r \"uja_shfd {$dir/surf/lh.white}\"’
pbsubmit -c ’ matlab -nojvm -nodisplay -nosplash --nodesktop \
-r \"uja_shfd {$dir/surf/rh.white}\"’
end
The computational processing was performed on the high-performance compute cluster Launchpad (https://www.nmr.mgh.harvard.
edu/martinos/userInfo/computer/launchpad.php) at the Athinoula A. Martinos Center for Biomedical Imaging at Massachusetts General
Hospital (Boston - USA). Launchpad consists of 127 nodes, each one containing 8 CPUs and 56 GB of shared virtual memory. In that
c-shell script, the system variable $SUBJECTS_DIR indicates the user folder that contains a sub-folder for each subject, with the results
of the FreeSurfer recon-all process. FreeSurfer places the pial and white cortical surfaces for each hemisphere (lh.pial, rh.pial, lh.white
and rh.white) in the surf folder of each subject folder. The cluster script pbsubmit submits the job (MATLAB execution of UJA-SHFD) to
the scheduler on the batch cluster and queues it for execution. In order to execute that c-shell script in a multi-core system with no
job-queue, each surface has to be processed with the following command:
matlab -nojvm -nodisplay -nosplash -nodesktop \
-r \"uja_shfd {$dir/surf/surface}\" < /dev/null &
In this case, UJA-SHFD input must be redirected from /dev/null in order to be able to execute in parallel the process in background
(&). Calls to UJA-SHFD used the default parameters, which were selected as explained in Section 2.
By using the Compute Spherical Harmonics process of UJA-SHFD we obtained a set of 60 SH reconstructions for each cortical surface.
Global SHFD values and local SHFD maps were computed for all the cortical surfaces through the UJA-SHFD processes Compute Global
SHFD, Compute Local SHFD and Compute FreeSurfer Overlay. Each individual map was smoothed by using the FreeSurfer command
mri_surf2surf with a default FWHM value of 10 mm. Individual maps were then re-parameterized to a common space through
the command mris_preproc. The FreeSurfer command mri_concat was used to compute the average map for each group. As an
example, Fig. 7.A shows the average map of local SHFD for the AD group. Vertex-wise comparisons between groups were performed
using the general linear model in FreeSurfer through the mri_glmfit tool. Surface maps showing significant differences between groups
were then generated through the FreeSurfer tool tksurfer (see Fig. 7.B).
J. Ruiz de Miras, G. Martínez-Lledó, W. Orwig et al. / Computer Physics Communications 254 (2020) 107381 9

7. Conclusions

UJA-SHFD is a MATLAB program for calculating the SHFD of 3D surfaces, specifically designed for processing cortical surfaces using
the common FreeSurfer pipeline. Based on spherical harmonics FD, UJA-SHFD can compute the FD of the surface not only at the global
level (an FD value for the entire surface) but also for each vertex of the surface, in order to obtain a surface map of SHFD. The program
was designed with the user in mind, to create interactive functionality through an intuitive graphical interface. Additionally, UJA-SHFD
can be invoked at the command line, which allows the user to perform batch or parallel analyses over a series of case studies and using
different parameters. Compared to CAT12, the only other publicly available software for computing SHFD, UJA-SHFD is more general
and flexible, but at the cost of requiring more processing time. SHFD computation in CAT12 is only available as a predefined and not
configurable step of the whole processing pipeline (the number of surface reconstructions to compute and the parameters to obtain
the FD value cannot be chosen), and general surface meshes cannot be directly processed.
In this article, we have also provided step-by-step instructions for how to use UJA-SHFD in a neuroimaging study on characterizing
brain atrophy in the progression from mild cognitive impairment to Alzheimer’s disease [26]. Following these instructions, neuroimaging
specialists can use UJA-SHFD to develop studies on brain morphology in different neurodegenerative and neuropsychiatric disorders.
Our performance analysis of UJA-SHFD on two different hardware/software platforms indicated that the main limitation of the
program is the high computational cost of the whole process, mainly due to the steps involving the generation of SH reconstructions
and smoothing those surfaces through the heat kernel algorithm. Accordingly, our future efforts will focus on improving these two
algorithms by applying techniques such as graphics processing unit (GPU) parallel programming, through direct reprogramming of the
algorithms [36] or by using the MATLAB parallel computing toolbox [37].

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.

Acknowledgments

This work has been partially supported by the Spanish Government and the European Union through the mobility grant PRX14/00528
(JRdM) and the National Institutes of Health, USA grant K23EB019023 (JS). The high-performance compute cluster Launchpad is
supported by the Instrumentation Grants 1S10RR023401, 1S10RR019307, and 1S10RR023043.

References

[1] B.B. Mandelbrot, The Fractal Geometry of Nature, 1983.


[2] A. Di Ieva, F.J. Esteban, F. Grizzi, W. Klonowski, M. Martín-Landrove, 21 (2015) 30–43.
[3] D.A. Russell, J.D. Hanson, E. Ott, Phys. Rev. Lett. 45 (1980) 1175–1178.
[4] F.J. Esteban, J. Sepulcre, N. Demendizabal, J. Goni, J. Navas, J. Ruiz De Miras, B. Bejarano, J.C. Masdeu, P. Villoslada, N.V. de Mendizábal, J. Goñi, Neuroimage 36
(2007) 543–549.
[5] L. Zhang, A.J. Butler, C.-K. Sun, V. Sahgal, G.F. Wittenberg, G.H. Yue, Brain Res. 1228 (2008) 229–240.
[6] L. Pantoni, C. Marzi, A. Poggesi, A. Giorgio, N. De Stefano, M. Mascalchi, D. Inzitari, E. Salvadori, S. Diciotti, Neuroimage Clin. 24 (2019) 101990.
[7] R. Sheelakumari, V. Rajagopalan, A. Chandran, T. Varghese, L. Zhang, G.H. Yue, P.S. Mathuranath, C. Kesavadas, Brain Imaging Behav. 12 (2018) 1221–1228.
[8] I. Nenadic, R.A. Yotter, M. Dietzek, K. Langbein, H. Sauer, C. Gaser, Psychiatry Res. Neuroimaging 263 (2017) 44–47.
[9] K.M. Kubera, M.M. Schmitgen, D. Hirjak, R.C. Wolf, M. Orth, Neuroimage Clin. 23 (2019) 101913.
[10] C.R. Madan, Aging Ment. Health 23 (2019) 800–810.
[11] Z. Ma, B. Jing, Y. Li, H. Yan, Z. Li, X. Ma, Z. Zhuo, L. Wei, H. Li, J. Alzheimers. Dis. 73 (2020) 991–1002.
[12] J. Ruiz de Miras, F. Soler, S. Iglesias-Parro, A.J. Ibáñez-Molina, A.G. Casali, S. Laureys, M. Massimini, F.J. Esteban, J. Navas, J.A. Langa, Comput. Methods Programs
Biomed. 175 (2019) 129–137.
[13] J. Ruiz de Miras, J. Navas, P. Villoslada, F.J. Esteban, Comput. Methods Programs Biomed. 104 (2011).
[14] J. Ruiz de Miras, in: A. Di Ieva (Ed.), Fractal Geom. Brain, Springer New York, New York, NY, 2016, pp. 523–532.
[15] I.V. Grossu, I. Grossu, D. Felea, C. Besliu, A. Jipa, T. Esanu, C.C. Bordeianu, E. Stan, Comput. Phys. Comm. 184 (2013) 1344–1345.
[16] C.R. Madan, E.A. Kensinger, Neuroimage 134 (2016) 617–629.
[17] J. Jiménez, A.M. López, J. Cruz, F.J. Esteban, J. Navas, P. Villoslada, J. Ruiz de Miras, J. Biomed. Inform. 51 (2014) 1.
[18] J. Jiang, W. Zhu, F. Shi, Y. Zhang, L. Lin, T. Jiang, J. Neurosci. Methods 172 (2008) 122–130.
[19] R.D. King, Appl. Math. 05 (2014) 1733–1740.
[20] R.A. Yotter, I. Nenadic, G. Ziegler, P.M. Thompson, C. Gaser, Neuroimage 56 (2011) 961–973.
[21] I. Nenadic, R.A. Yotter, H. Sauer, C. Gaser, Hum. Brain Mapp. 35 (2014) 1691–1699.
[22] L. Shen, H. Farid, M.A. McPeek, Evolution (N. Y). 63 (2009) 1003–1016.
[23] M. Styner, I. Oguz, S. Xu, C. Brechbühler, D. Pantazis, J.J. Levitt, M.E. Shenton, G. Gerig, Insight J. (2006) 242–250.
[24] C.R. Madan, E.A. Kensinger, Brain Inform. 4 (2017) 107–121.
[25] B. Polspoel, M. Vandermosten, B. De Smedt, Neuropsychologia (2019) 107293.
[26] J. Ruiz de Miras, V. Costumero, V. Belloch, J. Escudero, C. Ávila, J. Sepulcre, Hum. Brain Mapp. (2017).
[27] B. Fischl, A.M. Dale, Proc. Natl. Acad. Sci. USA 97 (2000) 11050–11055.
[28] M. Schaer, M. Bach Cuadra, L. Tamarit, F. Lazeyras, S. Eliez, J.P. Thiran, IEEE Trans. Med. Imaging 27 (2008) 161–170.
[29] C. Gaser, R. Dahnke, in: Hum. Brain Mapp., Geneva (Switzerland), 2016.
[30] R.A. Yotter, P.M. Thompson, I. Nenadic, C. Gaser, Lect. Notes Comput. Sci. (Including Subser. Lect. Notes Artif. Intell. Lect. Notes Bioinformatics), 2010, pp.
169–176.
[31] K. Zhou, H. Bao, J. Shi, Comput. Des. 36 (2004) 363–375.
[32] M.K. Chung, S.M. Robbins, K.M. Dalton, R.J. Davidson, A.L. Alexander, A.C. Evans, Neuroimage 25 (2005) 1256–1265.
[33] D.J. Kroon, 2020, https://Www.Mathworks.Com/Matlabcentral/Fileexchange/24086-Polygon2voxel.
[34] R.D. King, B. Brown, M. Hwang, T. Jeon, A.T. George, Neuroimage 53 (2010) 471–479.
[35] F.J. Esteban, P. Villoslada, J. Ruiz de Miras, N.V. de Mendizábal, J. Navas, J. Goñi, J. Sepulcre, in: 16th Annu. Meet. Organ. Hum. Brain Mapp. Barcelona (España),
2010, p. 171.
[36] M. Carlson, H. Sundar, in: 2018 IEEE High Perform. Extrem. Comput. Conf. HPEC 2018, 2018, pp. 1–6.
[37] G. Sharma, J. Martin, Int. J. Parallel Program. 37 (2009) 3–36.

You might also like