An Adaptive Space-Filling Curve Trajectory for Ordering 3D Datasets to 1D: Application to Brain Magnetic Resonance Imaging Data for Classification

  • Unal SakogluEmail author
  • Lohit Bhupati
  • Nazanin Beheshti
  • Nikolaos Tsekos
  • Lennart Johnsson
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 12139)


In this work, we develop an adaptive, near-optimal, 3-Dimensional (3D) to 1D ordering methodology for brain magnetic resonance imaging (MRI) data, using a space-filling curve (SFC) trajectory, which is adaptive to brain’s shape as captured by MRI. We present the pseudocode of the heuristics for developing the SFC trajectory. We apply this trajectory to functional MRI brain activation maps from a schizophrenia study, compress the data, obtain features, and perform classification of schizophrenia patients vs. normal controls. We compare the classification results with those of a linear ordering trajectory, which has been the traditional method for ordering 3D MRI data to 1D. We report that the adaptive SFC trajectory-based classification performance is superior than the linear ordering trajectory-based classification.


Space-filling curve Classification MRI Neuroimaging Adaptive compression 

1 Introduction

Magnetic resonance imaging (MRI) is a widely used tomography technology which is used to capture the structure of the brain in three dimensions (3D) of space. A specific modality of MRI technology, known as functional MRI (fMRI), can capture hemodynamic response signals from the brain within the order of s, in a repeated manner, albeit in lower spatial resolution. FMRI therefore includes in time-series data for each volume element (voxel) of the brain. Datasets of both structural and functional MRI, which are 3D spatial matrices (e.g. a 64 × 64 × 64 matrix), generally have to be converted to vector arrays of a single dimension (1D), for further analyses (Fig. 1), such as analyses with general linear models, regression, and independent component analysis. Traditionally, a linear ordering/mapping of data from 3D to 1D have been used for this purpose, i.e. 3D data are scanned consecutively along the first, second, third spatial dimensions in order to obtain a 1D ordering of volumes. Linear ordering introduces large ‘jumps’ or ‘discontinuities’ of the recorded signal; for example, if it is applied to structural MRI datasets, it does not preserve the structure of the brain in 1D.
Fig. 1.

Three views of a structural T1 MRI dataset (a), and an fMRI brain activation map (b), which is computed from fMRI volumes taken at multiple time-points. Conventionally, fMRI dataset voxels are ordered using linear ordering trajectory into rows of a matrix, as a result, a matrix of time×voxels is generated for further analyses (c).

Previously, pre-defined space-filling curves such as Hilbert curve and Z-curve have been suggested for ordering of the 3D MRI datasets [1]. Hilbert curve, specifically, results in better preservation of local features [2, 3, 4] when compared to linear ordering; it was shown in [1] that it could result in less discontinuities in brain MRI signals, and it was also applied for classification based on fMRI brain activation maps [5, 6]. In general, space-filling curves are used in a wide range of applications [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] in reducing two or higher dimensional spaces to a one-dimensional space. Hilbert [4, 9] and Z [9] orderings are among the most widely used methods focused on preserving spatial locality in the mapping to one dimension. However, as has been noticed by e.g. the image compression community [17, 18, 19, 20, 21, 22, 23, 24] context-aware, or adaptive [20, 21, 22, 23, 24] orderings taking pixel attributes into account in addition to spatial information leads to better compression.

In [1], using a least-squares signal-difference approach which uses sum of squared signal intensity differences (TSSID) was proposed as a cost function and measure of how adaptive an SFC was to the data/signal being traversed. Since the cost function is the sum of signal ‘jumps’, the goal is to minimize the cost function to find the most adaptive trajectory. In the context of 3D brain imaging, by traversing 3D volumes using a space-filling curve (SFC) that is adaptive to brain’s shape, a 3D MRI image can be ordered into 1D space (e.g. into a 643 × 1 vector from a 64 × 64 × 64 volume), which can better preserve the brain’s structure in 1D. Although this idea was suggested in [1], it was noted that this was inherently a Hamiltonian path problem which also can be formulated as a modified traveling salesman problem (TSP), which is an NP-hard problem to solve. With as many nodes as number of voxels, which is on the order of thousands for fMRI brain activation datasets, it makes the problem computationally intractable [1]. If an approximation of an adaptive SFC could be found and applied for 3D to 1D ordering of the dataset, any dimensionality reduction, smoothing, down-sampling, compression, and feature selection/reduction in 1D could benefit from better preservation of information, when compared with linear ordering, or other predefined orderings such as the Hilbert curve ordering.

In this work, we computed an SFC adaptive to brain’s shape (as recorded in a T1 MRI canonical/template image as an example) and developed an algorithm pipeline which uses the computed SFC for ordering of fMRI activation maps from 3D to 1D, obtains features from the 1D orderings, and performs classification of participants; we applied the pipeline to an fMRI study of two groups of participants: schizophrenia patients (SP) and healthy controls (HC), and performed classification of a given brain activation map belonged to SP or HC.

2 Materials and Methods

2.1 Data and Participants

95 schizophrenia patients (SP) and 89 healthy control (HC) participants were scanned using 3T Siemens Trio MRI scanners at four different research sites in the USA. Research protocol was reviewed and approved by the institutional review board of the local institutions where scans were performed, and written consent was obtained from each participant. The parameters for the functional scan were: TR/TE = 2 s/30 ms, BW = ±100 kHz = 3126 Hz/pixel, FA = 90°, slice thickness 4 mm, slice gap 1 mm, voxel size = 3.4 mm × 3.4 mm × 4 mm, FOV = 22 cm, PACE-enabled, single shot, single-echo EPI pulse sequence, oblique axial slice plane; 64 × 64 acquisition matrix, 27 slices in ascending sequential acquisition. Participants performed a sensorimotor (SM) task during the scan. After standard pre-processing, MRI volumes were warped to Montreal Neurological Institute (MNI) standard canonical/template T1 MRI volume [7]. The fMRI activation maps computed as standard parametric maps of t-value with the SM task, were resampled to the 3 mm × 3 mm × 3 mm standard MNI volume, which resulted in 53 × 63 × 46 data matrix. An adaptive space-filling curve (SFC) using the 53 × 63 × 46 T1 MRI template volume was computed using a graphical processing unit using a greedy search algorithm developed in-house.

2.2 The Adaptive Space-Filling Curve Algorithm for 3D MRI Data

The algorithm proceeds as follows. At any voxel, the signal values of its 26 immediate neighbors in 3D is retrieved and sorted based on their signal intensity difference with the current voxel. The next voxel along the adaptive SFC is selected as the voxel with the minimum absolute signal difference that is not already included in the adaptive SFC. The algorithm traverses back in the list of voxels selected for the adaptive SFC until one voxel to be included in the SFC is found. Using the list for backtracking in the worst case requires a time proportional to the length of the list and hence in the worst case is of O(n) where n is the length of the list. Instead, a hash table is used with key value 1 if a voxel is included in the SFC, otherwise the value is zero. A snapshot of the SFC obtained from the T1 image is presented in Fig. 2 and Table 1.
Table 1.

SFC algorithm execution flow/pseudocode for traversing 3D MRI signal

Fig. 2.

A color-coded space-filling curve (SFC) trajectory of a template T1 MRI brain in Montreal Neurological Institute (MNI) brain template space. This trajectory was applied to the SFC orderings of the fMRI brain activation maps in this study. Cold (blue): beginning; hot (yellow): end. (Color figure online)

To make the algorithm faster and reduce memory consumption we remove voxels with zero signal intensity in a preprocessing step before applying the algorithm, since zero signal voxels provide no useful information for feature selection for classification. In a predefined SFC, such as the Hilbert SFC, voxels with zero signal intensity are not consecutive and they are scattered over the SFC, and their indexes have to be traced. In the adaptive SFC, these voxels are consecutive and either at the beginning or at the end of the curve and they can be easily trimmed reducing the number of useless signals in the data. Figure 3 presents this effect. Using a pre-defined space-filling curve such as Hilbert curve results in tracing the full volume (Fig. 3(a)), versus, the adaptive space filling curve results in voxels with only non-zero signal values, a 57% reduction in the number of voxels (Fig. 3(b)).

2.3 Using SFC-Ordered FMRI Activation Data as Features for Classification

The 3D fMRI maps from each participant were converted to 1D with linear ordering and also with the computed adaptive SFC. The 1D arrays were down-sampled by a bin size of 100, values were averaged across each bin (“binning”), which constituted raw features. Features were further reduced to 100, and also to 30, by using and support vector machine based sequential forward search feature reduction algorithm [8]. The reduced features were used to train the classification algorithm by using a random 70% of the dataset and were tested on the remaining 30%. The training-testing process was repeated 100 times by using new random selection of training and testing datasets. Average classification accuracies were computed. The results are presented in the next section.

3 Results

To make the algorithm faster and reduce memory consumption we remove voxels with zero signal intensity in a preprocessing step before applying the algorithm. As an example, around 57% of voxels in one of the 3D T1 MRI brain were zero. The impact of removing zero signal voxels is clearly visible in Fig. 3.

Figure 4 presents a sample progression snapshots of the adaptive SFC at the end of the trajectory, where the SFC is traversing mostly along the outer surface of the brain. Part of the SFC with length of 1000, 3000, 5000, and 7000 (in red color) are overlaid on the full-length adaptive SFC (in gray color). Traversal of the MRI signal along the brain’s shape, hence adaptive to the brain’s shape, is visible.

The signal intensities and absolute signal intensity differences along the Hilbert and adaptive SFCs are shown in Fig. 5. The adaptive SFC results in less signal intensity difference along successive voxels along the trajectory than Hilbert SFC, and hence it results in less total squared signal intensity difference (TSSID). The impact on the total squared signal difference between successive voxels along the SFC and the SFC length is shown in Table 2. Relative total TSSID between successive voxels along the SFC and the relative length of the SFC is computed for the adaptive and the Hilbert SFCs for our data, the canonical 3D T1 MRI image. The adaptive SFC has 50.5 times less relative TSSID than the Hilbert SFC, and it is 34% shorter.

Figure 6 (a) shows a 1D-ordered signal array from a participant’s fMRI activation map, not by using an SFC, but by using linear ordering, which is the commonly used, traditional ordering method of 3D signals to 1D. A zoomed version (b) and a binned version (c) are also presented in Fig. 6. Large discontinuities along the slices are visible, and further discontinuities inherent in the scheme are visible in the zoomed version, hence the result of binning includes many signals of zero-values. Figure 7 shows results of the adaptive SFC trajectory-based 1D-ordered signal array. Large clusters can be seen in the adaptive SFC trajectory-based array, whereas linear ordering resulted in a highly disconnected or un-clustered brain activation signal. Large clusters are also visible in the zoomed portion (b), and the binning includes no voxels with zero-values (c); in general, the binned adaptive SFC array includes only few such voxels.

Using the SFC trajectory-based ordering, an SVM classification algorithm resulted in 72.1% (74.6%) average accuracy in classification of SP vs. HC participants, whereas the linear ordering resulted in around 49.9% (50.0%) classification accuracy, using 30 (100) features, employing a sequential forward search algorithm for the reduction of features. SFC-based ordering resulted in significantly higher accuracy, whereas linear ordering resulted in just about chance accuracy of 50%. Performing a 4 × 4 × 4 down-sampling of the brain activation maps directly in 3D, and then ordering the resulting down-sampled brain with linear ordering, using the resulting signal as features, resulted also with chance accuracy of around 50% for participant classification. Overall, SFC-based classification results were significantly higher.
Fig. 3.

(a) Using a pre-defined space-filling curve such as Hilbert curve here results in tracing of the full volume (high redundancy), versus, (b) the adaptive space filling curve results in voxels with non-zero signal values, a 57% reduction in the number of voxels (low redundancy).

Fig. 4.

Representation of fMRI brain activation traversal by the SFC for the last a) 1000, 3000, 5000 and 7000 voxels (red), overlaid on the total SFC trajectory (gray), representing a sample progression of the SFC trajectory during the last 7000-voxel portion of the SFC. (Color figure online)

Table 2.

Merit of the adaptive SFC vs. the Hilbert curve for our data set

Relative TSSID between successive voxels along the SFC

Relative length of the SFC









Fig. 5.

Signal intensity along the trajectory for successive voxels using Hilbert SFC (top) and the adaptive SFC (bottom).

Fig. 6.

Top: Linearly-ordered fMRI activation signal in 1D. Middle: a horizontally zoomed portion of the signal. Bottom: bar plot of the zoomed portion after averaging (binning).

Fig. 7.

Top: SFC-ordered fMRI activation signal in 1D. Middle: a horizontally zoomed portion of the signal. Bottom: bar plot of the zoomed portion after averaging (binning).

4 Conclusions and Discussions

An adaptive space-filling curve (SFC) trajectory which is adaptive to brain’s shape can be utilized for 1D ordering of 3D MRI data, such as brain activation maps in fMRI, and this ordering proves to be better than using the traditional linear ordering or pre-defined ordering such as Hilbert ordering. We have shown that it reduces the amount of discontinuities and results in shorter signal with less redundancy. In this work, we used the adaptive SFC for feature reduction in classification using fMRI brain activation maps and we showed that SFC ordering resulted in better features from the activation maps, which resulted in higher classification accuracy of two groups of participants, schizophrenia patients and healthy controls.

The results her need to be replicated with larger sample sizes and with other fMRI studies. In addition to using a canonical T1 MRI image, adaptive SFCs can be obtained using T2, DTI, echo-planar imaging (EPI) and many more kinds of different canonical MRI images in the standard imaging space such as MNI space, and they can be applied to traverse participants’ brain imaging data in the standard imaging space, and the traversed data can be subsequently compressed, binned, features extracted, and many more applications can be done.

Potential future work also involves using different feature reduction methods and different classification algorithms, and compression of fMRI data based on SFCs.

Overall, data-adaptive SFCs have great potential in adaptive compression of datasets as well, in order to minimize information loss in compression.



This research was supported by UHCL College of Science and Engineering, and UHCL Office of Research and Sponsored Programs. Dr. Unal Sakoglu thanks Dr. Vince Calhoun at Tri-institutional Center for Translational Research in Neuroimaging and Data Science (TReNDS), Georgia State University, Atlanta, USA, for providing fMRI activation map data.


  1. 1.
    Sakoglu, U., Arslan, A.N., Bohra, K., Flores, H.: In search of optimal space-filling curves for 3-D to 1-D mapping: application to 3-D brain MRI data. In: Proceedings of the 6th International Conference on Bioinformatics and Computational Biology (BICOB), pp. 61–66. International Society for Computers and their Applications (ISCA), Las Vegas (2014)Google Scholar
  2. 2.
    Hilbert, D.: Über die stetige Abbildung einer Linie auf ein Flächenstück (in German). Math. Ann. 38(3), 459–460 (1891)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Griffiths, J.Q.: An algorithm for displaying a class of space-filling curves. Softw. Pract. Exper. 16, 403–411 (1986)CrossRefGoogle Scholar
  4. 4.
    Moon, B., Jagadish, H., Faloutsos, C., Saltz, J.: Analysis of the clustering properties of the Hilbert space-filling curve. IEEE Trans. Knowl. Data Eng. 13(1), 124–141 (2001)CrossRefGoogle Scholar
  5. 5.
    Kontos, D., Megalooikonomou, V., Ghubade, N., Faloutsos, C.: Detecting discriminative functional MRI activation patterns using space filling curves. In: Proceedings of the Engineering in Medicine and Biology Conference, pp. 963–966. IEEE, Hoboken (2003)Google Scholar
  6. 6.
    Wang, Q., Kontos, D., Li, G., Megalooikonomou, V.: Application of time series techniques to data mining and analysis of spatial patterns in 3D images. In: Proceedings of the International Conference on Acoustics, Speech and Signal Processing, pp. 525–528. Institute for EEE, Hoboken (2004)Google Scholar
  7. 7.
    Evans, A.C., Lanke, A.L., Collins, D.L., Baillet, S.: Brain templates and atlases. Neuroimage 62, 911–922 (2010)CrossRefGoogle Scholar
  8. 8.
    Alpaydin, E.: Introduction to Machine Learning, 3rd edn. MIT Press, Cambridge (2014)zbMATHGoogle Scholar
  9. 9.
    Sagan, H.: Space-Filling Curves. Springer, Heidelberg (2012)zbMATHGoogle Scholar
  10. 10.
    Sasidharan, A., Dennis, J.M., Snir, M.: A general space-filling curve algorithm for partitioning 2D meshes. In: 2015 IEEE 17th International Conference on High Performance Computing and Communications, 2015 IEEE 7th International Symposium on Cyberspace Safety and Security, and 2015 IEEE 12th International Conference on Embedded Software and Systems. IEEE (2015)Google Scholar
  11. 11.
    Sasidharan, A., Snir, M.: Space-filling curves for partitioning adaptively refined meshes. Math. Comput. Sci. (2015)Google Scholar
  12. 12.
    Harlacher, D.F., et al.: Dynamic load balancing for unstructured meshes on space-filling curves. In: 2012 IEEE 26th International Parallel and Distributed Processing Symposium Workshops & PhD Forum. IEEE (2012)Google Scholar
  13. 13.
    Mellor-Crummey, J., Whalley, D., Kennedy, K.: Improving memory hierarchy performance for irregular applications using data and computation reorderings. Int. J. Parallel Prog. 29(3), 217–247 (2001)CrossRefGoogle Scholar
  14. 14.
    Jagadish, H.V.: Linear clustering of objects with multiple attributes. In: Proceedings of the 1990 ACM SIGMOD International Conference on Management of Data (1990)Google Scholar
  15. 15.
    Lawder, J.K.: The application of space-filling curves to the storage and retrieval of multi-dimensional data. Dissertation, University of London, Birkbeck (2000)Google Scholar
  16. 16.
    Asano, T., Ranjan, D., Roos, T., Welzl, E., Widmayer, P.: Space-filling curves and their use in the design of geometric data structures. Theor. Comput. Sci. 181(1), 3–15 (1997)MathSciNetCrossRefGoogle Scholar
  17. 17.
    Moghaddam, B., Hintz, K.J., Stewart, C.V.: Space-filling curves for image compression. In: Automatic Object Recognition. International Society for Optics and Photonics (1991)Google Scholar
  18. 18.
    Liang, J.Y., et al.: Lossless compression of medical images using Hilbert space-filling curves. Comput. Med. Imaging Graph. 32(3), 174–182 (2008)CrossRefGoogle Scholar
  19. 19.
    Lai, Z., et al.: Image reconstruction of compressed sensing MRI using graph-based redundant wavelet transform. Med. Image Anal. 27, 93–104 (2016)CrossRefGoogle Scholar
  20. 20.
    Dafner, R., Cohen-Or, D., Matias, Y.: Context‐based space filling curves. In: Computer Graphics Forum. Blackwell Publishers Ltd., Oxford and Boston (2000)Google Scholar
  21. 21.
    Bar-Joseph, Z., Cohen-Or, D.: Hierarchical context-based pixel ordering. In: Computer Graphics Forum. Blackwell Publishing Inc., Oxford (2003)Google Scholar
  22. 22.
    Ouni, T., Abid, M.: Scan methods and their application in image compression. Int. J. Signal Proc. Image Proc. Pattern Recogn. 5(3), 49–64 (2012)Google Scholar
  23. 23.
    Itani, A., Das, M.: Self-describing context-based pixel ordering. In: Bebis, G., Boyle, R., Koracin, D., Parvin, B. (eds.) ISVC 2005. LNCS, vol. 3804, pp. 413–419. Springer, Heidelberg (2005). Scholar
  24. 24.
    Ouni, T., Lassoued, A., Abid, M.: Gradient-based space filling curves: application to lossless image compression. In: 2011 IEEE International Conference on Computer Applications and Industrial Electronics (ICCAIE). IEEE (2011)Google Scholar
  25. 25.
    Haverkort, H.: Sixteen space-filling curves and traversals for d-dimensional cubes and simplices. arXiv preprint arXiv:1711.04473 (2017)
  26. 26.
    Lazarus, C., et al.: SPARKLING: variable-density k-space filling curves for accelerated T2*-weighted MRI. Magn. Reson. Med. 81(6), 3643–3661 (2019)CrossRefGoogle Scholar
  27. 27.
    Corcoran, T., et al.: A spatial mapping algorithm with applications in deep learning-based structure classification. arXiv preprint arXiv:1802.02532 (2018)

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  • Unal Sakoglu
    • 1
    Email author
  • Lohit Bhupati
    • 2
  • Nazanin Beheshti
    • 3
  • Nikolaos Tsekos
    • 3
  • Lennart Johnsson
    • 3
  1. 1.Computer EngineeringUniversity of Houston – Clear LakeHoustonUSA
  2. 2.Computer ScienceUniversity of Houston – Clear LakeHoustonUSA
  3. 3.Computer ScienceUniversity of HoustonHoustonUSA

Personalised recommendations