Multidimensional Contrast Limited Adaptive Histogram Equalization
Vincent Stimper Stefan Bauer Ralph Ernstorfer Bernhard Schölkopf R. Patrick Xian


Magnetic order in  Nd_2PdSi_3 investigated using neutron scattering and muon spin relaxation
    A. D. Hillier
    December 30, 2023
============================================================================================




Contrast enhancement is an important preprocessing technique for improving the performance of downstream tasks in image processing and computer vision. Among the existing approaches based on nonlinear histogram transformations, contrast limited adaptive histogram equalization (CLAHE) is a popular choice for dealing with 2D images obtained in natural and scientific settings. The recent hardware upgrade in data acquisition systems results in significant increase in data complexity, including their sizes and dimensions. Measurements of densely sampled data higher than three dimensions, usually composed of 3D data as a function of external parameters, are becoming commonplace in various applications in the natural sciences and engineering. The initial understanding of these complex multidimensional datasets often requires human intervention through visual examination, which may be hampered by the varying levels of contrast permeating through the dimensions. We show both qualitatively and quantitatively that using our multidimensional extension of CLAHE (MCLAHE) simultaneously on all dimensions of the datasets allows better visualization and discernment of multidimensional image features, as demonstrated using cases from 4D photoemission spectroscopy and fluorescence microscopy. Our implementation of multidimensional CLAHE in Tensorflow is publicly accessible and supports parallelization with multiple CPUs and various other hardware accelerators, including GPUs.


Keywords: Contrast enhancement, histogram equalization, multidimensional data analysis, photoemission spectroscopy, fluorescence microscopy.



§ INTRODUCTION


Contrast is instrumental for visual processing and understanding of the information content within images in various settings <cit.>. Therefore, computational methods for contrast enhancement (CE) are frequently used to improve the visibility of images <cit.>. Among the existing CE methods, histogram transform-based algorithms are popular due to their computational efficiency. Natural images with a high contrast often contain a balanced intensity histogram, this conception led to the development of histogram equalization (HE) <cit.>. A widely adopted example in this class of CE algorithms is the contrast limited adaptive histogram equalization (CLAHE) <cit.>, originally formulated in 2D, which performs local adjustments of image contrast with low noise amplification. The contrast adjustments are interpolated between the neighboring rectilinear image patches called kernels and the spatial adaptivity in CLAHE is achieved through selection of the kernel size. The intensity range of the kernel histogram (or local histogram) is set by a clip limit that restrains the noise amplification in the outcome. Accounts of the historical development are given in Section II. The use cases of CLAHE and its variants range from underwater exploration <cit.>, breast cancer detection in X-ray mammography <cit.>, biometric authentication <cit.>, video forensics <cit.> to charging artifact reduction in electron microscopy <cit.> and multichannel fluorescence microscopy <cit.>. Due to the original formulation, its applications are concentrated almost exclusively in fields and instruments producing 2D imagery.

However, the current data acquisition systems are capable of producing densely sampled image data at three or higher dimensions at high rates <cit.>, following the rapid progress in spectroscopic and imaging methods in the characterization of materials and biological systems. Sifting through the image piles to identify relevant features for scientific and engineering applications is becoming an increasingly challenging task. Despite the variety of experimental techniques, the parametric dependence (with respect to time, temperature, pressure, wavelength, concentration, etc.) in the measured system resulting from internal dynamics or external perturbations are often translated into intensity changes registered by the imaging detector circuit <cit.>. Visualizing and extracting multidimensional image features from acquired data often begin with human visual examination, which is influenced by the contrast determined by the detection mechanism, specimen condition and instrument resolution. To assist multidimensional image processing and understanding, the existing CE algorithms formulated in 2D should adapt to the demands in higher dimensions (3D and above). Recently, a 3D extension of CLAHE acting simultaneously on all dimensions has been described and shown to compare favorably over 2D CLAHE for volumetric (3D) imaging data both in visual inspection and in a contrast metric, the peak signal-to-noise ratio (PSNR) <cit.>.

The formulations of 2D <cit.> and 3D CLAHE <cit.> algorithms include individual treatment of the image boundaries (corners and the various kinds of edges), which becomes tedious in higher dimensions. In addition, the scalable computation of kernel histograms and intensity transforms presents a major challenge in higher dimensions. In this work, we formulate and implement multidimensional CLAHE (MCLAHE), a flexible and efficient generalization of the CLAHE algorithm to an arbitrary number of dimensions. The MCLAHE algorithm introduces a unified formulation of the image boundaries, allows the use of arbitrary-shape rectilinear kernels and expands the spatial adaptivity of CLAHE to the intensity domain with adaptive histogram range selection. The parallelized implementation of MCLAHE also enables hardware-dependent computational speed-up through the use of multiple CPUs and GPUs. None of these aspects pertaining to handling complex multidimensional imagery have garnered attention in the original formulation of 2D <cit.> or 3D CLAHE <cit.>. Next, we demonstrate the effectiveness of MCLAHE using visual comparison and computational contrast metrics of two 4D (3D+time) datasets in materials science by photoemission spectroscopy <cit.> and in biological science by fluorescence microscopy <cit.>, respectively. These two techniques are representatives of the current capabilities and complexities of multidimensional data acquisition methods in natural sciences. The use and adoption of CE in their respective communities will potentially benefit visualization and downstream data analysis. Specifically, in the photoemission spectroscopy dataset of electronic dynamics in a semiconductor material, we show that MCLAHE can drastically reduce the intensity anisotropy and enable visual inspection of dynamical features across the bandgap. In the fluorescence microscopy dataset of a developing embryo <cit.>, we show that MCLAHE improves the visual discernibility of cellular dynamics from sparse labeling. In addition, we provide a Tensorflow <cit.> implementation of MCLAHE publicly accessible on GitHub <cit.>, which enables the reuse and facilitates the adoption of the algorithm in a wider community.

The outline of the paper is as follows. In Section II, we highlight the developments in histogram equalization leading up to CLAHE and the use of contrast metrics in outcome evaluation. In Section III, we go into detail on the differentiators of the MCLAHE algorithm from previous lower-dimensional CLAHE algorithms. In Section IV, we describe the use cases of MCLAHE on 4D photoemission spectroscopy and fluorescence microscopy data. In Section V, we comment on the current limitations and potential improvements in the algorithm design and the software implementation. Finally, in Section VI, we draw the conclusions.



§ RELATED WORK


Histogram transform-based CE began with the histogram equalization algorithm developed by Hall in 1974 <cit.>, where a pixelwise intensity mapping derived from the normalized cumulative distribution function (CDF) of the entire image's intensity histogram is used to reshape the histogram into a more uniform distribution <cit.>. However, Hall's approach calculates the intensity histogram globally, which can overlook fine-scale image features of varying contrast. Subsequent modifications to HE introduced independently by Ketcham <cit.> and Hummel <cit.>, named the adaptive histogram equalization (AHE) <cit.>, addressed this issue by using the intensity histogram of a rectangular window, called the kernel, or the contextual region, around each pixel to estimate the intensity mapping. However, AHE comes with significant computational overhead because the kernel histograms around all pixels are calculated. In performance, the noise in regions with relatively uniform intensities tends to be overamplified. Pizer et al. proposed a version of AHE <cit.> with much less computational cost by using only the adjoining kernels that divide up the image for local histogram computation. The transformed intensities are then bilinearly interpolated to other pixels not centered on a kernel. Moreover, they introduced the histogram clip limit to constrain the intensity redistribution and suppress noise amplification <cit.>. The 3D extension of CLAHE was recently introduced by Amorim et al. <cit.> for processing medical images. Their algorithm uses volumetric kernels to compute the local histograms and trilinear interpolation to derive the voxelwise intensity mappings from nearest-neighbor kernels. Qualitative results were demonstrated on magnetic resonance imaging data, showing that the volumetric CLAHE leads to a better contrast than applying 2D CLAHE separately to every slice of the data.

Evaluating the outcome of contrast enhancement requires quantitative metrics of image contrast, which are rarely used in the early demonstrations of HE algorithms <cit.> because the use cases are predominantly in 2D and the improvements of image quality are largely intuitive. In domain-specific settings involving higher-dimensional (3D and above) imagery, intuition becomes less suitable for making judgments, but computational contrast metrics can provide guidance for evaluation in combination with user objectives. The commonly known contrast metrics include the mean squared error (MSE) or the related PSNR <cit.>, the standard deviation (also called the root-mean-square contrast) <cit.> and the Shannon entropy (also called the grey-level entropy) <cit.>. These metrics are naturally generalizable to imagery in arbitrary dimensions <cit.> and are easy to compute. We also note that despite the recently developed 2D image quality assessment scores based on the current understanding of human visual systems <cit.> proved to be more effective than the classic metrics we choose to quantify contrast, their generalization and relevance to the evaluation of higher-dimensional images obtained in natural sciences and engineering settings, often without undistorted references, are not yet explored, so they are not used here for comparison of results.



§ METHODS




 §.§ Overview

Extending CLAHE to arbitrary dimensions requires to address some of the existing limitations of the 2D (or 3D) version of the algorithm. (1) The formulations of 2D <cit.> and 3D CLAHE <cit.> involve explicit enumerated treatment of image boundaries, which becomes tedious and unscalable in arbitrary dimensions because the number of distinct boundaries scales exponentially as 3^D-1 with respect to the number of dimensions D. We resolve this issue by introducing data padding in MCLAHE as an initial step such that every D-dimensional pixel has a neighborhood of the same size in the augmented data (see Section III.B). The data padding also enables the choice of kernels with an arbitrary size smaller than the original data. (2) The formalism for calculating and interpolating the intensity mapping needs to be generalized to arbitrary dimensions. We present a unified formulation using the Lagrange form of multilinear interpolation <cit.> that includes the respective use of bilinear and trilinear interpolation in 2D <cit.> and 3D <cit.> versions of CLAHE as special cases in lower dimensions (see Section III.C). (3) To further suppress noise amplification in processing image data containing vastly different intensity features, we introduce adaptive histogram range (AHR), which extends the spatial adaptivity of the original CLAHE algorithm to the intensity domain. AHR allows the choice of local histogram range according to the intensity range of each kernel instead of using a global histogram range (GHR) (see Section III.D).



The MCLAHE algorithm is summarized graphically in Fig. <ref> and in pseudocode in Algorithm <ref>. It operates on input data of dimension D, where D is a positive integer. Let s_i be the size of data along the ith dimension, so i∈{0,...,D-1}. The algorithm begins with padding of the input data around the D-dimensional edges. The padded data are then kernelized, or divided into adjoining rectilinear kernels with dimension D and a size of b_i along the ith dimension defined by the user. Next, in each kernel, we separately compute and clip its intensity histogram and obtain the normalized CDF. The intensity mapping at each D-dimensional pixel is computed by multilinear interpolation of the transformed intensities among the normalized CDFs in the pixel's nearest-neighbor kernels. Finally, the contrast-enhanced output data are generated by applying the intensity transform to every pixel in the input data.





 §.§ Multidimensional padding



Because of the exponential scaling of the distinct boundaries as 3^D-1 with respect to the data dimensionality D, we use multidimensional padding to circumvent the enumerated treatment of boundaries and ensure that the data can be divided into integer multiples of the user-defined kernel size. The padding is composed of two parts. We discuss the case for D dimensions and illustrate with an example for D=2 in Fig. <ref>. Firstly, we require that the intensity histogram of each kernel is computed with the same number of D-dimensional pixels. Therefore, the size of the padded data should be an integer multiple of the kernel size. For each dimension, if s_i is not an integer multiple of b_i, a padding of  is needed. To absorb the case when , we add a shift of -1 to the expression. Therefore, the padding required along the ith dimension of the kernel to make the data size divisible by the kernel size is . Secondly, we require that every D-dimensional pixel in the original data has the same number of nearest-neighbor kernels such that the pixels at the border do not need a special treatment in the interpolation step. Therefore, we need to pad, in addition, by the kernel size, b_i, along the ith dimension. To satisfy both requirements, the total padding length along the ith dimension, p_i, is

    p_i = 2b_i - 1 - ((s_i - 1) b_i).

This length is split into two parts, p_i0 and p_i1, and attached to the start and end of each dimension, respectively.

    p_i0   = p_i // 2, 
    
            p_i1   = (p_i + 1) // 2.

Here, the // sign denotes integer division. To keep the local intensity distribution at the border of the image unchanged, the padding is implemented by mirroring the intensities along the boundaries of the data (symmetric padding). The padding procedure is described in lines 1–2 in Algorithm <ref>.





 §.§ Multidimensional interpolation



To derive a generic expression for the intensity mapping in arbitrary dimensions, we start with the example in 2D CLAHE, where each pixel intensity I_n (n being the pixel index) is transformed by a bilinear interpolation of the mapped intensities obtained from the normalized CDF of the nearest-neighbor kernels <cit.>. We introduce the kernel index 𝐢 = (i_0,i_1)∈{0,1}^2. The values of 0 and 1 in the binary alphabet {0,1} represent the two sides (i.e. above and below), respectively, in a dimension divided by the pixel in consideration. For the 2D case, the index (i_0, i_1) can take any value of (0, 0), (0, 1), (1, 0) and (1, 1), as shown in Fig. <ref>(b). Let m_𝐢 be the intensity mapping obtained from the kernel with the index 𝐢, then

    m_𝐢(I_n) = CDF_𝐢(I_n),

where CDF_𝐢 represents the normalized CDF obtained from the clipped histogram of the kernel with the index 𝐢. As shown in Fig. <ref>(b), the bilinear interpolations for the pixel in consideration located at the red square mark are computed using the four nearest-neighbor kernels centered on the blue square mark. The interpolation coefficients, c_𝐢, are represented as Lagrange polynomials <cit.> using the kernel size (b_0, b_1) and the distances (d_00, d_01, d_10, d_11) between the pixel and the kernel centers in the two dimensions.

    c_00   = (b_0 - d_00)(b_1 - d_10)/b_0 b_1,
        
    
        c_01   = (b_0 - d_00)(b_1 - d_11)/b_0 b_1,
        
    
        c_10   = (b_0 - d_01)(b_1 - d_10)/b_0 b_1,
        
    
        c_11   = (b_0 - d_01)(b_1 - d_11)/b_0 b_1.

The transformed intensity I_n from I_n is given by,

    I_n =    c_00m_00(I_n) + c_01m_01(I_n) + c_10m_10(I_n) 
       + c_11m_11(I_n).

Eq. (<ref>)-(<ref>) and (<ref>) can be rewritten in a compact form using the kernel index 𝐢 introduced earlier,

    I_n    = ∑_𝐢∈{0,1}^2c_𝐢m_𝐢(I_n),
    
        c_𝐢   = ∏_j=0^1b_j-d_j i_j/b_j.

In the 2D case, the term d_j i_j takes on the value d_j i_0 or d_j i_1. The choice of i_0 and i_1 from the binary alphabet {0,1} in d_j i_j follows that of the kernel index 𝐢. The special cases of transforming the border pixels in the image are naturally resolved in our case after data padding (see Section III.B).

In D dimensions, the kernel index 𝐢 = (i_0,i_1,...,i_D-1) ∈{0,1}^D. Analogous to the two-dimensional case described before, the intensity mapping of each D-dimensional pixel is now calculated by multilinear interpolation between the 2^D nearest-neighbor kernels in all dimensions, mathematically,

    I_n =    c_00...0m_00...0(I_n) + c_00...1m_00...1(I_n) 
       +...+c_11...0m_11...0(I_n) + c_11...1m_11...1(I_n).

Similarly, Eq. (<ref>) and the corresponding expressions for the interpolation coefficients can be written in a compact form using the kernel index 𝐢 as

    I_n    = ∑_𝐢∈{0,1}^Dc_𝐢m_𝐢(I_n),
    
        c_𝐢   = ∏_j=0^D-1b_j-d_j i_j/b_j.

The formalism introduced for the 2D case in Eq. (<ref>)-(<ref>) generalizes to arbitrary dimensions with only an update to the kernel index 𝐢. In Algorithm <ref>, the calculation of intensity mappings through interpolation is described in lines 12–15.



 §.§ Adaptive histogram range


In the original formulation of CLAHE in 2D <cit.>, the local histogram ranges for all kernels are the same, which works well when the kernels contain intensities in a similarly wide range. Tuning of the trade-off between noise amplification and the signal enhancement is then achieved through selection of the kernel size and the clip limit <cit.>. However, if different patches of the image data contain local features within vastly different but narrow intensity ranges, they may accumulate in very few histogram bins with values specified globally. Accounting for the disparity in CLAHE will require a high clip limit to enhance and therefore comes with the price of noise amplification in many parts of the data. This problem may be ameliorated by adaptively choosing the local histogram range to lie within the minimum and maximum of the intensity values of the kernel, while keeping the number of bins the same for all kernels. An example use case of the AHR is presented in Section IV.A.



§ APPLICATIONS

We now apply the MCLAHE algorithm to two cases in the natural sciences that involve large densely sampled 4D (3D+time) data. Each example includes a brief introduction of the background knowledge on the type of measurement, the resulting image data features and the motivation for the use of contrast enhancement, followed by discussion and comparison of the outcome using MCLAHE. The performance details are provided at the end of each example.



 §.§ Photoemission spectroscopy


Background information. In photoemission spectroscopy, the detector registers electrons liberated by intense vacuum UV or X-ray pulses from a solid state material sample <cit.>. The measurement is carried out in the so-called 3D momentum space, spanned by the coordinates (k_x, k_y, E), in which k_x, k_y are the electron momenta and E the energy. The detected electrons form patterns carrying information about the anisotropic electronic density distribution within the material. The fourth dimension in time-resolved photoemission spectroscopy represent the waiting time in observation by photoemission since the electronic system is subject to an external perturbation (i.e. light excitation). The negative time frames represent the observations taking place before the light excitation. In the image data acquired in photoemission spectroscopy, the inhomogeneous intensity modulation from the experimental geometry, light-matter interaction <cit.> and scattering background creates contrast variations within and between the so-called energy bands, which manifest themselves as intercrossing curves (in 2D) or surfaces (in 3D) blurred by convolution with the instrument response function and further affected by other factors such as the sample quality and the dimensionality of the electronic system, etc <cit.>. Visualization and demarcation of the band-like image features are of great importance for understanding the momentum-space electronic distribution and dynamics in multidimensional photoemission spectroscopy <cit.>. However, in addition to the physical limitations on the contrast inhomogeneities listed before, the intensity difference between the lower bands (or valence bands) and the upper bands (or conduction bands) on the energy scale is on the order of 100 or higher and varies by the materials under study and light excitation conditions. To improve the image contrast in multiple dimensions, we applied MCLAHE to a 4D (3D+time) dataset measured for the time- and momentum-resolved electronic dynamics of tungsten diselenide (WSe_2), a semiconducting material with highly dispersing electronic bands <cit.>. The 4D data were obtained from an existing experimental setup <cit.> and processed using a custom pipeline <cit.> from detected single photoelectron events. For comparison of contrast enhancement, we applied both 3D and 4D CLAHE to the 4D photoemission spectroscopy data. In the case of 3D CLAHE, the algorithm was applied to the 3D data at each time frame separately.


Results and discussion. Stills from the raw data and the results are compared in Fig. <ref>, along with the contrast metrics computed and listed in Table <ref>. The supplementary files include videos 1-3 and video 4 for comparing unprocessed and processed data rendered in 2D slices and in 3D, respectively. As shown in Fig. <ref>(a)-(d), the original photoemission spectroscopy data are visualized poorly on an energy scale covering both the valence (lower) and conduction (upper) bands. The situation is much improved in the MCLAHE-processed data with AHR setting shown in Fig. <ref>(e)-(l), where the population dynamics in the conduction band of WSe_2 <cit.> and the broadening of the valence bands are sufficiently visible to be placed on the same colorscale, allowing to identify and correlate fine features of the momentum-space dynamics. The improvement in contrast is also reflected quantitatively in Table <ref> in the drastic changes in standard deviation <cit.> between the unadjusted (smoothed) and processed data. On the other hand, the GHR setting of MCLAHE cannot visualize the upper bands well (see comparisons in supplementary videos 1-3) because the regions in the lower and upper bands contain drastically different intensity features. Next, we compare performance between 3D and 4D CLAHE under the AHR setting. The decrease in MSE (0.1121 → 0.1050) or, equivalently, the increase in PSNR (147.98 → 148.26) shown in Table <ref> indicates that 4D CLAHE is more suited here because a smaller MSE implies closer resemblance to the original data <cit.>. Furthermore, visual inspection of the results in Fig. <ref>(e)-(l) and in supplementary videos 1-4 finds less severe noise enhancement when applying 4D CLAHE to the whole dataset than 3D CLAHE to each time frame.


To quantify the influence of contrast enhancement on the dynamical features in the data, we calculated the integrated intensity in the conduction band of the data in all three cases and the results are summarized in Fig. <ref>(m)-(o). The standard score in Fig. <ref>(o) is used to compare the integrated signals in a scale-independent fashion. The dynamics represented in the intensity changes are better preserved in 4D than 3D CLAHE-treated data and the former are less influenced by the boundary artifacts in the beginning and at the end of the time delay range. The artefactual delays created by 3D CLAHE in the onset and recovery of changes, around t_1 and t_3 in Fig. <ref>(o), respectively, are shown even clearer in the supplementary videos 1-4. These observations reinforce the argument that 4D CLAHE is superior to its 3D counterpart overall in content-preserving contrast enhancement.

Processing details. The raw 4D photoemission spectroscopy data have a size of 180×180×300×80 in the (k_x, k_y, E, t) dimensions. They were first denoised using a Gaussian filter with standard deviations of 0.7, 0.9 and 1.3 along the momenta, energy and time dimensions, respectively. In the applications of both 3D and 4D CLAHE, we set a clip limit of 0.02 and assigned 256 grey-level bins to the local histograms. The kernel size for 4D CLAHE was (30, 30, 15, 20) and for 3D CLAHE the same kernel size for the first three dimensions, or (k_x, k_y, E), was used. Both GHR and AHR settings were tested for comparison. The processing ran on a server with 64 Intel Xeon CPUs at 2.3 GHz and 254GB RAM. The total runtime, including memory copy operations, for processing the whole dataset with 4D CLAHE was about 5.3 mins. In addition, we benchmarked the performance of 4D CLAHE on the GPU (NVIDIA GeForce GTX 1070, 8GB RAM) of the server using the first 25 time frames of the dataset. The total runtime was 34 s with the GPU versus 104 s without the GPU, representing a 3.1-fold speed-up.



 §.§ Fluorescence microscopy

Background information. In 4D fluorescence microscopy, the measurements are carried out in the Cartesian coordinates of the laboratory frame, or (x, y, z), with the fourth dimension representing the observation time t since fertilization. In practice, the photophysics of the fluorophores <cit.>, the autofluorescence background <cit.> from the labeled and unlabeled parts of the sample and the detection method, such as the attenuation effect from scanning measurements at different depths or nonuniform illumination of fluorophores <cit.>, pose limits on the achievable image contrast in the experiment. The image features in fluorescence microscopy data often include sparsely labeled cells and cellular components such as the nuclei, membranes, dendritic structures, and other organelles. The limited contrast may render the downstream data annotation tasks, such as segmentation, tracking and lineage tracing <cit.>, challenging. Therefore, a digital contrast enhancement method is potentially useful to improve the visibility of the cells and their corresponding dynamics. We demonstrate the use of MCLAHE for this purpose on a publicly available 4D (3D+time) fluorescence microscopy dataset <cit.> of the embryo development of ascidian (Phallusia mammillata), or sea squirt. The organism is stained and imaged in toto to reveal its development from a gastrula to tailbud formation with cellular resolution <cit.>. During embryo development, the fluorescence contrast exhibits time dependence due to cellular processes such as division and differentiation. We use the data from one fluorescence label channel containing the nuclei and process through the MCLAHE pipeline.


Results and discussion. The results are compared with the original data on the same colorscale in Fig. <ref> and the corresponding contrast metrics are shown in Table <ref>. The supplementary files include video 5 and video 6 for comparing the unprocessed and processed data in a 2D slice and in 3D, respectively. As shown in Fig. <ref>(a)-(d), the intensities in the raw fluorescence microscopy data are distributed very unevenly in the colorscale. The MCLAHE-processed 4D time series show significant improvement in the visibility of the cells against the background signal (e.g. autofluorescence, detector dark counts, etc). This is reflected in the surge in contrast represented by standard deviation as shown in Table <ref>. In contrast to the previous example, the AHR option in MCLAHE was not used in processing the embryo development dataset because the cellular feature sizes and their fluorescence intensities are similar throughout the organism. Additionally, the dynamic range of the data is limited (see the following Processing details) and the changes in fluorescence during development are relatively small. The initial high Shannon entropy of the raw data in Table <ref> is due to its high background noise, which is reduced after smoothing, as indicated by the sharp drop in the entropy while the standard deviation shows relative consistency. Then, the use of MCLAHE increases the entropy again, together with the large changes in other metrics, this time due to the contrast enhancement. Similarly to the previous example, the 4D CLAHE outperforms its 3D counterpart overall because of the lower MSE or, equivalently, the higher PSNR of the 4D results, indicating a higher similarity to the raw data. In other contrast metrics such as the standard deviation and the Shannon entropy, the 4D and 3D results have very close values, indicating the complexity of judging image contrast by a single metric. Visualization of the dynamics in Fig. <ref>(e)-(l) also shows that the 4D CLAHE-processed data preserve more of the fluorescence intensity change than its 3D counterpart, while maintaining a high cell-to-background contrast. More complete comparisons of unprocessed and processed data are presented in the supplementary videos 5-6. The contrast-enhanced embryo development data potentially allow better tracking of cellular lineage and dynamics <cit.>, which are challenging due to sparse fluorescent labeling.


Processing details. The raw 4D fluorescence microscopy data have a size of 512×512×109×144 in the (x, y, z, t) dimensions. They were first denoised by a median filter with a kernel size of (2, 2, 2, 1). In the application of 4D CLAHE, the kernel size of choice was (20, 20, 10, 25) and the same kernel size in the first three dimensions were used for 3D CLAHE to enable direct comparison. For both MCLAHE procedures, the clip limit was set at 0.25 and the number of histogram bins at 256. The intensities in the raw data were given as 8 bit unsigned integers resulting in only 256 possible values. Hence, only the GHR setting was used because the AHR setting would result in bins smaller than the resolution of the data. Processing with MCLAHE ran on the same server as for the photoemission spectroscopy data (see Section IV.A). The total runtime for processing the whole dataset using only CPUs was about 26 mins. Similar to the photoemission case study, the speed-up by GPU usage was tracked. The total runtime for processing the first 8 time frames of the dataset was 32 s on the GPU versus 85 s only on CPUs, representing a 2.7-fold speed-up.



§ PERSPECTIVES

While we have presented the applications of the MCLAHE algorithm to real-world datasets of up to multiple gigabytes in size, its current major performance limitation is in the memory usage, since the data needs to be loaded entirely into the RAM (of CPUs or GPUs), which may be challenging for very large imaging and spectroscopy datasets on the multi-terabyte scale that are becoming widely available <cit.>. Future improvements on the algorithm implementation may include distributed handling of chunked datasets to enable operation on limited hardware resource by loading each time only a subset of the data. In addition, the number of nearest-neighbor kernels currently required for intensity mapping interpolation increases exponentially with the dimensionality D of the data (see Section III.C). For datasets with D < 10, this may not pose an outstanding issue, but for even higher-dimensional datasets, new strategies may be developed for approximate interpolation of selected neighboring kernels to alleviate the exponential scaling.

On the other hand, the applications of MCLAHE are not limited by the examples given in this work but are open to other types of data. It is especially beneficial to the preprocessing of high dimensional data with dense sampling produced by various fast volumetric spectroscopic and imaging techniques <cit.> for improving the performance of feature annotation and extraction tasks.

Furthermore, the call for extension of the image processing toolkits in 2D and 3D to higher-dimensional imaging datasets also motivates the dimensional extension of more recent CE procedures, such as those in <cit.>, which will provide a wider choice of algorithms for multidimensional image processing and comprehensive comparison of the algorithm performance on data with various characteristics.



§ CONCLUSION

We present a flexible and efficient generalization of the CLAHE algorithm to arbitrary dimensions for contrast enhancement of complex multidimensional imaging and spectroscopy datasets. Our algorithm, the multidimensional CLAHE, improves upon previous lower-dimensional equivalents <cit.> by its unified treatment of image boundaries, flexible kernels size selection, adaptive histogram range determination. Its parallelized implementation in Tensorflow allows computational acceleration with multiple CPUs and GPUs. We demonstrate the effectiveness of multidimensional CLAHE by visual analysis and contrast quantification in case studies drawn from different measurement techniques, namely, 4D (3D+time) photoemission spectroscopy and 4D fluorescence microscopy, with the capabilities of producing densely sampled high dimensional data. In the example applications, our algorithm greatly improves and balances the visibility of multidimensional image features in diverse intensity ranges and neighborhood conditions. We further show that the best overall performance in each case comes from the simultaneous application of multidimensional CLAHE to all data dimensions, in line with the observation for applying CLAHE to 3D data <cit.>. In addition, we provide the implementation of multidimensional CLAHE in an open-source codebase to assist its reuse and integration into existing image analysis pipelines in various domains of natural sciences and engineering.



§ ACKNOWLEDGMENTS

We thank S. Schülke, G. Schnapka at the GNZ (Gemeinsames Netzwerkzentrum) in Berlin and M. Rampp at the MPCDF (Max Planck Computing and Data Facility) in Garching for computing supports. We thank S. Dong and S. Beaulieu for performing the photoemission spectroscopy measurement on a tungsten diselenide sample at the Fritz Haber Institute. V. Stimper thanks U. Gerland for administrative support. The work has received funding from the Max Planck Society, including BiGmax, the Max Planck Society's Research Network on Big-Data-Driven Materials Science, and funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (Grant Agreement No. ERC-2015-CoG-682843).




10

url@samestyle








Olshausen2000
B. Olshausen and D. Field, “Vision and the coding of natural images,”
  American Scientist, vol. 88, no. 3, p. 238, 2000. [Online]. Available:
  <http://www.americanscientist.org/issues/feature/2000/3/vision-and-the-coding-of-natural-images>


Pratt2007
W. K. Pratt, Digital Image Processing, 4th ed.1em plus 0.5em
  minus 0.4emWiley-Interscience, 2007.

Hall1974
E. L. Hall, “Almost uniform distributions for computer image enhancement,”
  IEEE Transactions on Computers, vol. C-23, no. 2, pp. 207–208, Feb
  1974.

Pizer1987
S. M. Pizer, E. P. Amburn, J. D. Austin, R. Cromartie, A. Geselowitz, T. Greer,
  B. ter Haar Romeny, J. B. Zimmerman, and K. Zuiderveld, “Adaptive histogram
  equalization and its variations,” Computer Vision, Graphics, and Image
  Processing, vol. 39, no. 3, pp. 355–368, 1987. [Online]. Available:
  <http://www.sciencedirect.com/science/article/pii/S0734189X8780186X>


Zuiderveld1994
K. Zuiderveld, “Contrast limited adaptive histogram equalization,” in
  Graphics Gems.1em plus 0.5em minus 0.4emElsevier, 1994,
  pp. 474–485. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/B9780123361561500616>


Hitam2013
M. S. Hitam, W. N. J. H. W. Yussof, E. A. Awalludin, and Z. Bachok, “Mixture
  contrast limited adaptive histogram equalization for underwater image
  enhancement,” in 2013 International Conference on Computer
  Applications Technology (ICCAT).1em plus 0.5em minus 0.4emIEEE, jan 2013, pp. 1–5. [Online]. Available:
  <http://ieeexplore.ieee.org/document/6522017/>


Pisano1998
E. D. Pisano, S. Zong, B. M. Hemminger, M. DeLuca, R. E. Johnston, K. Muller,
  M. P. Braeuning, and S. M. Pizer, “Contrast limited adaptive histogram
  equalization image processing to improve the detection of simulated
  spiculations in dense mammograms,” Journal of Digital Imaging,
  vol. 11, no. 4, p. 193, Nov 1998. [Online]. Available:
  <https://doi.org/10.1007/BF03178082>


Dabass2019
J. Dabass, S. Arora, R. Vig, and M. Hanmandlu, “Mammogram Image Enhancement
  Using Entropy and CLAHE Based Intuitionistic Fuzzy Method,” in 2019
  6th International Conference on Signal Processing and Integrated Networks
  (SPIN).1em plus 0.5em minus 0.4emIEEE, mar 2019, pp. 24–29.
  [Online]. Available: <https://ieeexplore.ieee.org/document/8711696/>


Yildiz2019
M. Z. Yildiz, O. F. Boyraz, E. Guleryuz, A. Akgul, and I. Hussain, “A Novel
  Encryption Method for Dorsal Hand Vein Images on a Microcomputer,”
  IEEE Access, vol. 7, pp. 60 850–60 867, 2019. [Online]. Available:
  <https://ieeexplore.ieee.org/document/8705292/>


Xiao2019
J. Xiao, S. Li, and Q. Xu, “Video-Based Evidence Analysis and Extraction in
  Digital Forensic Investigation,” IEEE Access, vol. 7, pp.
  55 432–55 442, 2019. [Online]. Available:
  <https://ieeexplore.ieee.org/document/8700194/>


Sim2010
K. Sim, Y. Tan, M. Lai, C. Tso, and W. Lim, “Reducing scanning electron
  microscope charging by using exponential contrast stretching technique on
  post-processing images,” Journal of Microscopy, vol. 238, no. 1, pp.
  44–56, apr 2010. [Online]. Available:
  <http://doi.wiley.com/10.1111/j.1365-2818.2009.03328.x>


McCollum2007
A. McCollum and W. Clocksin, “Multidimensional histogram equalization and
  modification,” in 14th International Conference on Image Analysis and
  Processing (ICIAP 2007).1em plus 0.5em minus 0.4emIEEE, sep
  2007, pp. 659–664. [Online]. Available:
  <http://ieeexplore.ieee.org/document/4362852/>


Ouyang2017
W. Ouyang and C. Zimmer, “The imaging tsunami: Computational opportunities
  and challenges,” Current Opinion in Systems Biology, vol. 4, pp.
  105–113, aug 2017. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/S2452310017300537>


Pantazis2014
P. Pantazis and W. Supatto, “Advances in whole-embryo imaging: a quantitative
  transition is underway,” Nature Reviews Molecular Cell Biology,
  vol. 15, no. 5, pp. 327–339, may 2014. [Online]. Available:
  <http://www.nature.com/articles/nrm3786>


Gao2016
L. Gao and L. V. Wang, “A review of snapshot multidimensional optical
  imaging: Measuring photon tags in parallel,” Physics Reports, vol.
  616, pp. 1–37, feb 2016. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/S0370157315005025>


Ersen2015
O. Ersen, I. Florea, C. Hirlimann, and C. Pham-Huu, “Exploring nanomaterials
  with 3D electron microscopy,” Materials Today, vol. 18, no. 7, pp.
  395–408, sep 2015. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/S1369702115001200>


Schonhense2015
G. Schönhense, K. Medjanik, and H.-J. Elmers, “Space-, time- and
  spin-resolved photoemission,” Journal of Electron Spectroscopy and
  Related Phenomena, vol. 200, pp. 94–118, apr 2015. [Online]. Available:
  <http://linkinghub.elsevier.com/retrieve/pii/S0368204815001243>


Moore2009
J. H. Moore, C. C. Davis, M. A. Coplan, and S. C. Greer, Building
  Scientific Apparatus, 4th ed.1em plus 0.5em minus 0.4emCambridge University Press, 2009.

Amorim2018
P. Amorim, T. Moraes, J. Silva, and H. Pedrini, “3D Adaptive Histogram
  Equalization Method for Medical Volumes,” in Proceedings of the 13th
  International Joint Conference on Computer Vision, Imaging and Computer
  Graphics Theory and Applications, 2018, pp. 363–370. [Online]. Available:
  <http://www.scitepress.org/DigitalLibrary/Link.aspx?doi=10.5220/0006615303630370>


Hufner2003
S. Hüfner, Photoelectron Spectroscopy : Principles and Applications,
  3rd ed.1em plus 0.5em minus 0.4emSpringer, 2003.

Kubitscheck2017
U. Kubitscheck, Ed., Fluorescence Microscopy: From Principles to
  Biological Applications, 2nd ed.1em plus 0.5em minus 0.4emWeinheim, Germany: Wiley-VCH Verlag GmbH & Co. KGaA, may 2017. [Online].
  Available: <http://doi.wiley.com/10.1002/9783527687732>


Faure2016
E. Faure, T. Savy, B. Rizzi, C. Melani, O. Stašová,
  D. Fabrèges, R. Špir, M. Hammons, R. Čúnderlík,
  G. Recher, B. Lombardot, L. Duloquin, I. Colin, J. Kollár,
  S. Desnoulez, P. Affaticati, B. Maury, A. Boyreau, J.-Y. Nief, P. Calvat,
  P. Vernier, M. Frain, G. Lutfalla, Y. Kergosien, P. Suret,
  M. Remešíková, R. Doursat, A. Sarti, K. Mikula,
  N. Peyriéras, and P. Bourgine, “A workflow to process 3D+time
  microscopy images of developing organisms and reconstruct their cell
  lineage,” Nature Communications, vol. 7, no. 1, p. 8674, apr 2016.
  [Online]. Available: <http://www.nature.com/articles/ncomms9674>


tensorflow2015
M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado,
  A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving,
  M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg,
  D. Mané, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens,
  B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan,
  F. Viégas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and
  X. Zheng, “TensorFlow: Large-scale machine learning on heterogeneous
  systems,” 2015, software available from tensorflow.org. [Online]. Available:
  <http://tensorflow.org/>


Stimper2019
V. Stimper and R. P. Xian, “Multidimensional contrast limited adaptive
  histogram equalization,” <https://github.com/VincentStimper/mclahe>,
  2019.

Sinha2012
P. K. Sinha, Image Acquisition and Preprocessing for Machine Vision
  Systems.1em plus 0.5em minus 0.4emSPIE press, 2012.

Ketcham1976
D. J. Ketcham, “Real-time image enhancement techniques,” in Seminar on
  Image Processing, vol. 0074, 1976, pp. 1–6. [Online]. Available:
  <https://doi.org/10.1117/12.954708>


Hummel1977
R. Hummel, “Image enhancement by histogram transformation,” Computer
  Graphics and Image Processing, vol. 6, no. 2, pp. 184 – 195, 1977.
  [Online]. Available:
  <http://www.sciencedirect.com/science/article/pii/S0146664X77800117>


Dale-Jones1993
R. Dale-Jones and T. Tjahjadi, “A study and modification of the local
  histogram equalization algorithm,” Pattern Recognition, vol. 26,
  no. 9, pp. 1373–1381, sep 1993. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/003132039390143K>


Stark2000
J. Stark, “Adaptive image contrast enhancement using generalizations of
  histogram equalization,” IEEE Transactions on Image Processing,
  vol. 9, no. 5, pp. 889–896, may 2000. [Online]. Available:
  <http://ieeexplore.ieee.org/document/841534/>


Wang2004
Z. Wang, A. Bovik, H. Sheikh, and E. Simoncelli, “Image quality assessment:
  From error visibility to structural similarity,” IEEE Transactions on
  Image Processing, vol. 13, no. 4, pp. 600–612, apr 2004. [Online].
  Available: <http://ieeexplore.ieee.org/document/1284395/>


Campos2019
G. F. C. Campos, S. M. Mastelini, G. J. Aguiar, R. G. Mantovani, L. F. de Melo,
  and S. Barbon, “Machine learning hyperparameter selection for contrast
  limited adaptive histogram Equalization,” EURASIP Journal on Image
  and Video Processing, vol. 2019, no. 1, p. 59, dec 2019. [Online].
  Available:
  <https://jivp-eurasipjournals.springeropen.com/articles/10.1186/s13640-019-0445-4>


Peli1990
E. Peli, “Contrast in complex images,” Journal of the Optical Society
  of America A, vol. 7, no. 10, p. 2032, oct 1990. [Online]. Available:
  <https://www.osapublishing.org/abstract.cfm?URI=josaa-7-10-2032>


Gu2016
K. Gu, G. Zhai, W. Lin, and M. Liu, “The analysis of image contrast: From
  quality assessment to automatic enhancement,” IEEE Transactions on
  Cybernetics, vol. 46, no. 1, pp. 284–297, jan 2016. [Online]. Available:
  <http://ieeexplore.ieee.org/document/7056527/>


Kriete1994
A. Kriete, “Image quality considerations in computerized 2-D and 3-D
  microscopy,” in Multidimensional Microscopy.1em plus 0.5em
  minus 0.4emNew York, NY: Springer New York, 1994, pp. 209–230.
  [Online]. Available:
  <http://link.springer.com/10.1007/978-1-4613-8366-6_12>


Phillips2003
G. M. Phillips, Interpolation and Approximation by Polynomials, ser.
  CMS Books in Mathematics.1em plus 0.5em minus 0.4emNew York,
  NY: Springer New York, 2003. [Online]. Available:
  <http://link.springer.com/10.1007/b97417>


Kreyszig2011
E. Kreyszig, H. Kreyszig, and E. J. Norminton, Advanced Engineering
  Mathematics, 10th ed.1em plus 0.5em minus 0.4emWiley, 2011.

Moser2017
S. Moser, “An experimentalist's guide to the matrix element in angle resolved
  photoemission,” Journal of Electron Spectroscopy and Related
  Phenomena, vol. 214, pp. 29–52, jan 2017. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/S0368204816301724>


Riley2014
J. M. Riley, F. Mazzola, M. Dendzik, M. Michiardi, T. Takayama, L. Bawden,
  C. Granerød, M. Leandersson, T. Balasubramanian, M. Hoesch, T. K. Kim,
  H. Takagi, W. Meevasana, P. Hofmann, M. S. Bahramy, J. W. Wells, and P. D. C.
  King, “Direct observation of spin-polarized bulk bands in an
  inversion-symmetric semiconductor,” Nature Physics, vol. 10, no. 11,
  pp. 835–839, nov 2014. [Online]. Available:
  <http://www.nature.com/articles/nphys3105>


Puppin2018
M. Puppin, Y. Deng, C. W. Nicholson, J. Feldl, N. B. M. Schröter,
  H. Vita, P. S. Kirchmann, C. Monney, L. Rettig, M. Wolf, and R. Ernstorfer,
  “Time- and angle-resolved photoemission spectroscopy of solids in the
  extreme ultraviolet at 500 kHz repetition rate,” Review of Scientific
  Instruments, vol. 90, no. 2, p. 023104, feb 2019. [Online]. Available:
  <http://aip.scitation.org/doi/10.1063/1.5081938>


Xian2019a
R. P. Xian, L. Rettig, and R. Ernstorfer, “Symmetry-guided nonrigid
  registration: The case for distortion correction in multidimensional
  photoemission spectroscopy,” Ultramicroscopy, vol. 202, pp.
  133–139, jul 2019. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/S0304399118303474>


Xian2019b
R. P. Xian, Y. Acremann, S. Y. Agustsson, M. Dendzik, K. Bühlmann,
  D. Curcio, D. Kutnyakhov, F. Pressacco, M. Heber, S. Dong, J. Demsar,
  W. Wurth, P. Hofmann, M. Wolf, L. Rettig, and R. Ernstorfer, “An
  open-source, distributed workflow for band mapping data in multidimensional
  photoemission spectroscopy,” sep 2019. [Online]. Available:
  <http://arxiv.org/abs/1909.07714>


Bertoni2016
R. Bertoni, C. W. Nicholson, L. Waldecker, H. Hübener, C. Monney, U. De
  Giovannini, M. Puppin, M. Hoesch, E. Springate, R. T. Chapman, C. Cacho,
  M. Wolf, A. Rubio, and R. Ernstorfer, “Generation and evolution of spin-,
  valley-, and layer-polarized excited carriers in inversion-symmetric
  WSe_2,” Physical Review Letters, vol. 117, no. 27, p. 277201, dec
  2016. [Online]. Available:
  <https://link.aps.org/doi/10.1103/PhysRevLett.117.277201>


Puppin2017
M. Puppin, “Time- and angle-resolved photoemission spectroscopy on
  bidimensional semiconductors with a 500 kHz extreme ultraviolet light
  source,” Ph.D. dissertation, Free University of Berlin, sep 2017. [Online].
  Available: <https://refubium.fu-berlin.de/handle/fub188/23006?show=full>


Valeur2013
B. Valeur and M. N. Berberan-Santos, Molecular Fluorescence: Principles
  and Applications, 2nd ed.1em plus 0.5em minus 0.4emWiley-VCH,
  2013. [Online]. Available:
  <https://www.wiley.com/en-us/Molecular+Fluorescence%3A+Principles+and+Applications%2C+2nd+Edition-p-9783527328376>


Waters2009
J. C. Waters, “Accuracy and precision in quantitative fluorescence
  microscopy,” The Journal of Cell Biology, vol. 185, no. 7, pp.
  1135–1148, jun 2009. [Online]. Available:
  <http://www.jcb.org/lookup/doi/10.1083/jcb.200903097>


Nketia2017
T. A. Nketia, H. Sailem, G. Rohde, R. Machiraju, and J. Rittscher, “Analysis
  of live cell images: Methods, tools and opportunities,” Methods,
  vol. 115, pp. 65–79, feb 2017. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/S104620231730083X>


Kretzschmar2012
K. Kretzschmar and F. M. Watt, “Lineage tracing,” Cell, vol. 148,
  no. 1-2, pp. 33–45, jan 2012. [Online]. Available:
  <https://linkinghub.elsevier.com/retrieve/pii/S0092867412000037>


Amat2014
F. Amat, W. Lemon, D. P. Mossing, K. McDole, Y. Wan, K. Branson, E. W. Myers,
  and P. J. Keller, “Fast, accurate reconstruction of cell lineages from
  large-scale fluorescence microscopy data,” Nature Methods, vol. 11,
  no. 9, pp. 951–958, sep 2014. [Online]. Available:
  <http://www.nature.com/articles/nmeth.3036>


Flannigan2012
D. J. Flannigan and A. H. Zewail, “4D electron microscopy: principles and
  applications,” Accounts of Chemical Research, vol. 45, no. 10, pp.
  1828–1839, oct 2012. [Online]. Available:
  <http://pubs.acs.org/doi/10.1021/ar3001684>


Lu2014
G. Lu and B. Fei, “Medical hyperspectral imaging: a review,” Journal
  of Biomedical Optics, vol. 19, no. 1, p. 010901, jan 2014. [Online].
  Available:
  <http://biomedicaloptics.spiedigitallibrary.org/article.aspx?doi=10.1117/1.JBO.19.1.010901>


Jahr2015
W. Jahr, B. Schmid, C. Schmied, F. O. Fahrbach, and J. Huisken,
  “Hyperspectral light sheet microscopy,” Nature Communications,
  vol. 6, no. 1, p. 7990, nov 2015. [Online]. Available:
  <http://www.nature.com/articles/ncomms8990>


Ozbek2018
A. Özbek, X. L. Deán-Ben, and D. Razansky, “Optoacoustic imaging
  at kilohertz volumetric frame rates,” Optica, vol. 5, no. 7, p. 857,
  jul 2018. [Online]. Available:
  <https://www.osapublishing.org/abstract.cfm?URI=optica-5-7-857>


Miller2014
M. K. Miller and R. G. Forbes, Atom-Probe Tomography.1em plus
  0.5em minus 0.4emBoston, MA: Springer US, 2014. [Online]. Available:
  <http://link.springer.com/10.1007/978-1-4899-7430-3>


Mehrish2019
A. Mehrish, A. V. Subramanyam, and S. Emmanuel, “Joint Spatial and Discrete
  Cosine Transform Domain-Based Counter Forensics for Adaptive Contrast
  Enhancement,” IEEE Access, vol. 7, pp. 27 183–27 195, 2019.
  [Online]. Available: <https://ieeexplore.ieee.org/document/8658078/>


Tan2019
S. F. Tan and N. A. M. Isa, “Exposure Based Multi-Histogram Equalization
  Contrast Enhancement for Non-Uniform Illumination Images,” IEEE
  Access, vol. 7, pp. 70 842–70 861, 2019. [Online]. Available:
  <https://ieeexplore.ieee.org/document/8721128/>




