원시데이터 수집 시스템
선정목록으로

A Fast Method for the Segmentation of Synaptic Junctions and Mitochondria in Serial Electron Microscopic Images of the Brain

관련 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)

기본 정보

저자
  1. Pablo Márquez Neila — Departamento de Inteligencia Artificial, Universidad Politécnica de Madrid, 28660, Boadilla del Monte, Madrid, Spain
  2. Luis Baumela — Departamento de Inteligencia Artificial, Universidad Politécnica de Madrid, 28660, Boadilla del Monte, Madrid, Spain
  3. Juncal González‐Soriano — Departamento de Anatomía. Facultad de Veterinaria, Universidad Complutense, Madrid, Spain
  4. José-Rodrigo Rodrı́guez — Laboratorio Cajal de Circuitos Corticales, Centro de Tecnología Biomédica, Universidad Politécnica de Madrid and Instituto Cajal, CSIC, Madrid, Spain
  5. Javier DeFelipe — Laboratorio Cajal de Circuitos Corticales, Centro de Tecnología Biomédica, Universidad Politécnica de Madrid and Instituto Cajal, CSIC, Madrid, Spain
  6. Ángel Merchán-Pérez — Laboratorio Cajal de Circuitos Corticales, Centro de Tecnología Biomédica, Universidad Politécnica de Madrid and Instituto Cajal, CSIC, Madrid, Spain
DOI
10.1007/s12021-015-9288-z
저널
Neuroinformatics
발행년도
2016
발행기관
Springer Science+Business Media
피인용수
24
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1007/s12021-015-9288-z
토픽
Electron and X-Ray Spectroscopy Techniques
OpenAlex ID
W2300384250

평가 내용

관련도
관련
사업분야
수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '수소연료전지 > 연료전지용 수분제어장치(가습기)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Recent electron microscopy (EM) imaging techniques permit the automatic acquisition of a large number of serial sections from brain samples. Manual segmentation of these images is tedious, time-consuming and requires a high degree of user expertise. Therefore, there is considerable interest in developing automatic segmentation methods. However, currently available methods are computationally demanding in terms of computer time and memory usage, and to work properly many of them require image stacks to be isotropic, that is, voxels must have the same size in the X, Y and Z axes. We present a method that works with anisotropic voxels and that is computationally efficient allowing the segmentation of large image stacks. Our approach involves anisotropy-aware regularization via conditional random field inference and surface smoothing techniques to improve the segmentation and visualization. We have focused on the segmentation of mitochondria and synaptic junctions in EM stacks from the cerebral cortex, and have compared the results to those obtained by other methods. Our method is faster than other methods with similar segmentation results. Our image regularization procedure introduces high-level knowledge about the structure of labels. We have also reduced memory requirements with the introduction of energy optimization in overlapping partitions, which permits the regularization of very large image stacks. Finally, the surface smoothing step improves the appearance of three-dimensional renderings of the segmented volumes.

본문 62,001자

본문 펼치기
( ) DOI 10.1007/s12021-015-9288-z ~~ORIGINAL~~ ~~ARTICLE~~ # A Fast Method for the Segmentation of Synaptic Junctions and Mitochondria in Serial Electron Microscopic Images of the Brain Pablo M´arquez Neila <sup>1</sup> · Luis Baumela <sup>1</sup> · Juncal Gonz´alez-Soriano <sup>2</sup> · Jose-Rodrigo Rodr´ıguez <sup>3</sup> · Javier DeFelipe <sup>3</sup> · Angel Merch´an-P´erez <sup>´</sup> <sup>3,4</sup> Published online: 16 January 2016 © The Author(s) 2016. This article is published with open access at Springerlink.com Abstract Recent electron microscopy (EM) imaging techniques permit the automatic acquisition of a large number of serial sections from brain samples. Manual segmentation of these images is tedious, time-consuming and requires a high degree of user expertise. Therefore, there is considerable interest in developing automatic segmentation methods. However, currently available methods are computationally demanding in terms of computer time and memory usage, and to work properly many of them require image stacks to be isotropic, that is, voxels must have the same size in the X, Y and Z axes. We present a method that works with anisotropic voxels and that is computationally efficient allowing the segmentation of large image stacks. Our approach involves anisotropy-aware regularization via conditional random field inference and surface smoothing Electronic supplementary material The online version of this article [(doi:10.1007/s12021-015-9288-z)](http://dx.doi.org/10.1007/s12021-015-9288-z) contains supplementary material, which is available to authorized users. - ´Angel Merch´an-P´erez [amerchan@fi.upm.es](mailto:amerchan@fi.upm.es) 1 Departamento de Inteligencia Artificial, Universidad Polit´ecnica de Madrid, 28660, Boadilla del Monte, Madrid, Spain 2 Departamento de Anatom´ıa. Facultad de Veterinaria, Universidad Complutense, Madrid, Spain 3 Laboratorio Cajal de Circuitos Corticales, Centro de Tecnolog´ıa Biom´edica, Universidad Polit´ecnica de Madrid and Instituto Cajal, CSIC, Madrid, Spain 4 Departamento de Arquitectura y Tecnolog´ıa de Sistemas Inform´aticos, Facultad de Inform´atica, Universidad Polit´ecnica de Madrid, Madrid, Spain techniques to improve the segmentation and visualization. We have focused on the segmentation of mitochondria and synaptic junctions in EM stacks from the cerebral cortex, and have compared the results to those obtained by other methods. Our method is faster than other methods with similar segmentation results. Our image regularization procedure introduces high-level knowledge about the structure of labels. We have also reduced memory requirements with the introduction of energy optimization in overlapping partitions, which permits the regularization of very large image stacks. Finally, the surface smoothing step improves the appearance of three-dimensional renderings of the segmented volumes. Keywords Three-dimensional electron microscopy · Automatic image segmentation · cerebral cortex · Mitochondria · Synapses Introduction The availability of technologies such as combined Focused Ion Beam milling/Scanning Electron Microscopy (FIB/SEM) and Serial Block-Face Scanning Electron Microscopy (SBFSEM) for the study of biological tissues permits the automated acquisition of large numbers of serial sections from brain samples (see for example (Denk and Horstmann 2004; Knott et al. 2008; Merchan-Perez et al. 2009)). These three-dimensional samples contain invaluable structural information that must be extracted from the stack of serial images. Electron micrographs of nervous tissue typically show a large variety of structures, such as neuronal and glial processes with their corresponding cytoplasmic organelles (e.g., vesicles, tubules, filaments and mitochondria) and synapses. From a practical point of view, manual segmentation of these structures is a difficult and time-consuming task that requires a high degree of expertise. As a consequence, much effort has been devoted to the development of automated algorithms. Brain images produced by electron microscopy (EM) are very complex and noisy with strong gray-level gradients that do not always correspond to region boundaries. Moreover, different neuronal structures may have similar local image appearance. Hence, it is extremely difficult to develop a fully automated segmentation algorithm. Although automated image processing techniques have addressed the problem of membrane detection and dendrite reconstruction (Turaga et al. 2010), standard computer vision algorithms used for the segmentation of textures (Haindl and Mikes 2008) or natural images (Martin et al. 2001) perform poorly, and standard techniques for the segmentation of biomedical images such as contour evolution (Jurrus et al. 2009) cannot handle the abundant image gradients. Among the various structures visualized with EM, mitochondria and the synaptic junctions are of particular interest to neuroscience. Indeed, most information in the mammalian nervous system flows though chemical synapses. Thus, the quantification and measurement of synapses is a major goal in the study of brain synaptic organization in both health and disease (DeFelipe 2010). Mitochondria are organelles that produce most of the cell’s supply of adenosine triphosphate (ATP) which transports chemical energy within cells for metabolism. In addition to supplying cellular energy, mitochondria are involved in many other crucial cellular physiological tasks ( _e.g._, McBride et al. 2006) and their alterations have been associated with a number of diseases such as Alzheimer’s disease ( _e.g._, Santos et al. 2010). Therefore, substantial effort has been put into developing methods for accurate segmentation of synapses and mitochondria in the brain. Although there are good practical synapse segmentation approaches relying on semi-automated tools (Morales et al. 2011), recent research has focused on machine learning approaches to diminish the degree of user interaction. (Becker et al. 2013) introduced a synaptic junction segmentation approach specifically designed for isotropic resolution image stacks, that is, stacks where voxel dimensions were identical in all X, Y and Z-axes. This method is based on a boosting algorithm that discovers local context cues related to the presence of the synaptic junction. The local context around potential synapse-like regions is also used in (Jagadeesh et al. 2013). However, the approach of Jagadeesh et al. relies on a computationally demanding set of image features that require up to 12 hours of computing time in a 32-node cluster. An alternative way of detecting synapses is by selectively staining them with ethanolic phosphotungstic acid (Navlakha et al. 2013), although this obscures other subcellular details and the ( ) tissue preservation is not appropriate for detailed ultrastructural analysis. Finally, (Kreshuk et al. 2011) used the Ilastik toolbox to segment synaptic junctions. Several algorithms have been specifically designed to segment mitochondria in EM images. A texton-based approach comparing K-NN, SVM and AdaBoost classifiers was proposed (Narasimha et al. 2009). Lucchi and colleagues (Lucchi et al. 2012) later introduced an algorithm using as input 3D supervoxels and assuming almost isotropic image stacks. A different approach has been presented by Giuly and colleagues (Giuly et al. 2012). Their method performs the segmentation of mitochondria in anisotropic stacks of images. However, it is computationally very expensive and requires long processing times. Consequently, our aim was to develop a method that does not require isotropic voxels and that is computationally efficient to allow the interactive segmentation of large image stacks that are now available. Moreover, our approach also involves image regularization and surface smoothing techniques to improve the segmentation. Material & Methods For the development of our segmentation algorithm we have used FIB/SEM image stacks that have been acquired in our laboratory from the rat somatosensory cortex (MerchanPerez et al. 2009; Anton-Sanchez et al. 2014). The resolution was always the same in the X and Y axes and ranged from 3.7 nm per pixel to 14.7 nm per pixel. Resolution in the Z axis, equivalent to section thickness, was in all cases 20 nm per pixel. The stacks were thus anisotropic, that is, they did not have the same resolution in all three axes. Our segmentation algorithm has been specifically designed to take anisotropy into account, and we define the anisotropy factor as: <u>Voxel size in the Z axis</u> _ρ_ = (1) Voxel size in the X (or Y) axis Thus, our stacks had anisotropy factors ranging from 5.41 to 1.36. To make our method comparable to others, we used an additional stack of SBFSEM images available online with an anisotropy factor _ρ_ = 5. Description of the Segmentation Algorithm Our algorithm learns to detect and segment potentially any type of structure from the visual information in a stack of FIB/SEM or SBFSEM images, although in this work we have focused on synaptic junctions and mitochondria. To this end, the algorithm must be trained by providing samples of segmented structures. The user provides these samples in an interactive way ( ) using an in-house application we have developed: first, a few voxels are manually labeled as mitochondria, for example, using standard tools such as the two or threedimensional brush. The system then performs an automatic segmentation based on the training given, thus providing visual feedback. The user then refines the training by labeling new samples in the areas where the automatic segmentation is wrong. This procedure is repeated until the results are satisfactory (see Fig. 1). Our automatic segmentation algorithm has three steps: feature extraction, voxel-wise classification and regularization. An optional fourth step, smoothing, enhances the visual appearance of the segmentation when it is rendered in 3D. _Feature Extraction_ Feature extraction is performed on all voxels in the stack. The features of a voxel are a vector of real numbers that concisely describe the relevant visual information in the vicinity of that voxel. A feature extractor is a function from the space of EM stacks to the space of feature stacks. We have developed two feature extractors, F2D and F3D, which aggregate visual information around each voxel at several scales, and are rotationally invariant and robust to the noise present in EM images. F3D is a feature extractor that takes into account three-dimensional neighborhoods around each voxel. It is adequate for isotropic stacks. F2D, on the other hand, extracts a feature vector for each pixel in an image of the stack considering visual information of a neighborhood of the pixel in that slice and ignoring the information in other slices. F2D is a feature extractor that is suitable for anisotropic stacks. In the paragraphs that follow, we first describe F2D and then introduce F3D as a generalization. F2D works on each image of the stack separately. Hence we only consider a single image _I_ in the following description. F2D first applies a set of linear operators (zero, first and second order derivatives) to the smoothed image I at several scales. Thus, the set of linear operators at a scale _σ_ is Figure 2 shows the components of a partial feature vector at a fixed scale for all the pixels in a single image. The complete feature vector for each pixel is the concatenation of several partial feature vectors. We apply this procedure at _n_ different scales { _σ_ 0 _, . . ., σn_ −1}, producing a feature vector with 4 _n_ components for each pixel in _I_ . The set of scales should match the size of the structures that have to be detected in the images. In practice, the user only sets the initial scale _σ_ 0, which we call the base scale, and the rest of scales are given by _σi_ = 2 <u>12</u> <sup>_i_</sup> _σ_ 0. For example, if we use _n_ = 4 scales and set the smallest scale to _σ_ 0 = 4 pixels, our feature vectors will have 16 dimensions and they will range from 4 to 11.31 pixels in scale. F3D is a generalization of F2D for isotropic image stacks. As in F2D, the set of linear operators with the zero, first and second order derivatives at a given scale _σ_, ⎧ ⎫ _Gσ_ ∗ _, σ_ - _Gσ_ ∗ _∂x_ <sup>_<u>∂</u>_</sup> <sup>_, σ_</sup> <sup>·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂y_ <sup>_<u>∂</u>_</sup> <sup>_, σ_</sup> <sup>·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂z_ <sup>_<u>∂</u>_</sup> <sup>_,_</sup> ⎪⎪⎪⎪⎪⎪⎨ ⎪⎪⎪⎪⎪⎪⎬ _Gσ_ ∗ _, σ_ - _Gσ_ ∗ _∂x_ <sup>_<u>∂</u>_</sup> where _Gσ_ is a Gaussian filter of radius _σ_ and ∗ is the convolution operator. The response to these operators will be noted as _s_ 00, _s_ 10, _s_ 01, _s_ 20, _s_ 11 and _s_ 02 (note that the subscripts denote the order of the derivatives). With these responses to the filters at a scale _σ_, we can compute a partial feature vector for the pixels of _I_ at that scale. This partial feature vector has four components: - ~~�~~ _s_ 00 _,_ _s_ 10 <sup>2</sup> <sup>+</sup> <sup>_s_</sup> 01 <sup>2</sup> <sup>_, λ_</sup> <sup>1</sup> <sup>_, λ_</sup> <sup>2</sup> _,_ (3) ~~�~~ _s_ <sup>2</sup> 10 <sup>2</sup> <sup>+</sup> <sup>_s_</sup> 01 <sup>2</sup> <sup>_, λ_</sup> <sup>1</sup> <sup>_, λ_</sup> <sup>2</sup> _,_ (3) where _s_ 00 is the smoothed image, _s_ 10 <sup>2</sup> <sup>+</sup> <sup>_s_</sup> 01 <sup>2</sup> <sup>is</sup> <sup>the</sup> <sup>gra-</sup> dient magnitude and _λ_ 1 and _λ_ 2 are the first and second eigenvalues of the Hessian matrix, that are computed as where _s_ 00 is the smoothed image, ~~�~~ _s_ <sup>2</sup> ~~�~~ _(s_ 20 + _s_ 02 _)_ <sup>2</sup> + 4 _s_ 11 <sup>2</sup> _λ_ 1 = <sup><u>1</u></sup> 2 ~~�~~ _(s_ 20 + _s_ 02 _)_ <sup>2</sup> + 4 _s_ 11 <sup>2</sup> <u>�</u> _,_ (4) <u>�</u> _._ (5) _λ_ 2 = <sup><u>1</u></sup> 2 _s_ 20 + _s_ 02 + _s_ 20 + _s_ 02 − _∂y_ <sup>_<u>∂</u>_</sup> <sup>_, σ_</sup> <sup>·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂z_ <sup>_<u>∂</u>_</sup> _∂z_ <sup>_<u>∂</u>_</sup> <sup>_,_</sup> _Gσ_ ∗ _, σ_ - _Gσ_ ∗ _∂x_ <sup>_<u>∂</u>_</sup> _∂y_ <sup>_<u>∂</u>_</sup> <sup>_, σ_</sup> <sup>2 ·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂x_ <sup>_<u>∂</u>_</sup> <sup>2</sup> _∂x_ <sup>_<u>∂</u>_</sup> <sup>_, σ_</sup> <sup>·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂y_ <sup>_<u>∂</u>_</sup> _∂x_ <sup>_<u>∂</u>_</sup> <sup>22</sup> <sup>_, σ_</sup> <sup>2</sup> _∂x_ <sup>_<u>∂</u>_</sup> <sup>_, σ_</sup> <sup>·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂y_ <sup>_<u>∂</u>_</sup> _∂xy_ <sup>_<u>∂</u>_</sup> <sup>2</sup> <sup>_, σ_</sup> <sup>2 ·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂xz_ <sup>_<u>∂</u>_</sup> <sup>2</sup> _∂yz_ <sup>_<u>∂</u>_</sup> <sup>2</sup> <sup>_, σ_</sup> <sup>2 ·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂z_ <sup>_<u>∂</u>_</sup> <sup>22</sup> _∂z_ <sup>2</sup> ⎫ ⎪⎪⎪⎪⎪⎪⎬ ⎪⎪⎪⎪⎪⎪⎭ _σ_ <sup>2</sup> - _Gσ_ ∗ _∂x_ <sup>_<u>∂</u>_</sup> <sup>2</sup> _σ_ <sup>2</sup> - _Gσ_ ∗ _∂y_ <sup>_<u>∂</u>_</sup> <sup>2</sup> _∂x_ <sup>_<u>∂</u>_</sup> <sup>22</sup> <sup>_, σ_</sup> <sup>2 ·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂xy_ <sup>_<u>∂</u>_</sup> <sup>2</sup> _∂y_ <sup>_<u>∂</u>_</sup> <sup>22</sup> <sup>_, σ_</sup> <sup>2 ·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂yz_ <sup>_<u>∂</u>_</sup> <sup>2</sup> _∂xz_ <sup>_<u>∂</u>_</sup> <sup>2</sup> <sup>_,_</sup> _,_ (6) ⎪⎪⎪⎪⎪⎪⎩ - _Gσ_ ∗ _∂xy_ <sup>_<u>∂</u>_</sup> <sup>2</sup> _∂xy_ <sup>_<u>∂</u>_</sup> <sup>2</sup> <sup>_, σ_</sup> <sup>2 ·</sup> <sup>_Gσ_</sup> <sup>∗</sup> _∂y_ <sup>_<u>∂</u>_</sup> <sup>22</sup> _∂y_ <sup>2</sup> _,_ (2) Fig. 1 Workflow of the segmentation algorithm. The input stack of serial images is subjected to four successive steps, two of which can be interactively modified by the user Fig. 2 Feature extraction from a single image. In this example, feature extraction has been performed at a scale _σ_ = 4 pixels. The resulting partial feature vector has four components: the smoothed image ( a ), the gradient magnitude ( b ), and the first ( c ) and second eigenvalues ( d ) of the Hessian matrices. Feature extraction is also performed at several other scales (not shown) to obtain the complete feature vector is applied to the stack obtaining the responses - _sijk_ : _i_ + _j_ + _k_ ≤ 2, where _i_, _j_ and _k_ indicate the order is applied to the stack obtaining the responses - _sijk_ : _i_ + _j_ + _k_ ≤ 2, where _i_, _j_ and _k_ indicate the order of the derivatives in the X, Y and Z axes. The partial feature vector for each voxel of the stack at a given scale is - ~~�~~ _s_ 000 _,_ _s_ 100 <sup>2</sup> <sup>+</sup> <sup>_s_</sup> 010 <sup>2</sup> <sup>+</sup> <sup>_s_</sup> 001 <sup>2</sup> <sup>_, λ_</sup> <sup>1</sup> <sup>_, λ_</sup> <sup>2</sup> <sup>_, λ_</sup> <sup>3</sup> _,_ (7) ( ) feature vector _fi(_ x _)_ . We use the Bayes’ rule to express this distribution as a product _P (yi_ | _fi(x))_ ∝ _p(fi(_ x _)_ | _yi)P (yi),_ (9) where the conditional _p(fi(_ x _)_ | _yi)_ is the probability density of the feature vector for voxels with label _yi_ and _P (yi)_ is the prior probability of a pixel having the label _yi_ . We model the conditional distribution as a Gaussian, ~~�~~ _s_ <sup>2</sup> 100 <sup>2</sup> <sup>+</sup> <sup>_s_</sup> 010 <sup>2</sup> <sup>+</sup> <sup>_s_</sup> 001 <sup>2</sup> <sup>_, λ_</sup> <sup>1</sup> <sup>_, λ_</sup> <sup>2</sup> <sup>_, λ_</sup> <sup>3</sup> _,_ (7) where the first component is the smoothed image, the second one is the magnitude of the gradient, and _λ_ 1, _λ_ 2 and _λ_ 3 are the eigenvalues of the Hessian matrix ⎛ ⎞ _fi_ _(_ x _)_ - _μ_ _y_ - <sup>�</sup> _,_ (10) - _T_ _�y_ −1 - <sup><u>1</u></sup> 2 _fi_ _(_ x _)_ - _μ_ _y_ <u>1</u> _p(fi_ _(_ x _)_ | _y)_ = ~~�~~ _(_ 2 _π)_ <sup>_k_</sup> <sup>~~�~~</sup> <sup>�</sup> _�y_ ~~�~~ - exp _s_ 200 _s_ 110 _s_ 101 _s_ 110 _s_ 020 _s_ 011 _s_ 101 _s_ 011 _s_ 002 ⎞ ⎝ ⎠ _._ (8) where the parameters _μ_ _y_ and _�y_ are the mean vector and the covariance matrix of the feature vectors for voxels with the label _y_, and _k_ is the dimension of the feature vector. In the training step these parameters are estimated from training data. The user manually labels a few voxels of the stack. During training, the voxels labeled with label _y_ are used to estimate _μ_ _y_, i.e., the mean of the feature vectors of voxels labeled as _y_, and _�y_, i.e., the covariance matrix of these feature vectors. When the dimension of the feature vectors is large, the training data often falls in a proper subspace of the complete _k_ -dimensional feature space producing a singular or near singular covariance matrix _�y_ . We avoid this problem by first performing Principal Component Analysis (PCA)based dimensionality reduction on the cloud of all feature Again, the complete feature vector for each voxel is the concatenation of the partial feature vectors at several scales. _Classification_ A classifier uses the feature vectors to determine the probability that a voxel belongs to each label. This classifier has to be trained with labeled data to learn the relationship between feature vectors and labels. Here we briefly present how the classifier is trained and how a trained classifier can be used with new unclassified data. Our classifier learns the probability distribution _P (yi_ | _fi(_ x _))_ of the label _yi_ for the pixel _i_ given the observed ( ) vectors . The dimensionality after the PCA is established to retain 99 % of variance. _P (y)_ is the a priori probability of the label _y_ . It is learned from the user-provided data in the training step. In short, the training step consists of estimating the parameters _μ_ _y_ and _�y_ of the conditional distribution (after a PCA-based dimensionality reduction) and the prior _P (y)_ from the userprovided data with the interactive tool. Once the classifier is trained, it processes every voxel in the EM stack. For each voxel _i_ with feature vector _fi(_ x _)_, the probability _P (yi_ | _fi(_ x _))_ is computed for every label _yi_ . This results in a probability map that maps every voxel to the probabilities of belonging to each label. As an example, see Fig. 3a, b. In preliminary experiments, we tested other classifiers such as support vector machines. Although these methods improve the results obtained with the Gaussian classifier, their performance is only marginally better at the expense of much higher computational time (in the order of hours vs. seconds), which makes them unsuitable for operation in real time. _Regularization_ If voxels are assumed to be independent of each other, it is possible to segment the stack by simply assigning Fig. 3 Classification and regularization of a single image. ( a ) and ( b ): Probability maps obtained by a Gaussian classifier that has been trained with the features extracted from the same image that is shown in Figure 2. The pixel-wise probability of belonging to the label ”Mitochondrion” is shown in ( a ) and the pixel-wise probability of belonging to the label ”Synaptic junction” is shown in ( b ). ( c ): preliminary segmentation before regularization, where each pixel has simply been given the label with highest probability (Mitochondria, gray; Synaptic junctions, white). Note the sparse pixels scattered throughout the image, the small holes in some of the segmented objects and the jagged edges. ( d ): Final segmentation after regularization via CRF energy minimization. Most sparse pixels have disappeared and edges show a smoother appearance to each voxel _i_ the label _y_ <sup>∗</sup> with higher probability, i.e., _y_ <sup>∗</sup> = _argmaxyP (y_ | _x)_ . However, this offers far from optimal results, since the resulting segmentation is noisy, and it shows many sparse pixels, grainy regions and small holes (Fig. 3c, d). Therefore, we have to assume some degree of probabilistic dependency between neighboring voxels of the stack. We have modeled this dependency by means of a conditional random field (CRF). A CRF models the distribution _P (_ Y | x _)_ between the set of observed variables _x_ (i.e., the pixel values of the stack of images) and the hidden variables Y = { _y_ 1 _, . . ., yN_ } (i.e., the segmentation labels) in such a way that Y conditioned on x holds the Markov property _P (yi_ | x _,_ Y - _i)_, where Y - i is the set of label variables without _yi_, and _N(i)_ are the neighboring voxels of voxel _i_ . The neighborhood function _N_ defines a graph _(V, E)_ with the set of voxels _V_ as nodes and the set of arcs _E_ as given by the pair of voxels related by _N_ . The graph constructed in this way is known as the CRF graph. The Hammersley–Clifford theorem states that the distribution of a CRF can be written as a Gibbs measure, <u>1</u> _P (_ Y | x ; _θ)_ = _Z(_ x _, θ)_ _c_ ∈ _C_ _�c(_ Y _c,_ x _c)_ <u>1</u> = _c_ ∈ _C_ <sup>_θc_</sup> <sup>·</sup> <sup>_φc(_</sup> <sup>Y</sup> <sup>_c,_</sup> <sup>x</sup> <sup>_c)_</sup> _,_ (11) _Z(_ x _, θ)_ <sup>_e_</sup> <sup>−</sup> <sup>�</sup> where _Z(_ x _, θ)_ is the partition function, _C_ is the set of cliques in the CRF graph and Y _c_ is the set of variables from Y related to clique _c_ . In other words, the Gibbs measure expresses the distribution as the product of potentials _�c_ (note that the potentials are not required to be probability distributions) depending on subsets of the complete set of random variables. The product of all potentials can be written as a weighted sum of factors using the minus logarithm, ( ) that it is connected to. Therefore, the given factor graph represents the following factorization of our distribution: ⎛ <u>1</u> _P(_ Y | x ; _θ)_ = _Z(_ x _, θ)_ <sup>exp</sup> ⎝− _θi_ - _φi_ _(yi_ _,_ x _)_ _i_ ∈ _V_ _(i,j)_ ∈ _E_ _θij_ - _φij_ _(yi_ _, yj_ _)_ ⎞ ⎠ _�c(_ Y _c,_ x _c)_ = _c_ ∈ _C_ (13) There are two kinds of potentials in this graph. The first kind of potential is associated with the terms _φi(yi,_ x _)_ . We will call them unary terms, since they only depend on a single variable _yi_ for a fixed observation in the energy function. The second kind of potential is related to the terms _φij_ _(yi, yj_ _)_ . In an analogous way, we will call them pair-wise terms, since they depend on pairs of label variables. Training a CRF consists of determining its parameters _θ_ . This tends to be a complex task, especially if the CRF has many parameters, as in our case. We therefore need to simplify it further. A very common and reasonable assumption is that the CRF is translation and orientation invariant, and as a consequence all of the parameters for a kind of term (unary or pairwise) share the same value. This would lead to the energy function: - log _c_ ∈ _C_ _θc_ - _φc(_ Y _c,_ x _c)._ (12) that, when written for a fixed observation x, is known as the energy of the labeling and denoted as _E(_ Y _)_ . This energy is a map from the space of labelings to the real numbers. For improbable labelings the energy gives large values, whereas for good, probable labelings it provides lower values. Finding the best segmentation with the probability distribution of the CRF, that models some degree of dependency among neighboring voxels, requires maximizing the probability _P (_ Y | x ; _θ)_ for a fixed observation x . This is equivalent to minimizing the energy _E(_ Y _)_ . Figure 4 depicts the factor graph of our CRF. The factor graph is a bipartite graph that shows the random variables of the CRF graph as circles, as well as the potentials as little black squares. A potential depends on the random variables Fig. 4 Factor graph for the CRF. The random variables are inside circle nodes. Black squares represent potentials depending on the random variables they are connected to. The energy of the CRF is the sum of all potentials. This figure shows only a fragment of a 2D CRF, but the generalization to 3D is straightforward _(i,j)_ ∈ _EZ_ This energy has only two parameters, _θXY_ and _θZ_, which control the strength of the regularization in the XY plane and in the Z axis. In an anisotropic stack we can assume that _θXY_ and _θZ_ are related by the expression _θZ_ = <sup>_<u>θXY</u>_</sup> _ρ_ <sup>,</sup> <sup>and</sup> _φi(yi,_ x _)_ + _θ_ 2 _θ_ 1 _φij_ _(yi, yj_ _)._ (14) _i_ ∈ _V_ _(i,j)_ ∈ _E_ Unfortunately, in non-isotropic stacks we cannot assume orientation invariance. Usually, the stack has a lower resolution in the Z axis than in the X and Y axes. Therefore, we must treat the pair-wise terms that are oriented in the Z axis in a different way. We divide the set _E_ into two disjoint subsets, _EXY_ and _EZ_, for the edges oriented along the X and the Y axes and for the edges oriented along the Z axis, respectively. The energy is now: _(i,j)_ ∈ _EXY_ _φij_ _(yi, yj_ _)._ (15) _(i,j)_ ∈ _EZ_ _θ_ 1 _i_ ∈ _V_ _φi(yi,_ x _)_ + _θXY_ <sup>′</sup> _φij_ _(yi, yj_ _)_ + _θZ_ <sup>′</sup> + _θZ_ <sup>′</sup> Finally, since we are interested in the minimum energy, we can multiply the energy by _θ_ <u>11</u> <sup>and</sup> <sup>the</sup> <sup>solution</sup> <sup>remains</sup> unchanged: _i_ ∈ _V_ _φi(yi,_ x _)_ + _θXY_ + _θZ_ _(i,j)_ ∈ _EXY_ _φij_ _(yi, yj_ _)._ (16) _φij_ _(yi, yj_ _)_ ( ) Fig. 5 Segmentation of a whole stack of serial images after the regularization step. Mitochondria are shown in purple and synaptic junctions are shown in green only one of them needs to be estimated by cross-validation or manually by the user. The manual estimation is further facilitated by the fact that the CRF offers good results for a large range of parameter values. The unary and pair-wise terms have to be defined in such a way that they provide lower values for good, probable inputs. The unary terms _φi(yi,_ x _)_ are responsible for introducing the observed data into the energy value. It is customary to define the unary terms as the minus logarithm of the probability that our trained classifier provides: _φi(yi,_ x _)_ = - log _P (yi_ | _fi(_ x _))_ . This definition is justified since, in the absence of the pair-wise terms, the CRF would lead to the segmentation given by the classifier acting on each voxel separately. Fig. 6 Regularization in overlapping partitions. Example of partition of a full stack into two disjoint substacks A and B and two overlapping substacks A ’ and B ’. Once the regularization has been performed in A ’, only voxels belonging to A are updated. Then, regularization is performed in B ’ and only voxels belonging to B are updated. This procedure prevents the appearance of regularization artifacts in the boundary between A and B Fig. 7 Example of a smoothed surface that meets the constraints imposed by the segmentation. The red and blue dots indicate the pixels that are inside and outside the object, respectively. The green and blue contours are the maximum and minimum area contours, respectively. Although there are infinite contours that would lie between them, we look for the smoothed minimum curvature contour depicted in red The role of the pair-wise terms _φij_ _(yi, yj_ _)_ is twofold. First, they regularize the segmentation results by penalizing Fig. 8 Example of a branching mitochondrion. A large branching mitochondrion is shown before ( a ) and after smoothing ( b ) the change of labels between neighboring voxels. This prevents the occurrence of isolated pixels and small holes that could appear (Fig. 3c, d). Second, they serve to introduce some extent of high-order knowledge about the structure of the stack. For example, we could impose the condition that synaptic junctions and mitochondria cannot touch each other, by setting a very large penalty to that label change in our experiments. Therefore, the pair-wise terms are assigned as follows. A low penalty 1 is given to pairs of labels that are allowed to be neighbors. Second, a very high penalty ∞ is assigned to pairs of labels that cannot be adjacent (e.g., synaptic junctions and mitochondria). Third, no penalty is given for pairs of neighboring pixels with the same label. The ( ) distance matrix between labels _background_ (bg), _synaptic_ _junction_ (syn) and _mitochondria_ (mit) is therefore: Once we have defined our energy, we need to find the segmentation that minimizes the energy function, Y <sup>∗</sup> = _argmin_ Y _E(_ Y _)_ . This is in general an NP-hard optimization problem. However, it is known that when the terms are up to order two, i.e., there are only pair-wise (order 2) and unary (order 1) terms, the number of labels is two _bg_ _syn_ _mit_ ⎛ _bg_ 0 1 1 _syn_ ⎝ 1 0 ∞ _mit_ 1 ∞ 0 ⎛ ⎝ 0 1 1 1 0 ∞ 1 ∞ 0 ⎠ _._ ⎞ a b c d Fig. 9 Metrics obtained by cross-validation for several values of the parameters _σ_ 0 and _θXY_ . ( a ) TPR vs. _σ_ 0 for different values of _θXY_ . ( b ) FPR, ( c ) ACC and ( d ) JAC ( ) Fig. 10 Segmentation of mitochondria in a 700 × 700 × 50 stack of EM serial images. The left column shows four individual, nonconsecutive images from the stack. The second column shows ground truth data, manually segmented by an expert. The two rightmost columns show the results obtained with our algorithm using a base scale _σ_ 0 = 6 and two different sets of regularization parameters _θXY_ and _θZ_ . and the pair-wise terms are submodular, i.e., _φ(yi, yi)_ + _φ(yj_ _, yj_ _)_ ≤ _φ(yi, yj_ _)_ + _φ(yj_ _, yi)_, then a max-flow/mincut algorithm finds the global optimum of the energy in polynomial time. Unfortunately, when there are more than two labels, the max-flow algorithm is no longer applicable. Instead, we have to rely on approximate energy minimization using the _αβ_ -swap algorithm from (Boykov et al. 2001). Figure 3c, d shows the segmentation of a single image after the _αβ_ -swap regularization. Figure 5 shows the segmentation of a whole stack of serial EM images. The graph-cut techniques needed for regularization require a considerable amount of computer memory. For a reasonably sized stack, the required memory usage usually becomes too big. Therefore we need to regularize parts of the full stack separately and merge them together at the end. A simple approach is to divide the stack into disjoint, i.e., non-overlapping substacks and regularize them separately. This method works well for the inner areas of each substack, but it looks jumpy in their boundaries, since the CRF does not have enough context to determine the correct labels. This is visually noticeable as abrupt terminations of mitochondria and synaptic junctions at these boundaries. The solution to this problem consists of extending each substack with a margin, effectively making the new Table 1 Comparative results for mitochondria detection performed by our algorithm with two different sets of regularization parameters, by Ilastik (Sommer et al. 2011), and by the Cytoseg process, according to (Giuly et al. 2012) Method TPR FPR ACC JAC VOE Ours, _σ_ 0 = 6; _θXY_ = 10; _θZ_ = 2 0.78 0.018 0.96 0.68 8.26 % Ours, _σ_ 0 = 6; _θXY_ = 20; _θZ_ = 4 0.81 0.024 0.96 0.67 2.51 % Cytoseg 0.80 0.02 0.97 N/A N/A Ilastik 0.77 0.02 0.96 0.66 5.45 % extended substacks overlap with their neighbors. The regularization is then applied to the extended substacks, but only the results obtained in the original substack volume are preserved in the final segmentation (Fig. 6). ( ) Determining the optimal size of the margin is a problem beyond the scope of this paper. However, we have found that a margin of 10 voxels in each direction offers very good results in practice. ## a d b e c f Fig. 11 Simultaneous segmentation of mitochondria and synaptic junctions. Metrics obtained by cross-validation for several values of the parameters _σ_ 0 and _θXY_ . ACC, TPR, and JAC are shown for mitochondria ( a - c ) and synaptic junctions ( d - f ) ( ) Finally, the size of the substacks is limited by the available memory. As a rule of thumb, the regularization process takes 5 or 6 times the memory used by the original substack being regularized. _Segmentation Smoothing_ The segmentation we obtain consists of hard label assignments to each voxel of the stack. This is suitable for several tasks such as counting of labeled objects or the estimation of the volume of the segmented objects, but presents disadvantages concerning the visualization of their surfaces. We use the marching cubes algorithm to extract the surfaces of the objects from the labels in the segmentation volume. This process not only produces unpleasant and unnatural renderings, but also biases the area estimates. Therefore we need to smooth the surfaces, but at the same time we want to preserve the constraints imposed by the labels in the segmentation volume. Among the infinite surfaces that meet these constraints, we compute the surface that minimizes curvature (see Fig. 7). To this end, we have adapted the method described by (Lempitsky 2010) to anisotropic stacks. First, we build a vector of constraints { _vi_ } <sup>_N_</sup> _i_ = <sup>_N_</sup> _i_ =1 <sup>∈{−1</sup> <sup>_,_</sup> <sup>1}</sup> <sup>_N_</sup> such as _vi_ = 1 if the voxel _i_ is inside an object and _vi_ = −1 if it is outside an object, i.e., if it has the background label. We find a real-valued vector { _fi_ } <sup>_N_</sup> _i_ =1 <sup>∈</sup> <sup>R</sup> <sup>_N_</sup> <sup>such</sup> <sup>that</sup> <sup>_fi_</sup> <sup>_>_</sup> We find a real-valued vector { _fi_ } <sup>_N_</sup> _i_ =1 <sup>∈</sup> <sup>R</sup> <sup>_N_</sup> <sup>such</sup> <sup>that</sup> <sup>_fi_</sup> <sup>_>_</sup> 0 if _vi_ = 1 and _fi_ _<_ 0 if _vi_ = −1 and its zero-levelset is smooth. In a continuous setting we would minimize the functional �2 + - _<u>∂</u>_ 2 _<u>f</u>_ _∂y_ <sup>2</sup> �2 - _<u>∂</u>_ 2 _<u>f</u>_ + _∂z_ <sup>2</sup> �2 d _V._ (17) The Eqs. (18) and (19) constitute a convex quadratic program that can be solved with the Jacobi method with a slight modification to include the constraints in the algorithm (Lempitsky 2010). Figure 8 shows a mitochondrion before and after smoothing with this method. Note that this smoothing only affects the estimated surfaces and, therefore, the rendering of these surfaces. The segmentation volume and the numerical results extracted from it are not affected by this procedure. Therefore, the quantitative comparisons offered in the Section “Results” are computed with no smoothing. Results As explained in the previous section, we conceived our algorithm to be used interactively. However, to evaluate its performance we have used two datasets that have been fully segmented manually. We need these manual segmentations as ground-truth data to validate our results and compare them to others. Moreover, given that we have enough training data, we use them to find optimum values for the base scale _σ_ 0 and the regularization term _σXY_ . We have used several voxel-based metrics to evaluate the quality of the segmentations. Voxel-based metrics measure the error rates in voxel classification taking into account true positive (TP), true negative (TN), false positive (FP) and false negative (FN) classifications. - True positive rate (TPR): <u>TP</u> TPR = (20) TP + FN - False positive rate (FPR): <u>FP</u> FPR = (21) FP + TN - Accuracy (ACC): <u>TP + TN</u> ACC = (22) TP + TN + FP + FN - Jaccard index (JAC): <u>TP</u> JAC = (23) TP + FP + FN - Volume error (VOE): VOE = <sup>|FP −</sup> <sup><u>FN|</u></sup> (24) TP + FN Unless otherwise stated, all running times were obtained on a Linux system with an Intel Xeon at 2.40GHz with no GPU processing. Our algorithm is mostly implemented in Python using the NumPy library. The inner parts of the CRF regularization are written in C++. Our implementation runs in a single thread. - _<u>∂</u>_ 2 _<u>f</u>_ _∂x_ <sup>2</sup> _f_ <sup>∗</sup> = arg min _f_ _�_ The minimization of the above functional smooths the segmentation result. In an anisotropic discrete setting, the smoothing problem becomes _f_ <sup>∗</sup> = min _f_ - _fNx_ _(i)_ + _fN_ - _x_ _(i)_ - 2 _fi_ _i_ �2 �2 �2 + + _fNy_ _(i)_ + _fN_ - _y_ _(i)_ - 2 _fi_ _fNz(i)_ + _fN_ <u>−</u> _<u>z(i)</u>_ - 2 _fi_ _,_ (18) _ρ_ <sup>4</sup> subject to _vi_ - _fi_ ≥ _mi_ ∀ _i,_ (19) where _N_ [−] _d_ _(i)_ is the neighbor of _i_ in the direction _(_ - _)d_, and { _mi_ } <sup>_N_</sup> _i_ =1 <sup>is a vector of margins imposing the deviations</sup> from zero of _f_ at each point. _mi_ is 0 if _i_ is at the boundary of an object (i.e., if _vi_ and _vj_ for any of the neighbors _j_ of _i_ have different values) and 1 everywhere else. Here we have included factor _ρ_ in the second derivative along the Z-axis to account for the anisotropy of the stack. Fig. 12 Simultaneous segmentation of mitochondria and synaptic junctions. The left column shows the original images; the center left column is the ground-truth; the center right column is the result obtained with Ilastik; the right column is the result of our algorithm with parameters _σ_ 0 = 2; _θXY_ = 4; _θZ_ = 2 _._ 94. The first row shows a full slice. The second and third rows show zoomed regions of different slices for detail Mitochondria Segmentation ( ) Our method EM serial images Ground-truth Ilastik ( σ0 = 2; θXY = 4) We used a stack of serial EM images from the mouse cerebellum to test our method for the segmentation of mitochondria. This stack is available online in the Cell Centered Database <sup>1</sup> with ID 8192. We have selected this stack to make our method comparable with Cytoseg, an automatic segmentation tool proposed by (Giuly et al. 2012). These researchers provide the raw images as well as a manual segmentation of mitochondria at the Cytoseg web page. <sup>2</sup> The stack has a size of 700 × 700 × 50 voxels and a voxel size of 10 × 10 × 50 nm (anisotropy factor _ρ_ = 5). We have applied our method to automatically detect the mitochondria in this stack. The stack was divided into 5 sets of 10 images and we used 5-fold cross-validation to estimate the quality of the segmentation for different pairs of values of _σ_ 0 and _θXY_ . Values of _σ_ 0 ranged from 2 to 20 and values of _θXY_ ranged from 0 to 20. Figure 9 plots the TPR, FPR, ACC and JAC metrics obtained. The curves show that the base scale for feature extraction _σ_ 0 is much more critical for the quality of the segmentations than the regularization penalty _θXY_ . In fact, the regularization penalty is almost irrelevant for the quantitative measurements, but it is much more important in the visual or qualitative results (see Fig. 10). From the results of the cross-validation process, we choose _σ_ 0 = 6 as it offers a good trade-off between the considered metrics. For the regularization parameter _θXY_, [1http://ccdb.ucsd.edu](http://ccdb.ucsd.edu) [2https://code.google.com/p/cytoseg/](https://code.google.com/p/cytoseg/) we select two different values: 10 and 20. The parameter _θZ_ = <sup>_<u>θXY</u>_</sup> _ρ_ is set to 2 and 4, respectively. After choosing the parameters, we apply our segmentation algorithm to the full stack. We used the last 10 slices of the stack for training. The results obtained with our method are similar to those obtained with the Cytoseg process (see Table 1). However, Cytoseg (Giuly et al. 2012) required 80 minutes of processing time for a stack of 350 × 350 × 30 according to their paper, while our algorithm took 53.8 seconds for the segmentation of a 700×700×50 stack (training takes 9.6 seconds and the complete stack labeling, including CRF regularization, 44.2 seconds). We also applied the software Ilastik ((Sommer et al. 2011), www.ilastik.org) to segment mitochondria in this dataset. The quantitative results obtained in Ilastik (see Table 1) are comparable to those of the other methods. However, Ilastik took 56.5 minutes for processing the full stack using 8 threads, resulting in a total of 452 minutes of CPU. This is about 500 times slower than our method. Other methods for mitochondria segmentation are even less suitable for large anisotropies. Supervoxel segmentation with learned shape features (Lucchi et al. 2012) aims to learn non-local shapes of the target objects to segment. They use a combination of supervoxels, 3D ray features and structured prediction. 3D ray features are specially affected by anisotropy since both the edge detector and the length of the rays are highly dependent on the orientation. The achievable segmentation accuracy —i.e., the highest accuracy that can be achieved using supervoxels assuming perfect classification of each supervoxel— drops significantly with anisotropy. Moreover, the structured prediction requires training with a large portion of the stack fully labeled in order to infer the terms of the pairwise ( ) Table 2 Quantitative results for the simultaneous segmentation of mitochondria and synaptic junctions Method TPR FPR ACC JAC VOE Ours, mit-vs-rest, _σ_ 0 = 1, _θXZ_ = 4, _θZ_ = 2 _._ 94 0.84 0.02 0.97 0.60 15.72 % Ours, syn-vs-rest, _σ_ 0 = 1, _θXZ_ = 4, _θZ_ = 2 _._ 94 0.60 0.004 0.99 0.26 87.17 % Ours, mit-vs-rest, _σ_ 0 = 2, _θXZ_ = 4, _θZ_ = 2 _._ 94 0.78 0.014 0.97 0.63 0.01 % Ours, syn-vs-rest, _σ_ 0 = 2, _θXZ_ = 4, _θZ_ = 2 _._ 94 0.42 0.004 0.99 0.23 24.00 % Ilastik, mit-vs-rest 0.68 0.009 0.97 0.61 21.58 % Ilastik, syn-vs-rest 0.36 0.002 0.99 0.29 41.43 % interaction. As a consequence of these factors, the method from (Lucchi et al. 2012) required more training data (half of the stack) to work properly, and provided rather unsatisfactory results with low Jaccard indices ( _<_ 0 _._ 48). The running times were also higher ( _>_ 21 minutes) due mainly to the cost of extraction of the ray features. Mitochondria and Synaptic Junctions Segmentation For this test we used a stack of 366 × 494 × 213 voxels and a voxel size of 14 _._ 7 × 14 _._ 7 × 20 nm ( _ρ_ = 1 _._ 36) acquired from the rat somatosensory cortex. We used the first 100 slices of the stack to estimate the parameters of the algorithm with 5-fold cross-validation. The results of the cross-validation are plotted in Fig. 11. Again, the base scale _σ_ 0 had a critical impact on performance, whereas the regularization penalty _θXY_ only caused subtle variations. Note that we were segmenting three different classes (background, mitochondria and synapses) and therefore we measured the quality of segmentations with mitochondria-vs-rest and synapses-vs-rest metrics, i.e., considering one of the classes as foreground and the rest as background. From the results of cross-validation, we chose _σ_ 0 = 1 and _σ_ 0 = 2 as a trade-off value that worked reasonably well for both mitochondria and synaptic junctions. We set _θXY_ = 4 and _θZ_ = _<u>θXYρ</u>_ = 2 _._ 94. The training was per formed using 11 evenly distributed slices of the stack and it took 3.27 seconds to complete. The segmentation of the full stack (213 serial images) took 10.15 minutes (48.31 seconds for the classification step and the rest for regularization). Figure 12 shows the results of our algorithm and Ilastik. Table 2 compares the quantitative performance of both algorithms. The Ilastik performance results were obtained using a very similar manual segmentation to the one used with our algorithm. The results obtained with both methods were similar when considering the numerical performance, with ours being marginally better. However, Ilastik took 56 minutes with 8 threads to train and segment the full stack, making our method 45 times faster. Visual appearance of the final segments were also much better in our case thanks to the regularization procedure (see Fig. 12). Running Time Comparison Table 3 summarizes running times for our experiments in both datasets. Our method runs much faster compared to the others with similar or better performance. Cytoseg and learned shape features are specialized in mitochondria segmentation; thus, we only report results in the first dataset for those methods. There is an important difference in running times for our method in both datasets (2.15 vs. 15.9). This large difference is due to the regularization with _>_ 2 labels, where a single graph-cut is inviable and iterative, slower algorithms such as _αβ_ -swap are required. Counting Structures Estimating the number of structures from the results of an automatic segmentation process is still an open problem with plenty of ongoing research. As an approximate, simple solution, it is commonly assumed that each connected component of the segmentation is one structure. This is the approach we use. Despite its simplicity, it has Table 3 Absolute and normalized running times for different methods. Absolute times are given in seconds of CPU (s·CPU), and normalized - times (in parentheses) are given in seconds of CPU per megavoxel Megavoxels·CPU <u>s·CPU</u> Megavoxel Method CCDB-8192 Mit&Syn Cytoseg (Giuly et al. 2012) 4800 (192.08) N/A Ilastik (Sommer et al. 2011) 14216 (568.87) 27112 (704) Learned shape features (Lucchi et al. 2012) 1380 (55.22) N/A Ours 53.8 (2.15) 612.27 (15.9) ( ) a b c Fig. 13 Count estimations for varying thresholds. ( a ) shows estimations in the number of mitochondria for the CCDB-8192 dataset. ( b ) and ( c ) show estimations in the number of mitochondria and synaptic junctions respectively in the Mit&Syn dataset several drawbacks, namely, a group of structures close to each other often merge in a single connected component, and large structures are sometimes split into two or more connected components. Also, when spatial regularization is not present, false positive detections result in many small connected components that bias the counting estimations. To alleviate these problems, we discard the connected components smaller than a given threshold. Setting the threshold is not trivial, as it might greatly affect the counts depending on the quality of the segmentation. A good segmentation is expected to be more robust to different thresholds than a bad one, i.e., estimations should be close to the real value and should be stable for a large range of thresholds. Figure 13 shows count estimations for different thresholds with both Ilastik and our method. The regularization makes our method more robust: it reduces the number of small components and the estimations of our method are closer to the ground-truth for a wider range of thresholds. Table 4 gives numerical assessment of this idea. It shows the absolute value of the deviations of the estimations from the ground-truth averaged over all thresholds in the range _T_ = [10 _,_ 2000] ⊂ Z: Discussion Concerning the segmentation of mitochondria, Lucchi and colleagues (Lucchi et al. 2012) have recently used ray descriptors and the gray-level histogram as the key features to classify 3D image supervoxels. The result of this classification is further regularized using graph cuts to minimize an energy function involving learned potentials. They used stacks of FIB/SEM images from the hippocampus and striatum that had isotropic resolution. In their method, isotropy is an essential requirement for the computation of the 3D supervoxel over-segmentation. Alternatively, Giuly and colleagues (Giuly et al. 2012) segment mitochondria in anisotropic stacks of images obtained by SBFSEM. They use a random forest classifier to label 2D image patches. The result of this initial segmentation is further refined using 2D contour classification across images and 3D level-set surface evolution. Their method, however, is computationally intensive, requiring long processing times Regarding synapses, the popular Ilastik toolbox (Sommer et al. 2011) used by (Kreshuk et al. 2011) to segment synaptic junctions uses a random forest classifier with a set of differential image features. They use a simple regularization strategy based on Gaussian smoothing. Overall, the resulting algorithm is also very demanding in terms of computing power. Our method does not require isotropic voxels so it can be applied to image stacks that have been acquired with different resolution in the X, Y and Z axes. The results obtained with our method were similar or better than those <u>1</u> | _T_ | _t_ ∈ _T_ ��#CC[size≥ _t_ ] − GT�� _,_ (25) where #CC[size≥ _t_ ] is the number of connected components with size ≥ _t_, and GT is the real count. Table 4 shows that our method has smaller errors than Ilastik for all datasets and considered structures. Table 4 Average absolute error of estimations of the number of mitochondria and synaptic junctions over all thresholds in the range [10 _,_ 2000] voxels Method CCDB-8192 Mit&Syn, Mit Mit&Syn, Syn Ilastik (Sommer et al. 2011) 12.12 68.44 166.17 Ours 10.71 54.97 161.76 ( ) obtained with the Cytoseg process (Giuly et al. 2012) for mitochondria only, and to those obtained with Ilastik for both mitochondria only and simultaneous mitochondria and synaptic junctions. Other approaches such as the one from (Lucchi et al. 2012) are not ready to work with anisotropic stacks and therefore our method outperforms them. Unlike Cytoseg, that focuses on mitochondria segmentation, our method is not tied to a specific type of cellular structure but can be used to segment a variety of structures. When compared to Ilastik we obtained better visual results thanks to the regularization and surface smoothing techniques described above. Moreover, our method is much faster than any other approach we have tried. The speed up comes from the Gaussian classifier, that can be trained in _O(Nk_ <sup>2</sup> + _k_ <sup>3</sup> _)_, being _N_ the number of data points and _k_ the dimension of the feature space. For comparison, the complexity of training random forests is _O(MNkd)_, being _M_ the number of trees and _d_ the average depth of the trees. We found in our experiments that the classifier was the main bottleneck of the Ilastik approach. In our approach the most expensive computation was the regularization step, which Ilastik omits. On the other hand, we found no significant difference in speed for feature extraction, taking only a small fraction of the total processing time in all compared methods. For the case of segmentation of 2 labels, a speed of 2.15 seconds per megavoxel in a single thread is fast enough to enable interactive segmentation of the large image stacks that are now available, providing real-time feedback to the user. Of course, parallelization of the proposed approach is straightforward, and it would make it even faster. To our knowledge, no other previous work provides stateof-the-art performance while running in an interactive setting. Conclusions We have presented an algorithm that can be trained to segment a variety of structures in anisotropic EM stacks. In this work we have focused on its capabilities for the segmentation of synaptic junctions and mitochondria. It features some important properties that are not available in other methods in the literature. It uses a graph cut-based image regularization procedure that not only provides better segmentations, but also introduces high level knowledge about the structure of labels. We have solved the limitation of graph cuts in terms of memory requirements with the introduction of energy optimization in overlapping partitions. This allows the regularization of very large stacks. The surface smoothing step introduces smoothness priors on the segmentation that improves the appearance of three-dimensional renderings of the segmented volumes. Finally, and most importantly, we have also shown that our approach is much faster than any other competing method with a state-of-the-art quantitative segmentation performance. Information Sharing Statement The automatic segmentation method described in this paper is available as a plugin of the imaging processing software Espina. The software and instructions for installing it can be [found at http://cajalbbp.cesvima.upm.es/espina.](http://cajalbbp.cesvima.upm.es/espina) This software provides an efficient multi-thread implementation of the presented algorithm together with an intuitive user interface. After activating the Automatic Segmentation plugin, the user has to segment a few voxels of the target objects manually and receives almost real-time feedback of the results. Additional manual segmentations can be performed until the user is satisfied with the final results. Quantitative data regarding the segmented objects are then obtained with standard Espina tools. Acknowledgements This work was supported by funding from the Spanish Ministry of Economy and Competitiveness (grants TIN201347630-C2-2-R to L.B. and BFU2012-34963 to J.DF.), CIBERNED (CB06/05/0066 to J.DF.), the Cajal Blue Brain Project, Spanish partner of the Blue Brain Project initiative from EPFL (to J.DF. and L.B.) and the European Union Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 604102 (Human Brain Project) to J.DF. Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. References Anton-Sanchez, L., Bielza, C., Merch´an-P´erez, A., Rodr´ıguez, J.-R., DeFelipe, J., & Larra˜naga, P. (2014). Three-dimensional distribution of cortical synapses: A replicated point pattern-based analysis. _Frontiers in Neuroanaty_, _8_ [, 85. doi:10.3389/fnana.2014.00085.](http://dx.doi.org/10.3389/fnana.2014.00085) Becker, C.J., Ali, K., Knott, G., & Fua, P. (2013). Learning Context Cues for Synapse Segmentation. _IEEE_ _Transactions_ _on_ _Medical_ _Imaging_, _32_ [(10), 1864–1877. doi:10.1109/Tmi.2013.2267747.](http://dx.doi.org/10.1109/Tmi.2013.2267747) Boykov, Y., Veksler, O., & Zabih, R. (2001). Fast approximate energy minimization via graph cuts. _IEEE_ _Transactions_ _on_ _Pat-_ _tern_ _Analysis_ _and_ _Machine_ _Intelligence_ _(PAMI)_, _23_ (11), 1222– 1239. DeFelipe, J. (2010). From the connectome to the synaptome: An epic love story. _Science_, _330_ (6008), 1198–1201. Denk, W., & Horstmann, H. (2004). Serial block-face scanning electron microscopy to reconstruct three-dimensional tissue nanostructure. _PLoS_ _biology_, _2_ (11), e329. [doi:10.1371/jour-](http://dx.doi.org/10.1371/journal.pbio.0020329) [nal.pbio.0020329.](http://dx.doi.org/10.1371/journal.pbio.0020329) Giuly, R., Martone, M., & Ellisman, M. (2012). Method: Automatic segmentation of mitochondria utilizing patch classification, contour pair classification, and automatically seeded level sets. _BMC_ _Bioinformatics_, _13_ [(1), 29+. doi:10.1186/1471-2105-13-29.](http://dx.doi.org/10.1186/1471-2105-13-29) Haindl, M., & Mikes, S. (2008). Texture segmentation benchmark. In _ICPR,_ _IEEE_ (pp. 1–4). [http://dblp.uni-trier.de/db/conf/icpr/](http://dblp.uni-trier.de/db/conf/icpr/icpr2008.html#HaindlM08a) [icpr2008.html#HaindlM08a.](http://dblp.uni-trier.de/db/conf/icpr/icpr2008.html#HaindlM08a) Jagadeesh, V., Anderson, J., Jones, B., Marc, R., Fisher, S., & Manjunath, B. (2013). Synapse classification and localization in electron micrographs. Pattern Recognition Letters. [doi:10.1016/j.patrec.2013.06.001.](http://dx.doi.org/10.1016/j.patrec.2013.06.001) Jurrus, E., Hardy, M., Tasdizen, T., Fletcher, P.T., Koshevoy, P., Chien, C.B., Denk, W., & Whitaker, R. (2009). Axon tracking in serial block-face scanning electron microscopy. _Medical Image Analysis_, _13_ (1), 180–188. [doi:10.1016/j.media.2008.05.002.](http://dx.doi.org/10.1016/j.media.2008.05.002) Includes Special Section on Medical Image Analysis on the 2006 Workshop Microscopic Image Analysis with Applications in Biology. Knott, G., Marchman, H., Wall, D., & Lich, B. (2008). Serial section scanning electron microscopy of adult brain tissue using focused ion beam milling. _Journal_ _of_ _Neuroscience_, _28_ (12), 2959–2964. [doi:10.1523/JNEUROSCI.3189-07.2008.](http://dx.doi.org/10.1523/JNEUROSCI.3189-07.2008) Kreshuk, A., Straehle, C., Sommer, C., Koethe, U., Cantoni, M., Knott, G., & Hamprecht, F. (2011). Automated detection and segmentation of synaptic contacts in nearly isotropic serial electron microscopy images. PLoS ONE, _6_ [, e24899. doi:10.1371/jour-](http://dx.doi.org/10.1371/journal.pone.0024899) [nal.pone.0024899.](http://dx.doi.org/10.1371/journal.pone.0024899) Lempitsky, V.S. (2010). Surface extraction from binary volumes with higher-order smoothness. In _Proc._ _International_ _Confer-_ _ence on Computer Vision and Pattern Recognition (CVPR), IEEE_ (pp. 1197–1204). [http://dblp.uni-trier.de/db/conf/cvpr/cvpr2010.](http://dblp.uni-trier.de/db/conf/cvpr/cvpr2010.html#Lempitsky10) [html#Lempitsky10.](http://dblp.uni-trier.de/db/conf/cvpr/cvpr2010.html#Lempitsky10) Lucchi, A., Smith, K., Achanta, R., Knott, G., & Fua, P. (2012). Supervoxel-based segmentation of mitochondria in em image stacks with learned shape features. _IEEE Transactions on Medical_ _Imaging_, _31_ (2), 474–486. [http://dblp.uni-trier.de/db/journals/tmi/](http://dblp.uni-trier.de/db/journals/tmi/tmi31.html#LucchiSAKF12) [tmi31.html#LucchiSAKF12.](http://dblp.uni-trier.de/db/journals/tmi/tmi31.html#LucchiSAKF12) Martin, D., Fowlkes, C., Tal, D., & Malik, J. (2001). _A_ _database_ _of_ _human_ _segmented_ _natural_ _images_ _and_ _its_ _application_ _to_ _evaluat-_ ( ) _ing_ _segmentation_ _algorithms_ _and_ _measuring_ _ecological_ _statistics_ (Vol. 2, pp. 416–423). McBride, H.M., Neuspiel, M., & Wasiak, S. (2006). Mitochondria: More than just a powerhouse. _Current_ _Biology_, _16_ (14), R551– [R560. doi:10.1016/j.cub.2006.06.054.](http://dx.doi.org/10.1016/j.cub.2006.06.054) Merchan-Perez, A., Rodriguez, J.R., Alonso-Nanclares, L., Schertel, A., & DeFelipe, J. (2009). Counting synapses using FIB/SEM microscopy: a true revolution for ultrastructural volume reconstruction. _Frontiers_ _in_ _Neuroanatomy_, _3_ (18). [doi:10.3389/neuro.05.018.2009.](http://dx.doi.org/10.3389/neuro.05.018.2009) [http://www.frontiersin.org/](http://www.frontiersin.org/neuroanatomy/10.3389/neuro.05.018. 2009/abstract) [neuroanatomy/10.3389/neuro.05.018.2009/abstract.](http://www.frontiersin.org/neuroanatomy/10.3389/neuro.05.018. 2009/abstract) Morales, J., Alonso-Nanclares, L., Rodriguez, J.R., Defelipe, J., Rodriguez, A., & Merchan-Perez, A. (2011). Espina: a tool for the automated segmentation and counting of synapses in large stacks of electron microscopy images. _Frontiers_ _in_ _Neuroanatomy_, _5_ (18). Narasimha, R., Ouyang, H., Gray, A., McLaughlin, S.W., & Subramaniam, S. (2009). Automatic joint classification and segmentation of whole cell 3d images. _Pattern_ _Recognition_, _42_ (6), [1067–1079. doi:10.1016/j.patcog.2008.08.009.](http://dx.doi.org/10.1016/j.patcog.2008.08.009) Navlakha, S., Suhan, J., Barth, A.L., & Bar-Joseph, Z. (2013). A high-throughput framework to detect synapses in electron microscopy images. _Bioinformatics_ _29_, _13_, i9–i17. [doi:10.1093/bioinformatics/btt222.](http://dx.doi.org/10.1093/bioinformatics/btt222) Santos, R.X., Correia, S.C., Wang, X., Perry, G., Smith, M.A., Moreira, P.I., & Zhu, X. (2010). Alzheimer’s disease: diverse aspects of mitochondrial malfunctioning. _Interna-_ _tional_ _Journal_ _of_ _Clinical_ _and_ _Experimental_ _Pathology_, _3_, 570–581. Sommer, C., Straehle, C., Kothe, U., & Hamprecht, F. (2011). Ilastik: Interactive learning and segmentation toolkit. In _IEEE_ _Interna-_ _tional_ _Symposium_ _on_ _Biomedical_ _Imaging:_ _From_ _Nano_ _to_ _Macro_ [(pp. 230–233). doi:10.1109/ISBI.2011.5872394.](http://dx.doi.org/10.1109/ISBI.2011.5872394) Turaga, S.C., Murray, J.F., Jain, V., Roth, F., Helmstaedter, M., Briggman, K., Denk, W., & Seung, H.S. (2010). Convolutional networks can learn to generate affinity graphs for image segmentation. _Neural Computation_, _22_, 511–538.

섹션 본문 129문단 · 81,430자

(제목 없음)

1Recent electron microscopy (EM) imaging techniques permit the automatic acquisition of a large number of serial sections from brain samples. Manual segmentation of these images is tedious, time-consuming and requires a high degree of user expertise. Therefore, there is considerable interest in developing automatic segmentation methods. However, currently available methods are computationally demanding in terms of computer time and memory usage, and to work properly many of them require image stacks to be isotropic, that is, voxels must have the same size in the X, Y and Z axes. We present a method that works with anisotropic voxels and that is computationally efficient allowing the segmentation of large image stacks. Our approach involves anisotropy-aware regularization via conditional random field inference and surface smoothing Electronic supplementary material The online version of this article (techniques to improve the segmentation and visualization. We have focused on the segmentation of mitochondria and synaptic junctions in EM stacks from the cerebral cortex, and have compared the results to those obtained by other methods. Our method is faster than other methods with similar segmentation results. Our image regularization procedure introduces high-level knowledge about the structure of labels. We have also reduced memory requirements with the introduction of energy optimization in overlapping partitions, which permits the regularization of very large image stacks. Finally, the surface smoothing step improves the appearance of three-dimensional renderings of the segmented volumes.

Introduction

2The availability of technologies such as combined Focused Ion Beam milling/Scanning Electron Microscopy (FIB/SEM) and Serial Block-Face Scanning Electron Microscopy (SBFSEM) for the study of biological tissues permits the automated acquisition of large numbers of serial sections from brain samples (see for example (Denk and Horstmann 2004;Knott et al. 2008;Merchan-Perez et al. 2009)). These three-dimensional samples contain invaluable structural information that must be extracted from the stack of serial images. Electron micrographs of nervous tissue typically show a large variety of structures, such as neuronal and glial processes with their corresponding cytoplasmic organelles (e.g., vesicles, tubules, filaments and mitochondria) and synapses. From a practical point of view, manual segmentation of these structures is a difficult and time-consuming task that requires a high degree of expertise. As a consequence, much effort has been devoted to the development of automated algorithms.

3Brain images produced by electron microscopy (EM) are very complex and noisy with strong gray-level gradients that do not always correspond to region boundaries. Moreover, different neuronal structures may have similar local image appearance. Hence, it is extremely difficult to develop a fully automated segmentation algorithm. Although automated image processing techniques have addressed the problem of membrane detection and dendrite reconstruction (Turaga et al. 2010), standard computer vision algorithms used for the segmentation of textures (Haindl and Mikes 2008) or natural images (Martin et al. 2001) perform poorly, and standard techniques for the segmentation of biomedical images such as contour evolution (Jurrus et al. 2009) cannot handle the abundant image gradients.

4Among the various structures visualized with EM, mitochondria and the synaptic junctions are of particular interest to neuroscience. Indeed, most information in the mammalian nervous system flows though chemical synapses. Thus, the quantification and measurement of synapses is a major goal in the study of brain synaptic organization in both health and disease (DeFelipe 2010). Mitochondria are organelles that produce most of the cell's supply of adenosine triphosphate (ATP) which transports chemical energy within cells for metabolism. In addition to supplying cellular energy, mitochondria are involved in many other crucial cellular physiological tasks (e.g., McBride et al. 2006) and their alterations have been associated with a number of diseases such as Alzheimer's disease (e.g., Santos et al. 2010). Therefore, substantial effort has been put into developing methods for accurate segmentation of synapses and mitochondria in the brain.

5Although there are good practical synapse segmentation approaches relying on semi-automated tools (Morales et al. 2011), recent research has focused on machine learning approaches to diminish the degree of user interaction. (Becker et al. 2013) introduced a synaptic junction segmentation approach specifically designed for isotropic resolution image stacks, that is, stacks where voxel dimensions were identical in all X, Y and Z-axes. This method is based on a boosting algorithm that discovers local context cues related to the presence of the synaptic junction. The local context around potential synapse-like regions is also used in (Jagadeesh et al. 2013). However, the approach of Jagadeesh et al. relies on a computationally demanding set of image features that require up to 12 hours of computing time in a 32-node cluster. An alternative way of detecting synapses is by selectively staining them with ethanolic phosphotungstic acid (Navlakha et al. 2013), although this obscures other subcellular details and the tissue preservation is not appropriate for detailed ultrastructural analysis. Finally, (Kreshuk et al. 2011) used the Ilastik toolbox to segment synaptic junctions.

6Several algorithms have been specifically designed to segment mitochondria in EM images. A texton-based approach comparing K-NN, SVM and AdaBoost classifiers was proposed (Narasimha et al. 2009). Lucchi and colleagues (Lucchi et al. 2012) later introduced an algorithm using as input 3D supervoxels and assuming almost isotropic image stacks. A different approach has been presented by Giuly and colleagues (Giuly et al. 2012). Their method performs the segmentation of mitochondria in anisotropic stacks of images. However, it is computationally very expensive and requires long processing times.

7Consequently, our aim was to develop a method that does not require isotropic voxels and that is computationally efficient to allow the interactive segmentation of large image stacks that are now available. Moreover, our approach also involves image regularization and surface smoothing techniques to improve the segmentation.

Material & Methods

8For the development of our segmentation algorithm we have used FIB/SEM image stacks that have been acquired in our laboratory from the rat somatosensory cortex (Merchan-Perez et al. 2009;Anton-Sanchez et al. 2014). The resolution was always the same in the X and Y axes and ranged from 3.7 nm per pixel to 14.7 nm per pixel. Resolution in the Z axis, equivalent to section thickness, was in all cases 20 nm per pixel. The stacks were thus anisotropic, that is, they did not have the same resolution in all three axes. Our segmentation algorithm has been specifically designed to take anisotropy into account, and we define the anisotropy factor as:

9Voxel size in the Z axis Voxel size in the X (or Y) axis (1) Thus, our stacks had anisotropy factors ranging from 5.41 to 1.36. To make our method comparable to others, we used an additional stack of SBFSEM images available online with an anisotropy factor ρ = 5.

Description of the Segmentation Algorithm

10Our algorithm learns to detect and segment potentially any type of structure from the visual information in a stack of FIB/SEM or SBFSEM images, although in this work we have focused on synaptic junctions and mitochondria. To this end, the algorithm must be trained by providing samples of segmented structures. The user provides these samples in an interactive way using an in-house application we have developed: first, a few voxels are manually labeled as mitochondria, for example, using standard tools such as the two or threedimensional brush. The system then performs an automatic segmentation based on the training given, thus providing visual feedback. The user then refines the training by labeling new samples in the areas where the automatic segmentation is wrong. This procedure is repeated until the results are satisfactory (see Fig. 1).

11Our automatic segmentation algorithm has three steps: feature extraction, voxel-wise classification and regularization. An optional fourth step, smoothing, enhances the visual appearance of the segmentation when it is rendered in 3D.

Feature Extraction

12Feature extraction is performed on all voxels in the stack. The features of a voxel are a vector of real numbers that concisely describe the relevant visual information in the vicinity of that voxel. A feature extractor is a function from the space of EM stacks to the space of feature stacks. We have developed two feature extractors, F2D and F3D, which aggregate visual information around each voxel at several scales, and are rotationally invariant and robust to the noise present in EM images. F3D is a feature extractor that takes into account three-dimensional neighborhoods around each voxel. It is adequate for isotropic stacks. F2D, on the other hand, extracts a feature vector for each pixel in an image of the stack considering visual information of a neighborhood of the pixel in that slice and ignoring the information in other slices. F2D is a feature extractor that is suitable for anisotropic stacks. In the paragraphs that follow, we first describe F2D and then introduce F3D as a generalization.

13F2D works on each image of the stack separately. Hence we only consider a single image I in the following description. F2D first applies a set of linear operators (zero, first and second order derivatives) to the smoothed image I at several scales. Thus, the set of linear operators at a scale σ is

14where G σ is a Gaussian filter of radius σ and * is the convolution operator. The response to these operators will be noted as s 00 , s 10 , s 01 , s 20 , s 11 and s 02 (note that the subscripts denote the order of the derivatives). With these responses to the filters at a scale σ , we can compute a partial feature vector for the pixels of I at that scale. This partial feature vector has four components:

15where s 00 is the smoothed image, s 2 10 + s 2 01 is the gradient magnitude and λ 1 and λ 2 are the first and second eigenvalues of the Hessian matrix, that are computed as

16(5) Figure 2 shows the components of a partial feature vector at a fixed scale for all the pixels in a single image. The complete feature vector for each pixel is the concatenation of several partial feature vectors. We apply this procedure at n different scales {σ 0 , . . . , σ n−1 }, producing a feature vector with 4n components for each pixel in I . The set of scales should match the size of the structures that have to be detected in the images. In practice, the user only sets the initial scale σ 0 , which we call the base scale, and the rest of scales are given by σ i = 2 1 2 i σ 0 . For example, if we use n = 4 scales and set the smallest scale to σ 0 = 4 pixels, our feature vectors will have 16 dimensions and they will range from 4 to 11.31 pixels in scale.

17F3D is a generalization of F2D for isotropic image stacks. As in F2D, the set of linear operators with the zero, first and second order derivatives at a given scale σ , Fig. 1 Workflow of the segmentation algorithm. The input stack of serial images is subjected to four successive steps, two of which can be interactively modified by the user Fig. 2 Feature extraction from a single image. In this example, feature extraction has been performed at a scale σ = 4 pixels. The resulting partial feature vector has four components: the smoothed image (a), the gradient magnitude (b), and the first (c) and second eigenvalues (d) of the Hessian matrices. Feature extraction is also performed at several other scales (not shown) to obtain the complete feature vector is applied to the stack obtaining the responses s ij k : i + j + k ≤ 2 , where i, j and k indicate the order of the derivatives in the X, Y and Z axes. The partial feature vector for each voxel of the stack at a given scale is s 000 , s 2 100 + s 2 010 + s 2 001 , λ 1 , λ 2 , λ 3 ,

18where the first component is the smoothed image, the second one is the magnitude of the gradient, and λ 1 , λ 2 and λ 3 are the eigenvalues of the Hessian matrix ⎛

19Again, the complete feature vector for each voxel is the concatenation of the partial feature vectors at several scales.

Classification

20A classifier uses the feature vectors to determine the probability that a voxel belongs to each label. This classifier has to be trained with labeled data to learn the relationship between feature vectors and labels. Here we briefly present how the classifier is trained and how a trained classifier can be used with new unclassified data. Our classifier learns the probability distribution P (y i | f i (x)) of the label y i for the pixel i given the observed feature vector f i (x). We use the Bayes' rule to express this distribution as a product

21where the conditional p(f i (x) | y i ) is the probability density of the feature vector for voxels with label y i and P (y i ) is the prior probability of a pixel having the label y i . We model the conditional distribution as a Gaussian,

22where the parameters μ y and y are the mean vector and the covariance matrix of the feature vectors for voxels with the label y, and k is the dimension of the feature vector.

23In the training step these parameters are estimated from training data. The user manually labels a few voxels of the stack. During training, the voxels labeled with label y are used to estimate μ y , i.e., the mean of the feature vectors of voxels labeled as y, and y , i.e., the covariance matrix of these feature vectors.

24When the dimension of the feature vectors is large, the training data often falls in a proper subspace of the complete k-dimensional feature space producing a singular or near singular covariance matrix y . We avoid this problem by first performing Principal Component Analysis (PCA)based dimensionality reduction on the cloud of all feature vectors . The dimensionality after the PCA is established to retain 99 % of variance. P (y) is the a priori probability of the label y. It is learned from the user-provided data in the training step. In short, the training step consists of estimating the parameters μ y and y of the conditional distribution (after a PCA-based dimensionality reduction) and the prior P (y) from the userprovided data with the interactive tool.

25Once the classifier is trained, it processes every voxel in the EM stack. For each voxel i with feature vector f i (x), the probability P (y i | f i (x)) is computed for every label y i . This results in a probability map that maps every voxel to the probabilities of belonging to each label. As an example, see Fig. 3a, b.

26In preliminary experiments, we tested other classifiers such as support vector machines. Although these methods improve the results obtained with the Gaussian classifier, their performance is only marginally better at the expense of much higher computational time (in the order of hours vs. seconds), which makes them unsuitable for operation in real time.

Regularization

27If voxels are assumed to be independent of each other, it is possible to segment the stack by simply assigning to each voxel i the label y * with higher probability, i.e., y * = argmax y P (y | x). However, this offers far from optimal results, since the resulting segmentation is noisy, and it shows many sparse pixels, grainy regions and small holes (Fig. 3c, d).

28Therefore, we have to assume some degree of probabilistic dependency between neighboring voxels of the stack. We have modeled this dependency by means of a conditional random field (CRF). A CRF models the distribution P (Y | x) between the set of observed variables x (i.e., the pixel values of the stack of images) and the hidden variables Y = {y 1 , . . . , y N } (i.e., the segmentation labels) in such a way that Y conditioned on x holds the Markov property P (y i | x, Y −i ), where Y −i is the set of label variables without y i , and N(i) are the neighboring voxels of voxel i. The neighborhood function N defines a graph (V , E) with the set of voxels V as nodes and the set of arcs E as given by the pair of voxels related by N. The graph constructed in this way is known as the CRF graph. The Hammersley-Clifford theorem states that the distribution of a CRF can be written as a Gibbs measure, Probability maps obtained by a Gaussian classifier that has been trained with the features extracted from the same image that is shown in Figure 2. The pixel-wise probability of belonging to the label "Mitochondrion" is shown in (a) and the pixel-wise probability of belonging to the label "Synaptic junction" is shown in (b where Z(x, θ) is the partition function, C is the set of cliques in the CRF graph and Y c is the set of variables from Y related to clique c. In other words, the Gibbs measure expresses the distribution as the product of potentials c (note that the potentials are not required to be probability distributions) depending on subsets of the complete set of random variables. The product of all potentials can be written as a weighted sum of factors using the minus logarithm,

29that, when written for a fixed observation x, is known as the energy of the labeling and denoted as E(Y). This energy is a map from the space of labelings to the real numbers. For improbable labelings the energy gives large values, whereas for good, probable labelings it provides lower values.

30Finding the best segmentation with the probability distribution of the CRF, that models some degree of dependency among neighboring voxels, requires maximizing the probability P (Y | x; θ) for a fixed observation x. This is equivalent to minimizing the energy E(Y). Figure 4 depicts the factor graph of our CRF. The factor graph is a bipartite graph that shows the random variables of the CRF graph as circles, as well as the potentials as little black squares. A potential depends on the random variables Fig. 4 Factor graph for the CRF. The random variables are inside circle nodes. Black squares represent potentials depending on the random variables they are connected to. The energy of the CRF is the sum of all potentials. This figure shows only a fragment of a 2D CRF, but the generalization to 3D is straightforward that it is connected to. Therefore, the given factor graph represents the following factorization of our distribution:

31There are two kinds of potentials in this graph. The first kind of potential is associated with the terms φ i (y i , x). We will call them unary terms, since they only depend on a single variable y i for a fixed observation in the energy function. The second kind of potential is related to the terms φ ij (y i , y j ). In an analogous way, we will call them pair-wise terms, since they depend on pairs of label variables.

32Training a CRF consists of determining its parameters θ . This tends to be a complex task, especially if the CRF has many parameters, as in our case. We therefore need to simplify it further. A very common and reasonable assumption is that the CRF is translation and orientation invariant, and as a consequence all of the parameters for a kind of term (unary or pairwise) share the same value. This would lead to the energy function:

33Unfortunately, in non-isotropic stacks we cannot assume orientation invariance. Usually, the stack has a lower resolution in the Z axis than in the X and Y axes. Therefore, we must treat the pair-wise terms that are oriented in the Z axis in a different way. We divide the set E into two disjoint subsets, E XY and E Z , for the edges oriented along the X and the Y axes and for the edges oriented along the Z axis, respectively. The energy is now:

34Finally, since we are interested in the minimum energy, we can multiply the energy by 1 θ 1 and the solution remains unchanged:

35This energy has only two parameters, θ XY and θ Z , which control the strength of the regularization in the XY plane and in the Z axis. In an anisotropic stack we can assume that θ XY and θ Z are related by the expression θ Z = θ XY ρ , and The unary and pair-wise terms have to be defined in such a way that they provide lower values for good, probable inputs. The unary terms φ i (y i , x) are responsible for introducing the observed data into the energy value. It is customary to define the unary terms as the minus logarithm of the probability that our trained classifier provides: φ i (y i , x) = − log P (y i | f i (x)). This definition is justified since, in the absence of the pair-wise terms, the CRF would lead to the segmentation given by the classifier acting on each voxel separately. Example of a smoothed surface that meets the constraints imposed by the segmentation. The red and blue dots indicate the pixels that are inside and outside the object, respectively. The green and blue contours are the maximum and minimum area contours, respectively. Although there are infinite contours that would lie between them, we look for the smoothed minimum curvature contour depicted in red

36The role of the pair-wise terms φ ij (y i , y j ) is twofold. First, they regularize the segmentation results by penalizing Fig. 8 Example of a branching mitochondrion. A large branching mitochondrion is shown before (a) and after smoothing (b) the change of labels between neighboring voxels. This prevents the occurrence of isolated pixels and small holes that could appear (Fig. 3c, d). Second, they serve to introduce some extent of high-order knowledge about the structure of the stack. For example, we could impose the condition that synaptic junctions and mitochondria cannot touch each other, by setting a very large penalty to that label change in our experiments.

37Therefore, the pair-wise terms are assigned as follows. A low penalty 1 is given to pairs of labels that are allowed to be neighbors. Second, a very high penalty ∞ is assigned to pairs of labels that cannot be adjacent (e.g., synaptic junctions and mitochondria). Third, no penalty is given for pairs of neighboring pixels with the same label. The distance matrix between labels background (bg), synaptic junction (syn) and mitochondria (mit) is therefore: bg syn mit bg syn mit

38Once we have defined our energy, we need to find the segmentation that minimizes the energy function, Y * = argmin Y E(Y). This is in general an NP-hard optimization problem. However, it is known that when the terms are up to order two, i.e., there are only pair-wise (order 2) and unary (order 1) terms, the number of labels is two b a d c Fig. 10 Segmentation of mitochondria in a 700 × 700 × 50 stack of EM serial images. The left column shows four individual, nonconsecutive images from the stack. The second column shows ground truth data, manually segmented by an expert. The two rightmost columns show the results obtained with our algorithm using a base scale σ 0 = 6 and two different sets of regularization parameters θ XY and θ Z . and the pair-wise terms are submodular, i.e., φ(y i , y i ) + φ(y j , y j ) ≤ φ(y i , y j ) + φ(y j , y i ), then a max-flow/mincut algorithm finds the global optimum of the energy in polynomial time.

39Unfortunately, when there are more than two labels, the max-flow algorithm is no longer applicable. Instead, we have to rely on approximate energy minimization using the αβ-swap algorithm from (Boykov et al. 2001). Figure 3c, d shows the segmentation of a single image after the αβ-swap regularization. Figure 5 shows the segmentation of a whole stack of serial EM images.

40The graph-cut techniques needed for regularization require a considerable amount of computer memory. For a reasonably sized stack, the required memory usage usually becomes too big. Therefore we need to regularize parts of the full stack separately and merge them together at the end.

41A simple approach is to divide the stack into disjoint, i.e., non-overlapping substacks and regularize them separately. This method works well for the inner areas of each substack, but it looks jumpy in their boundaries, since the CRF does not have enough context to determine the correct labels. This is visually noticeable as abrupt terminations of mitochondria and synaptic junctions at these boundaries.

42The solution to this problem consists of extending each substack with a margin, effectively making the new Table 1 Comparative results for mitochondria detection performed by our algorithm with two different sets of regularization parameters, by Ilastik , and by the Cytoseg process, according to (Giuly et al. 2012 extended substacks overlap with their neighbors. The regularization is then applied to the extended substacks, but only the results obtained in the original substack volume are preserved in the final segmentation (Fig. 6).

43Determining the optimal size of the margin is a problem beyond the scope of this paper. However, we have found that a margin of 10 voxels in each direction offers very good results in practice. Finally, the size of the substacks is limited by the available memory. As a rule of thumb, the regularization process takes 5 or 6 times the memory used by the original substack being regularized.

Segmentation Smoothing

44The segmentation we obtain consists of hard label assignments to each voxel of the stack. This is suitable for several tasks such as counting of labeled objects or the estimation of the volume of the segmented objects, but presents disadvantages concerning the visualization of their surfaces. We use the marching cubes algorithm to extract the surfaces of the objects from the labels in the segmentation volume. This process not only produces unpleasant and unnatural renderings, but also biases the area estimates. Therefore we need to smooth the surfaces, but at the same time we want to preserve the constraints imposed by the labels in the segmentation volume. Among the infinite surfaces that meet these constraints, we compute the surface that minimizes curvature (see Fig. 7). To this end, we have adapted the method described by (Lempitsky 2010) to anisotropic stacks.

45First, we build a vector of constraints {v i } N i=1 ∈ {−1, 1} N such as v i = 1 if the voxel i is inside an object and v i = −1 if it is outside an object, i.e., if it has the background label. We find a real-valued vector The minimization of the above functional smooths the segmentation result. In an anisotropic discrete setting, the smoothing problem becomes

46where

47is a vector of margins imposing the deviations from zero of f at each point. m i is 0 if i is at the boundary of an object (i.e., if v i and v j for any of the neighbors j of i have different values) and 1 everywhere else. Here we have included factor ρ in the second derivative along the Z-axis to account for the anisotropy of the stack. The Eqs. (18) and (19) constitute a convex quadratic program that can be solved with the Jacobi method with a slight modification to include the constraints in the algorithm (Lempitsky 2010). Figure 8 shows a mitochondrion before and after smoothing with this method.

48Note that this smoothing only affects the estimated surfaces and, therefore, the rendering of these surfaces. The segmentation volume and the numerical results extracted from it are not affected by this procedure. Therefore, the quantitative comparisons offered in the Section "Results" are computed with no smoothing.

Results

49As explained in the previous section, we conceived our algorithm to be used interactively. However, to evaluate its performance we have used two datasets that have been fully segmented manually. We need these manual segmentations as ground-truth data to validate our results and compare them to others. Moreover, given that we have enough training data, we use them to find optimum values for the base scale σ 0 and the regularization term σ XY .

50We have used several voxel-based metrics to evaluate the quality of the segmentations. Voxel-based metrics measure the error rates in voxel classification taking into account true positive (TP), true negative (TN), false positive (FP) and false negative (FN) classifications. Unless otherwise stated, all running times were obtained on a Linux system with an Intel Xeon at 2.40GHz with no GPU processing. Our algorithm is mostly implemented in Python using the NumPy library. The inner parts of the CRF regularization are written in C++. Our implementation runs in a single thread. Fig. 12 Simultaneous segmentation of mitochondria and synaptic junctions. The left column shows the original images; the center left column is the ground-truth; the center right column is the result obtained with Ilastik; the right column is the result of our algorithm with parameters σ 0 = 2; θ XY = 4; θ Z = 2.94. The first row shows a full slice. The second and third rows show zoomed regions of different slices for detail Our method EM serial images Ground-truth Ilastik ( σ 0 = 2; θ XY = 4)

Mitochondria Segmentation

51We used a stack of serial EM images from the mouse cerebellum to test our method for the segmentation of mitochondria. This stack is available online in the Cell Centered Database 1 with ID 8192. We have selected this stack to make our method comparable with Cytoseg, an automatic segmentation tool proposed by (Giuly et al. 2012). These researchers provide the raw images as well as a manual segmentation of mitochondria at the Cytoseg web page. 2 The stack has a size of 700 × 700 × 50 voxels and a voxel size of 10 × 10 × 50 nm (anisotropy factor ρ = 5). We have applied our method to automatically detect the mitochondria in this stack.

52The stack was divided into 5 sets of 10 images and we used 5-fold cross-validation to estimate the quality of the segmentation for different pairs of values of σ 0 and θ XY . Values of σ 0 ranged from 2 to 20 and values of θ XY ranged from 0 to 20. Figure 9 plots the TPR, FPR, ACC and JAC metrics obtained. The curves show that the base scale for feature extraction σ 0 is much more critical for the quality of the segmentations than the regularization penalty θ XY . In fact, the regularization penalty is almost irrelevant for the quantitative measurements, but it is much more important in the visual or qualitative results (see Fig. 10).

53From the results of the cross-validation process, we choose σ 0 = 6 as it offers a good trade-off between the considered metrics. For the regularization parameter θ XY , we select two different values: 10 and 20. The parameter θ Z = θ XY ρ is set to 2 and 4, respectively. After choosing the parameters, we apply our segmentation algorithm to the full stack. We used the last 10 slices of the stack for training. The results obtained with our method are similar to those obtained with the Cytoseg process (see Table 1). However, Cytoseg (Giuly et al. 2012) required 80 minutes of processing time for a stack of 350 × 350 × 30 according to their paper, while our algorithm took 53.8 seconds for the segmentation of a 700×700×50 stack (training takes 9.6 seconds and the complete stack labeling, including CRF regularization, 44.2 seconds).

54We also applied the software Ilastik ( , www.ilastik.org) to segment mitochondria in this dataset. The quantitative results obtained in Ilastik (see Table 1) are comparable to those of the other methods. However, Ilastik took 56.5 minutes for processing the full stack using 8 threads, resulting in a total of 452 minutes of CPU. This is about 500 times slower than our method.

55Other methods for mitochondria segmentation are even less suitable for large anisotropies. Supervoxel segmentation with learned shape features (Lucchi et al. 2012) aims to learn non-local shapes of the target objects to segment. They use a combination of supervoxels, 3D ray features and structured prediction. 3D ray features are specially affected by anisotropy since both the edge detector and the length of the rays are highly dependent on the orientation. The achievable segmentation accuracy -i.e., the highest accuracy that can be achieved using supervoxels assuming perfect classification of each supervoxel-drops significantly with anisotropy. Moreover, the structured prediction requires training with a large portion of the stack fully labeled in order to infer the terms of the pairwise interaction. As a consequence of these factors, the method from (Lucchi et al. 2012) required more training data (half of the stack) to work properly, and provided rather unsatisfactory results with low Jaccard indices (< 0.48). The running times were also higher (> 21 minutes) due mainly to the cost of extraction of the ray features.

Mitochondria and Synaptic Junctions Segmentation

56For this test we used a stack of 366 × 494 × 213 voxels and a voxel size of 14.7 × 14.7 × 20 nm (ρ = 1.36) acquired from the rat somatosensory cortex. We used the first 100 slices of the stack to estimate the parameters of the algorithm with 5-fold cross-validation. The results of the cross-validation are plotted in Fig. 11. Again, the base scale σ 0 had a critical impact on performance, whereas the regularization penalty θ XY only caused subtle variations. Note that we were segmenting three different classes (background, mitochondria and synapses) and therefore we measured the quality of segmentations with mitochondria-vs-rest and synapses-vs-rest metrics, i.e., considering one of the classes as foreground and the rest as background.

57From the results of cross-validation, we chose σ 0 = 1 and σ 0 = 2 as a trade-off value that worked reasonably well for both mitochondria and synaptic junctions. We set θ XY = 4 and θ Z = θ XY ρ = 2.94. The training was performed using 11 evenly distributed slices of the stack and it took 3.27 seconds to complete. The segmentation of the full stack (213 serial images) took 10.15 minutes (48.31 seconds for the classification step and the rest for regularization). Figure 12 shows the results of our algorithm and Ilastik. Table 2 compares the quantitative performance of both algorithms. The Ilastik performance results were obtained using a very similar manual segmentation to the one used with our algorithm. The results obtained with both methods were similar when considering the numerical performance, with ours being marginally better. However, Ilastik took 56 minutes with 8 threads to train and segment the full stack, making our method 45 times faster. Visual appearance of the final segments were also much better in our case thanks to the regularization procedure (see Fig. 12). Table 3 summarizes running times for our experiments in both datasets. Our method runs much faster compared to the others with similar or better performance. Cytoseg and learned shape features are specialized in mitochondria segmentation; thus, we only report results in the first dataset for those methods.

Running Time Comparison

58There is an important difference in running times for our method in both datasets (2.15 vs. 15.9). This large difference is due to the regularization with > 2 labels, where a single graph-cut is inviable and iterative, slower algorithms such as αβ-swap are required.

Counting Structures

59Estimating the number of structures from the results of an automatic segmentation process is still an open problem with plenty of ongoing research. As an approximate, simple solution, it is commonly assumed that each connected component of the segmentation is one structure. This is the approach we use. Despite its simplicity, it has To alleviate these problems, we discard the connected components smaller than a given threshold. Setting the threshold is not trivial, as it might greatly affect the counts depending on the quality of the segmentation. A good segmentation is expected to be more robust to different thresholds than a bad one, i.e., estimations should be close to the real value and should be stable for a large range of thresholds. Figure 13 shows count estimations for different thresholds with both Ilastik and our method. The regularization makes our method more robust: it reduces the number of small components and the estimations of our method are closer to the ground-truth for a wider range of thresholds. Table 4 gives numerical assessment of this idea. It shows the absolute value of the deviations of the estimations from the ground-truth averaged over all thresholds in the range T = [10, 2000] ⊂ Z:

60where #CC [size≥t] is the number of connected components with size ≥ t, and GT is the real count. Table 4 shows that our method has smaller errors than Ilastik for all datasets and considered structures.

Discussion

61Concerning the segmentation of mitochondria, Lucchi and colleagues (Lucchi et al. 2012) have recently used ray descriptors and the gray-level histogram as the key features to classify 3D image supervoxels. The result of this classification is further regularized using graph cuts to minimize an energy function involving learned potentials. They used stacks of FIB/SEM images from the hippocampus and striatum that had isotropic resolution. In their method, isotropy is an essential requirement for the computation of the 3D supervoxel over-segmentation. Alternatively, Giuly and colleagues (Giuly et al. 2012) segment mitochondria in anisotropic stacks of images obtained by SBFSEM. They use a random forest classifier to label 2D image patches. The result of this initial segmentation is further refined using 2D contour classification across images and 3D level-set surface evolution. Their method, however, is computationally intensive, requiring long processing times Regarding synapses, the popular Ilastik toolbox ) used by (Kreshuk et al. 2011) to segment synaptic junctions uses a random forest classifier with a set of differential image features. They use a simple regularization strategy based on Gaussian smoothing. Overall, the resulting algorithm is also very demanding in terms of computing power.

62Our method does not require isotropic voxels so it can be applied to image stacks that have been acquired with different resolution in the X, Y and Z axes. The results obtained with our method were similar or better than those obtained with the Cytoseg process (Giuly et al. 2012) for mitochondria only, and to those obtained with Ilastik for both mitochondria only and simultaneous mitochondria and synaptic junctions. Other approaches such as the one from (Lucchi et al. 2012) are not ready to work with anisotropic stacks and therefore our method outperforms them. Unlike Cytoseg, that focuses on mitochondria segmentation, our method is not tied to a specific type of cellular structure but can be used to segment a variety of structures. When compared to Ilastik we obtained better visual results thanks to the regularization and surface smoothing techniques described above. Moreover, our method is much faster than any other approach we have tried. The speed up comes from the Gaussian classifier, that can be trained in O(Nk 2 + k 3 ), being N the number of data points and k the dimension of the feature space. For comparison, the complexity of training random forests is O(MNkd), being M the number of trees and d the average depth of the trees. We found in our experiments that the classifier was the main bottleneck of the Ilastik approach. In our approach the most expensive computation was the regularization step, which Ilastik omits. On the other hand, we found no significant difference in speed for feature extraction, taking only a small fraction of the total processing time in all compared methods.

63For the case of segmentation of 2 labels, a speed of 2.15 seconds per megavoxel in a single thread is fast enough to enable interactive segmentation of the large image stacks that are now available, providing real-time feedback to the user. Of course, parallelization of the proposed approach is straightforward, and it would make it even faster. To our knowledge, no other previous work provides stateof-the-art performance while running in an interactive setting.

Conclusions

64We have presented an algorithm that can be trained to segment a variety of structures in anisotropic EM stacks. In this work we have focused on its capabilities for the segmentation of synaptic junctions and mitochondria. It features some important properties that are not available in other methods in the literature. It uses a graph cut-based image regularization procedure that not only provides better segmentations, but also introduces high level knowledge about the structure of labels. We have solved the limitation of graph cuts in terms of memory requirements with the introduction of energy optimization in overlapping partitions. This allows the regularization of very large stacks. The surface smoothing step introduces smoothness priors on the segmentation that improves the appearance of three-dimensional renderings of the segmented volumes. Finally, and most importantly, we have also shown that our approach is much faster than any other competing method with a state-of-the-art quantitative segmentation performance.

Information Sharing Statement

65The automatic segmentation method described in this paper is available as a plugin of the imaging processing software Espina. The software and instructions for installing it can be found at http://cajalbbp.cesvima.upm.es/espina. This software provides an efficient multi-thread implementation of the presented algorithm together with an intuitive user interface. After activating the Automatic Segmentation plugin, the user has to segment a few voxels of the target objects manually and receives almost real-time feedback of the results. Additional manual segmentations can be performed until the user is satisfied with the final results. Quantitative data regarding the segmented objects are then obtained with standard Espina tools.

Introduction

66The availability of technologies such as combined Focused Ion Beam milling/Scanning Electron Microscopy (FIB/SEM) and Serial Block-Face Scanning Electron Microscopy (SBFSEM) for the study of biological tissues permits the automated acquisition of large numbers of serial sections from brain samples (see for example (Denk and Horstmann 2004;Knott et al. 2008;Merchan-Perez et al. 2009)). These three-dimensional samples contain invaluable structural information that must be extracted from the stack of serial images. Electron micrographs of nervous tissue typically show a large variety of structures, such as neuronal and glial processes with their corresponding cytoplasmic organelles (e.g., vesicles, tubules, filaments and mitochondria) and synapses. From a practical point of view, manual segmentation of these structures is a difficult and time-consuming task that requires a high degree of expertise. As a consequence, much effort has been devoted to the development of automated algorithms.

67Brain images produced by electron microscopy (EM) are very complex and noisy with strong gray-level gradients that do not always correspond to region boundaries. Moreover, different neuronal structures may have similar local image appearance. Hence, it is extremely difficult to develop a fully automated segmentation algorithm. Although automated image processing techniques have addressed the problem of membrane detection and dendrite reconstruction (Turaga et al. 2010), standard computer vision algorithms used for the segmentation of textures (Haindl and Mikes 2008) or natural images (Martin et al. 2001) perform poorly, and standard techniques for the segmentation of biomedical images such as contour evolution (Jurrus et al. 2009) cannot handle the abundant image gradients.

68Among the various structures visualized with EM, mitochondria and the synaptic junctions are of particular interest to neuroscience. Indeed, most information in the mammalian nervous system flows though chemical synapses. Thus, the quantification and measurement of synapses is a major goal in the study of brain synaptic organization in both health and disease (DeFelipe 2010). Mitochondria are organelles that produce most of the cell's supply of adenosine triphosphate (ATP) which transports chemical energy within cells for metabolism. In addition to supplying cellular energy, mitochondria are involved in many other crucial cellular physiological tasks (e.g., McBride et al. 2006) and their alterations have been associated with a number of diseases such as Alzheimer's disease (e.g., Santos et al. 2010). Therefore, substantial effort has been put into developing methods for accurate segmentation of synapses and mitochondria in the brain.

69Although there are good practical synapse segmentation approaches relying on semi-automated tools (Morales et al. 2011), recent research has focused on machine learning approaches to diminish the degree of user interaction. (Becker et al. 2013) introduced a synaptic junction segmentation approach specifically designed for isotropic resolution image stacks, that is, stacks where voxel dimensions were identical in all X, Y and Z-axes. This method is based on a boosting algorithm that discovers local context cues related to the presence of the synaptic junction. The local context around potential synapse-like regions is also used in (Jagadeesh et al. 2013). However, the approach of Jagadeesh et al. relies on a computationally demanding set of image features that require up to 12 hours of computing time in a 32-node cluster. An alternative way of detecting synapses is by selectively staining them with ethanolic phosphotungstic acid (Navlakha et al. 2013), although this obscures other subcellular details and the tissue preservation is not appropriate for detailed ultrastructural analysis. Finally, (Kreshuk et al. 2011) used the Ilastik toolbox to segment synaptic junctions.

70Several algorithms have been specifically designed to segment mitochondria in EM images. A texton-based approach comparing K-NN, SVM and AdaBoost classifiers was proposed (Narasimha et al. 2009). Lucchi and colleagues (Lucchi et al. 2012) later introduced an algorithm using as input 3D supervoxels and assuming almost isotropic image stacks. A different approach has been presented by Giuly and colleagues (Giuly et al. 2012). Their method performs the segmentation of mitochondria in anisotropic stacks of images. However, it is computationally very expensive and requires long processing times.

71Consequently, our aim was to develop a method that does not require isotropic voxels and that is computationally efficient to allow the interactive segmentation of large image stacks that are now available. Moreover, our approach also involves image regularization and surface smoothing techniques to improve the segmentation.

Material & Methods

72For the development of our segmentation algorithm we have used FIB/SEM image stacks that have been acquired in our laboratory from the rat somatosensory cortex (Merchan-Perez et al. 2009;Anton-Sanchez et al. 2014). The resolution was always the same in the X and Y axes and ranged from 3.7 nm per pixel to 14.7 nm per pixel. Resolution in the Z axis, equivalent to section thickness, was in all cases 20 nm per pixel. The stacks were thus anisotropic, that is, they did not have the same resolution in all three axes. Our segmentation algorithm has been specifically designed to take anisotropy into account, and we define the anisotropy factor as:

73Voxel size in the Z axis Voxel size in the X (or Y) axis (1) Thus, our stacks had anisotropy factors ranging from 5.41 to 1.36. To make our method comparable to others, we used an additional stack of SBFSEM images available online with an anisotropy factor ρ = 5.

Description of the Segmentation Algorithm

74Our algorithm learns to detect and segment potentially any type of structure from the visual information in a stack of FIB/SEM or SBFSEM images, although in this work we have focused on synaptic junctions and mitochondria. To this end, the algorithm must be trained by providing samples of segmented structures. The user provides these samples in an interactive way using an in-house application we have developed: first, a few voxels are manually labeled as mitochondria, for example, using standard tools such as the two or threedimensional brush. The system then performs an automatic segmentation based on the training given, thus providing visual feedback. The user then refines the training by labeling new samples in the areas where the automatic segmentation is wrong. This procedure is repeated until the results are satisfactory (see Fig. 1).

75Our automatic segmentation algorithm has three steps: feature extraction, voxel-wise classification and regularization. An optional fourth step, smoothing, enhances the visual appearance of the segmentation when it is rendered in 3D.

Feature Extraction

76Feature extraction is performed on all voxels in the stack. The features of a voxel are a vector of real numbers that concisely describe the relevant visual information in the vicinity of that voxel. A feature extractor is a function from the space of EM stacks to the space of feature stacks. We have developed two feature extractors, F2D and F3D, which aggregate visual information around each voxel at several scales, and are rotationally invariant and robust to the noise present in EM images. F3D is a feature extractor that takes into account three-dimensional neighborhoods around each voxel. It is adequate for isotropic stacks. F2D, on the other hand, extracts a feature vector for each pixel in an image of the stack considering visual information of a neighborhood of the pixel in that slice and ignoring the information in other slices. F2D is a feature extractor that is suitable for anisotropic stacks. In the paragraphs that follow, we first describe F2D and then introduce F3D as a generalization.

77F2D works on each image of the stack separately. Hence we only consider a single image I in the following description. F2D first applies a set of linear operators (zero, first and second order derivatives) to the smoothed image I at several scales. Thus, the set of linear operators at a scale σ is

78where G σ is a Gaussian filter of radius σ and * is the convolution operator. The response to these operators will be noted as s 00 , s 10 , s 01 , s 20 , s 11 and s 02 (note that the subscripts denote the order of the derivatives). With these responses to the filters at a scale σ , we can compute a partial feature vector for the pixels of I at that scale. This partial feature vector has four components:

79where s 00 is the smoothed image, s 2 10 + s 2 01 is the gradient magnitude and λ 1 and λ 2 are the first and second eigenvalues of the Hessian matrix, that are computed as

80(5) Figure 2 shows the components of a partial feature vector at a fixed scale for all the pixels in a single image. The complete feature vector for each pixel is the concatenation of several partial feature vectors. We apply this procedure at n different scales {σ 0 , . . . , σ n−1 }, producing a feature vector with 4n components for each pixel in I . The set of scales should match the size of the structures that have to be detected in the images. In practice, the user only sets the initial scale σ 0 , which we call the base scale, and the rest of scales are given by σ i = 2 1 2 i σ 0 . For example, if we use n = 4 scales and set the smallest scale to σ 0 = 4 pixels, our feature vectors will have 16 dimensions and they will range from 4 to 11.31 pixels in scale.

81F3D is a generalization of F2D for isotropic image stacks. As in F2D, the set of linear operators with the zero, first and second order derivatives at a given scale σ , Fig. 1 Workflow of the segmentation algorithm. The input stack of serial images is subjected to four successive steps, two of which can be interactively modified by the user Fig. 2 Feature extraction from a single image. In this example, feature extraction has been performed at a scale σ = 4 pixels. The resulting partial feature vector has four components: the smoothed image (a), the gradient magnitude (b), and the first (c) and second eigenvalues (d) of the Hessian matrices. Feature extraction is also performed at several other scales (not shown) to obtain the complete feature vector is applied to the stack obtaining the responses s ij k : i + j + k ≤ 2 , where i, j and k indicate the order of the derivatives in the X, Y and Z axes. The partial feature vector for each voxel of the stack at a given scale is s 000 , s 2 100 + s 2 010 + s 2 001 , λ 1 , λ 2 , λ 3 ,

82where the first component is the smoothed image, the second one is the magnitude of the gradient, and λ 1 , λ 2 and λ 3 are the eigenvalues of the Hessian matrix ⎛

83Again, the complete feature vector for each voxel is the concatenation of the partial feature vectors at several scales.

Classification

84A classifier uses the feature vectors to determine the probability that a voxel belongs to each label. This classifier has to be trained with labeled data to learn the relationship between feature vectors and labels. Here we briefly present how the classifier is trained and how a trained classifier can be used with new unclassified data. Our classifier learns the probability distribution P (y i | f i (x)) of the label y i for the pixel i given the observed feature vector f i (x). We use the Bayes' rule to express this distribution as a product

85where the conditional p(f i (x) | y i ) is the probability density of the feature vector for voxels with label y i and P (y i ) is the prior probability of a pixel having the label y i . We model the conditional distribution as a Gaussian,

86where the parameters μ y and y are the mean vector and the covariance matrix of the feature vectors for voxels with the label y, and k is the dimension of the feature vector.

87In the training step these parameters are estimated from training data. The user manually labels a few voxels of the stack. During training, the voxels labeled with label y are used to estimate μ y , i.e., the mean of the feature vectors of voxels labeled as y, and y , i.e., the covariance matrix of these feature vectors.

88When the dimension of the feature vectors is large, the training data often falls in a proper subspace of the complete k-dimensional feature space producing a singular or near singular covariance matrix y . We avoid this problem by first performing Principal Component Analysis (PCA)based dimensionality reduction on the cloud of all feature vectors . The dimensionality after the PCA is established to retain 99 % of variance. P (y) is the a priori probability of the label y. It is learned from the user-provided data in the training step. In short, the training step consists of estimating the parameters μ y and y of the conditional distribution (after a PCA-based dimensionality reduction) and the prior P (y) from the userprovided data with the interactive tool.

89Once the classifier is trained, it processes every voxel in the EM stack. For each voxel i with feature vector f i (x), the probability P (y i | f i (x)) is computed for every label y i . This results in a probability map that maps every voxel to the probabilities of belonging to each label. As an example, see Fig. 3a, b.

90In preliminary experiments, we tested other classifiers such as support vector machines. Although these methods improve the results obtained with the Gaussian classifier, their performance is only marginally better at the expense of much higher computational time (in the order of hours vs. seconds), which makes them unsuitable for operation in real time.

Regularization

91If voxels are assumed to be independent of each other, it is possible to segment the stack by simply assigning to each voxel i the label y * with higher probability, i.e., y * = argmax y P (y | x). However, this offers far from optimal results, since the resulting segmentation is noisy, and it shows many sparse pixels, grainy regions and small holes (Fig. 3c, d).

92Therefore, we have to assume some degree of probabilistic dependency between neighboring voxels of the stack. We have modeled this dependency by means of a conditional random field (CRF). A CRF models the distribution P (Y | x) between the set of observed variables x (i.e., the pixel values of the stack of images) and the hidden variables Y = {y 1 , . . . , y N } (i.e., the segmentation labels) in such a way that Y conditioned on x holds the Markov property P (y i | x, Y −i ), where Y −i is the set of label variables without y i , and N(i) are the neighboring voxels of voxel i. The neighborhood function N defines a graph (V , E) with the set of voxels V as nodes and the set of arcs E as given by the pair of voxels related by N. The graph constructed in this way is known as the CRF graph. The Hammersley-Clifford theorem states that the distribution of a CRF can be written as a Gibbs measure, Probability maps obtained by a Gaussian classifier that has been trained with the features extracted from the same image that is shown in Figure 2. The pixel-wise probability of belonging to the label "Mitochondrion" is shown in (a) and the pixel-wise probability of belonging to the label "Synaptic junction" is shown in (b where Z(x, θ) is the partition function, C is the set of cliques in the CRF graph and Y c is the set of variables from Y related to clique c. In other words, the Gibbs measure expresses the distribution as the product of potentials c (note that the potentials are not required to be probability distributions) depending on subsets of the complete set of random variables. The product of all potentials can be written as a weighted sum of factors using the minus logarithm,

93that, when written for a fixed observation x, is known as the energy of the labeling and denoted as E(Y). This energy is a map from the space of labelings to the real numbers. For improbable labelings the energy gives large values, whereas for good, probable labelings it provides lower values.

94Finding the best segmentation with the probability distribution of the CRF, that models some degree of dependency among neighboring voxels, requires maximizing the probability P (Y | x; θ) for a fixed observation x. This is equivalent to minimizing the energy E(Y). Figure 4 depicts the factor graph of our CRF. The factor graph is a bipartite graph that shows the random variables of the CRF graph as circles, as well as the potentials as little black squares. A potential depends on the random variables Fig. 4 Factor graph for the CRF. The random variables are inside circle nodes. Black squares represent potentials depending on the random variables they are connected to. The energy of the CRF is the sum of all potentials. This figure shows only a fragment of a 2D CRF, but the generalization to 3D is straightforward that it is connected to. Therefore, the given factor graph represents the following factorization of our distribution:

95There are two kinds of potentials in this graph. The first kind of potential is associated with the terms φ i (y i , x). We will call them unary terms, since they only depend on a single variable y i for a fixed observation in the energy function. The second kind of potential is related to the terms φ ij (y i , y j ). In an analogous way, we will call them pair-wise terms, since they depend on pairs of label variables.

96Training a CRF consists of determining its parameters θ . This tends to be a complex task, especially if the CRF has many parameters, as in our case. We therefore need to simplify it further. A very common and reasonable assumption is that the CRF is translation and orientation invariant, and as a consequence all of the parameters for a kind of term (unary or pairwise) share the same value. This would lead to the energy function:

97Unfortunately, in non-isotropic stacks we cannot assume orientation invariance. Usually, the stack has a lower resolution in the Z axis than in the X and Y axes. Therefore, we must treat the pair-wise terms that are oriented in the Z axis in a different way. We divide the set E into two disjoint subsets, E XY and E Z , for the edges oriented along the X and the Y axes and for the edges oriented along the Z axis, respectively. The energy is now:

98Finally, since we are interested in the minimum energy, we can multiply the energy by 1 θ 1 and the solution remains unchanged:

99This energy has only two parameters, θ XY and θ Z , which control the strength of the regularization in the XY plane and in the Z axis. In an anisotropic stack we can assume that θ XY and θ Z are related by the expression θ Z = θ XY ρ , and The unary and pair-wise terms have to be defined in such a way that they provide lower values for good, probable inputs. The unary terms φ i (y i , x) are responsible for introducing the observed data into the energy value. It is customary to define the unary terms as the minus logarithm of the probability that our trained classifier provides: φ i (y i , x) = − log P (y i | f i (x)). This definition is justified since, in the absence of the pair-wise terms, the CRF would lead to the segmentation given by the classifier acting on each voxel separately. Example of a smoothed surface that meets the constraints imposed by the segmentation. The red and blue dots indicate the pixels that are inside and outside the object, respectively. The green and blue contours are the maximum and minimum area contours, respectively. Although there are infinite contours that would lie between them, we look for the smoothed minimum curvature contour depicted in red

100The role of the pair-wise terms φ ij (y i , y j ) is twofold. First, they regularize the segmentation results by penalizing Fig. 8 Example of a branching mitochondrion. A large branching mitochondrion is shown before (a) and after smoothing (b) the change of labels between neighboring voxels. This prevents the occurrence of isolated pixels and small holes that could appear (Fig. 3c, d). Second, they serve to introduce some extent of high-order knowledge about the structure of the stack. For example, we could impose the condition that synaptic junctions and mitochondria cannot touch each other, by setting a very large penalty to that label change in our experiments.

101Therefore, the pair-wise terms are assigned as follows. A low penalty 1 is given to pairs of labels that are allowed to be neighbors. Second, a very high penalty ∞ is assigned to pairs of labels that cannot be adjacent (e.g., synaptic junctions and mitochondria). Third, no penalty is given for pairs of neighboring pixels with the same label. The distance matrix between labels background (bg), synaptic junction (syn) and mitochondria (mit) is therefore: bg syn mit bg syn mit

102Once we have defined our energy, we need to find the segmentation that minimizes the energy function, Y * = argmin Y E(Y). This is in general an NP-hard optimization problem. However, it is known that when the terms are up to order two, i.e., there are only pair-wise (order 2) and unary (order 1) terms, the number of labels is two b a d c Fig. 10 Segmentation of mitochondria in a 700 × 700 × 50 stack of EM serial images. The left column shows four individual, nonconsecutive images from the stack. The second column shows ground truth data, manually segmented by an expert. The two rightmost columns show the results obtained with our algorithm using a base scale σ 0 = 6 and two different sets of regularization parameters θ XY and θ Z . and the pair-wise terms are submodular, i.e., φ(y i , y i ) + φ(y j , y j ) ≤ φ(y i , y j ) + φ(y j , y i ), then a max-flow/mincut algorithm finds the global optimum of the energy in polynomial time.

103Unfortunately, when there are more than two labels, the max-flow algorithm is no longer applicable. Instead, we have to rely on approximate energy minimization using the αβ-swap algorithm from (Boykov et al. 2001). Figure 3c, d shows the segmentation of a single image after the αβ-swap regularization. Figure 5 shows the segmentation of a whole stack of serial EM images.

104The graph-cut techniques needed for regularization require a considerable amount of computer memory. For a reasonably sized stack, the required memory usage usually becomes too big. Therefore we need to regularize parts of the full stack separately and merge them together at the end.

105A simple approach is to divide the stack into disjoint, i.e., non-overlapping substacks and regularize them separately. This method works well for the inner areas of each substack, but it looks jumpy in their boundaries, since the CRF does not have enough context to determine the correct labels. This is visually noticeable as abrupt terminations of mitochondria and synaptic junctions at these boundaries.

106The solution to this problem consists of extending each substack with a margin, effectively making the new Table 1 Comparative results for mitochondria detection performed by our algorithm with two different sets of regularization parameters, by Ilastik , and by the Cytoseg process, according to (Giuly et al. 2012 extended substacks overlap with their neighbors. The regularization is then applied to the extended substacks, but only the results obtained in the original substack volume are preserved in the final segmentation (Fig. 6).

107Determining the optimal size of the margin is a problem beyond the scope of this paper. However, we have found that a margin of 10 voxels in each direction offers very good results in practice. Finally, the size of the substacks is limited by the available memory. As a rule of thumb, the regularization process takes 5 or 6 times the memory used by the original substack being regularized.

Segmentation Smoothing

108The segmentation we obtain consists of hard label assignments to each voxel of the stack. This is suitable for several tasks such as counting of labeled objects or the estimation of the volume of the segmented objects, but presents disadvantages concerning the visualization of their surfaces. We use the marching cubes algorithm to extract the surfaces of the objects from the labels in the segmentation volume. This process not only produces unpleasant and unnatural renderings, but also biases the area estimates. Therefore we need to smooth the surfaces, but at the same time we want to preserve the constraints imposed by the labels in the segmentation volume. Among the infinite surfaces that meet these constraints, we compute the surface that minimizes curvature (see Fig. 7). To this end, we have adapted the method described by (Lempitsky 2010) to anisotropic stacks.

109First, we build a vector of constraints {v i } N i=1 ∈ {−1, 1} N such as v i = 1 if the voxel i is inside an object and v i = −1 if it is outside an object, i.e., if it has the background label. We find a real-valued vector The minimization of the above functional smooths the segmentation result. In an anisotropic discrete setting, the smoothing problem becomes

110where

111is a vector of margins imposing the deviations from zero of f at each point. m i is 0 if i is at the boundary of an object (i.e., if v i and v j for any of the neighbors j of i have different values) and 1 everywhere else. Here we have included factor ρ in the second derivative along the Z-axis to account for the anisotropy of the stack. The Eqs. (18) and (19) constitute a convex quadratic program that can be solved with the Jacobi method with a slight modification to include the constraints in the algorithm (Lempitsky 2010). Figure 8 shows a mitochondrion before and after smoothing with this method.

112Note that this smoothing only affects the estimated surfaces and, therefore, the rendering of these surfaces. The segmentation volume and the numerical results extracted from it are not affected by this procedure. Therefore, the quantitative comparisons offered in the Section "Results" are computed with no smoothing.

Results

113As explained in the previous section, we conceived our algorithm to be used interactively. However, to evaluate its performance we have used two datasets that have been fully segmented manually. We need these manual segmentations as ground-truth data to validate our results and compare them to others. Moreover, given that we have enough training data, we use them to find optimum values for the base scale σ 0 and the regularization term σ XY .

114We have used several voxel-based metrics to evaluate the quality of the segmentations. Voxel-based metrics measure the error rates in voxel classification taking into account true positive (TP), true negative (TN), false positive (FP) and false negative (FN) classifications. Unless otherwise stated, all running times were obtained on a Linux system with an Intel Xeon at 2.40GHz with no GPU processing. Our algorithm is mostly implemented in Python using the NumPy library. The inner parts of the CRF regularization are written in C++. Our implementation runs in a single thread. Fig. 12 Simultaneous segmentation of mitochondria and synaptic junctions. The left column shows the original images; the center left column is the ground-truth; the center right column is the result obtained with Ilastik; the right column is the result of our algorithm with parameters σ 0 = 2; θ XY = 4; θ Z = 2.94. The first row shows a full slice. The second and third rows show zoomed regions of different slices for detail Our method EM serial images Ground-truth Ilastik ( σ 0 = 2; θ XY = 4)

Mitochondria Segmentation

115We used a stack of serial EM images from the mouse cerebellum to test our method for the segmentation of mitochondria. This stack is available online in the Cell Centered Database 1 with ID 8192. We have selected this stack to make our method comparable with Cytoseg, an automatic segmentation tool proposed by (Giuly et al. 2012). These researchers provide the raw images as well as a manual segmentation of mitochondria at the Cytoseg web page. 2 The stack has a size of 700 × 700 × 50 voxels and a voxel size of 10 × 10 × 50 nm (anisotropy factor ρ = 5). We have applied our method to automatically detect the mitochondria in this stack.

116The stack was divided into 5 sets of 10 images and we used 5-fold cross-validation to estimate the quality of the segmentation for different pairs of values of σ 0 and θ XY . Values of σ 0 ranged from 2 to 20 and values of θ XY ranged from 0 to 20. Figure 9 plots the TPR, FPR, ACC and JAC metrics obtained. The curves show that the base scale for feature extraction σ 0 is much more critical for the quality of the segmentations than the regularization penalty θ XY . In fact, the regularization penalty is almost irrelevant for the quantitative measurements, but it is much more important in the visual or qualitative results (see Fig. 10).

117From the results of the cross-validation process, we choose σ 0 = 6 as it offers a good trade-off between the considered metrics. For the regularization parameter θ XY , we select two different values: 10 and 20. The parameter θ Z = θ XY ρ is set to 2 and 4, respectively. After choosing the parameters, we apply our segmentation algorithm to the full stack. We used the last 10 slices of the stack for training. The results obtained with our method are similar to those obtained with the Cytoseg process (see Table 1). However, Cytoseg (Giuly et al. 2012) required 80 minutes of processing time for a stack of 350 × 350 × 30 according to their paper, while our algorithm took 53.8 seconds for the segmentation of a 700×700×50 stack (training takes 9.6 seconds and the complete stack labeling, including CRF regularization, 44.2 seconds).

118We also applied the software Ilastik ( , www.ilastik.org) to segment mitochondria in this dataset. The quantitative results obtained in Ilastik (see Table 1) are comparable to those of the other methods. However, Ilastik took 56.5 minutes for processing the full stack using 8 threads, resulting in a total of 452 minutes of CPU. This is about 500 times slower than our method.

119Other methods for mitochondria segmentation are even less suitable for large anisotropies. Supervoxel segmentation with learned shape features (Lucchi et al. 2012) aims to learn non-local shapes of the target objects to segment. They use a combination of supervoxels, 3D ray features and structured prediction. 3D ray features are specially affected by anisotropy since both the edge detector and the length of the rays are highly dependent on the orientation. The achievable segmentation accuracy -i.e., the highest accuracy that can be achieved using supervoxels assuming perfect classification of each supervoxel-drops significantly with anisotropy. Moreover, the structured prediction requires training with a large portion of the stack fully labeled in order to infer the terms of the pairwise interaction. As a consequence of these factors, the method from (Lucchi et al. 2012) required more training data (half of the stack) to work properly, and provided rather unsatisfactory results with low Jaccard indices (< 0.48). The running times were also higher (> 21 minutes) due mainly to the cost of extraction of the ray features.

Mitochondria and Synaptic Junctions Segmentation

120For this test we used a stack of 366 × 494 × 213 voxels and a voxel size of 14.7 × 14.7 × 20 nm (ρ = 1.36) acquired from the rat somatosensory cortex. We used the first 100 slices of the stack to estimate the parameters of the algorithm with 5-fold cross-validation. The results of the cross-validation are plotted in Fig. 11. Again, the base scale σ 0 had a critical impact on performance, whereas the regularization penalty θ XY only caused subtle variations. Note that we were segmenting three different classes (background, mitochondria and synapses) and therefore we measured the quality of segmentations with mitochondria-vs-rest and synapses-vs-rest metrics, i.e., considering one of the classes as foreground and the rest as background.

121From the results of cross-validation, we chose σ 0 = 1 and σ 0 = 2 as a trade-off value that worked reasonably well for both mitochondria and synaptic junctions. We set θ XY = 4 and θ Z = θ XY ρ = 2.94. The training was performed using 11 evenly distributed slices of the stack and it took 3.27 seconds to complete. The segmentation of the full stack (213 serial images) took 10.15 minutes (48.31 seconds for the classification step and the rest for regularization). Figure 12 shows the results of our algorithm and Ilastik. Table 2 compares the quantitative performance of both algorithms. The Ilastik performance results were obtained using a very similar manual segmentation to the one used with our algorithm. The results obtained with both methods were similar when considering the numerical performance, with ours being marginally better. However, Ilastik took 56 minutes with 8 threads to train and segment the full stack, making our method 45 times faster. Visual appearance of the final segments were also much better in our case thanks to the regularization procedure (see Fig. 12). Table 3 summarizes running times for our experiments in both datasets. Our method runs much faster compared to the others with similar or better performance. Cytoseg and learned shape features are specialized in mitochondria segmentation; thus, we only report results in the first dataset for those methods.

Running Time Comparison

122There is an important difference in running times for our method in both datasets (2.15 vs. 15.9). This large difference is due to the regularization with > 2 labels, where a single graph-cut is inviable and iterative, slower algorithms such as αβ-swap are required.

Counting Structures

123Estimating the number of structures from the results of an automatic segmentation process is still an open problem with plenty of ongoing research. As an approximate, simple solution, it is commonly assumed that each connected component of the segmentation is one structure. This is the approach we use. Despite its simplicity, it has To alleviate these problems, we discard the connected components smaller than a given threshold. Setting the threshold is not trivial, as it might greatly affect the counts depending on the quality of the segmentation. A good segmentation is expected to be more robust to different thresholds than a bad one, i.e., estimations should be close to the real value and should be stable for a large range of thresholds. Figure 13 shows count estimations for different thresholds with both Ilastik and our method. The regularization makes our method more robust: it reduces the number of small components and the estimations of our method are closer to the ground-truth for a wider range of thresholds. Table 4 gives numerical assessment of this idea. It shows the absolute value of the deviations of the estimations from the ground-truth averaged over all thresholds in the range T = [10, 2000] ⊂ Z:

124where #CC [size≥t] is the number of connected components with size ≥ t, and GT is the real count. Table 4 shows that our method has smaller errors than Ilastik for all datasets and considered structures.

Discussion

125Concerning the segmentation of mitochondria, Lucchi and colleagues (Lucchi et al. 2012) have recently used ray descriptors and the gray-level histogram as the key features to classify 3D image supervoxels. The result of this classification is further regularized using graph cuts to minimize an energy function involving learned potentials. They used stacks of FIB/SEM images from the hippocampus and striatum that had isotropic resolution. In their method, isotropy is an essential requirement for the computation of the 3D supervoxel over-segmentation. Alternatively, Giuly and colleagues (Giuly et al. 2012) segment mitochondria in anisotropic stacks of images obtained by SBFSEM. They use a random forest classifier to label 2D image patches. The result of this initial segmentation is further refined using 2D contour classification across images and 3D level-set surface evolution. Their method, however, is computationally intensive, requiring long processing times Regarding synapses, the popular Ilastik toolbox ) used by (Kreshuk et al. 2011) to segment synaptic junctions uses a random forest classifier with a set of differential image features. They use a simple regularization strategy based on Gaussian smoothing. Overall, the resulting algorithm is also very demanding in terms of computing power.

126Our method does not require isotropic voxels so it can be applied to image stacks that have been acquired with different resolution in the X, Y and Z axes. The results obtained with our method were similar or better than those obtained with the Cytoseg process (Giuly et al. 2012) for mitochondria only, and to those obtained with Ilastik for both mitochondria only and simultaneous mitochondria and synaptic junctions. Other approaches such as the one from (Lucchi et al. 2012) are not ready to work with anisotropic stacks and therefore our method outperforms them. Unlike Cytoseg, that focuses on mitochondria segmentation, our method is not tied to a specific type of cellular structure but can be used to segment a variety of structures. When compared to Ilastik we obtained better visual results thanks to the regularization and surface smoothing techniques described above. Moreover, our method is much faster than any other approach we have tried. The speed up comes from the Gaussian classifier, that can be trained in O(Nk 2 + k 3 ), being N the number of data points and k the dimension of the feature space. For comparison, the complexity of training random forests is O(MNkd), being M the number of trees and d the average depth of the trees. We found in our experiments that the classifier was the main bottleneck of the Ilastik approach. In our approach the most expensive computation was the regularization step, which Ilastik omits. On the other hand, we found no significant difference in speed for feature extraction, taking only a small fraction of the total processing time in all compared methods.

127For the case of segmentation of 2 labels, a speed of 2.15 seconds per megavoxel in a single thread is fast enough to enable interactive segmentation of the large image stacks that are now available, providing real-time feedback to the user. Of course, parallelization of the proposed approach is straightforward, and it would make it even faster. To our knowledge, no other previous work provides stateof-the-art performance while running in an interactive setting.

Conclusions

128We have presented an algorithm that can be trained to segment a variety of structures in anisotropic EM stacks. In this work we have focused on its capabilities for the segmentation of synaptic junctions and mitochondria. It features some important properties that are not available in other methods in the literature. It uses a graph cut-based image regularization procedure that not only provides better segmentations, but also introduces high level knowledge about the structure of labels. We have solved the limitation of graph cuts in terms of memory requirements with the introduction of energy optimization in overlapping partitions. This allows the regularization of very large stacks. The surface smoothing step introduces smoothness priors on the segmentation that improves the appearance of three-dimensional renderings of the segmented volumes. Finally, and most importantly, we have also shown that our approach is much faster than any other competing method with a state-of-the-art quantitative segmentation performance.

Information Sharing Statement

129The automatic segmentation method described in this paper is available as a plugin of the imaging processing software Espina. The software and instructions for installing it can be found at http://cajalbbp.cesvima.upm.es/espina. This software provides an efficient multi-thread implementation of the presented algorithm together with an intuitive user interface. After activating the Automatic Segmentation plugin, the user has to segment a few voxels of the target objects manually and receives almost real-time feedback of the results. Additional manual segmentations can be performed until the user is satisfied with the final results. Quantitative data regarding the segmented objects are then obtained with standard Espina tools.

참고문헌 23건

  1. Alzheimer's disease: diverse aspects of mitochondrial malfunctioning. PubMed · 2010
  2. Serial Section Scanning Electron Microscopy of Adult Brain Tissue Using Focused Ion Beam Milling Journal of Neuroscience · Society for Neuroscience · 2008 10.1523/jneurosci.3189-07.2008
  3. Automatic joint classification and segmentation of whole cell 3D images Pattern Recognition · Elsevier BV · 2008 10.1016/j.patcog.2008.08.009
  4. From the Connectome to the Synaptome: An Epic Love Story Science · American Association for the Advancement of Science · 2010 10.1126/science.1193378
  5. Axon tracking in serial block-face scanning electron microscopy Medical Image Analysis · Elsevier BV · 2008 10.1016/j.media.2008.05.002
  6. Method: automatic segmentation of mitochondria utilizing patch classification, contour pair classification, and automatically seeded level sets BMC Bioinformatics · BioMed Central · 2012 10.1186/1471-2105-13-29
  7. Serial Block-Face Scanning Electron Microscopy to Reconstruct Three-Dimensional Tissue Nanostructure PLoS Biology · Public Library of Science · 2004 10.1371/journal.pbio.0020329
  8. Supervoxel-Based Segmentation of Mitochondria in EM Image Stacks With Learned Shape Features IEEE Transactions on Medical Imaging · Institute of Electrical and Electronics Engineers · 2011 10.1109/tmi.2011.2171705
  9. Learning Context Cues for Synapse Segmentation IEEE Transactions on Medical Imaging · Institute of Electrical and Electronics Engineers · 2013 10.1109/tmi.2013.2267747
  10. Counting synapses using FIB/SEM microscopy: a true revolution for ultrastructural volume reconstruction Frontiers in Neuroanatomy · Frontiers Media · 2009 10.3389/neuro.05.018.2009
  11. Automated Detection and Segmentation of Synaptic Contacts in Nearly Isotropic Serial Electron Microscopy Images PLoS ONE · Public Library of Science · 2011 10.1371/journal.pone.0024899
  12. Surface extraction from binary volumes with higher-order smoothness 2010 10.1109/cvpr.2010.5539832
  13. Mitochondria: More Than Just a Powerhouse Current Biology · Elsevier BV · 2006 10.1016/j.cub.2006.06.054
  14. Three-dimensional distribution of cortical synapses: a replicated point pattern-based analysis Frontiers in Neuroanatomy · Frontiers Media · 2014 10.3389/fnana.2014.00085
  15. A high-throughput framework to detect synapses in electron microscopy images Bioinformatics · Oxford University Press · 2013 10.1093/bioinformatics/btt222
  16. Texture segmentation benchmark Proceedings - International Conference on Pattern Recognition/Proceedings/International Conference on Pattern Recognition · 2008 10.1109/icpr.2008.4761118
  17. Synapse classification and localization in Electron Micrographs Pattern Recognition Letters · Elsevier BV · 2013 10.1016/j.patrec.2013.06.001
  18. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics 2002 10.1109/iccv.2001.937655
  19. Fast approximate energy minimization via graph cuts IEEE Transactions on Pattern Analysis and Machine Intelligence · IEEE Computer Society · 2001 10.1109/34.969114
  20. Ilastik: Interactive learning and segmentation toolkit 2011 10.1109/isbi.2011.5872394
  21. Espina: A Tool for the Automated Segmentation and Counting of Synapses in Large Stacks of Electron Microscopy Images Frontiers in Neuroanatomy · Frontiers Media · 2011 10.3389/fnana.2011.00018
  22. Convolutional Networks Can Learn to Generate Affinity Graphs for Image Segmentation Neural Computation · The MIT Press · 2009 10.1162/neco.2009.10-08-881
  23. Texture Segmentation Benchmark IEEE Transactions on Pattern Analysis and Machine Intelligence · IEEE Computer Society · 2021 10.1109/tpami.2021.3075916