## 3 Methods
### Segmentation of Neuron
#### 3.3.2 Neuron Segmentation with the Marker-Controlled Watershed Algorithm  
This section shows how to use a modified watershed-based segmentation method to separate neurons in a 2D EM image, and the workflow is shown in Figure 8. Based on the probability map of the neuronal membrane outputted from the network described in the above subsection, we first obtained the foreground marker. Then, we used watershed segmentation to separate the neurons under the guidance of the rectified foreground marker. The watershed transform finds \"catchment basins\" and \"watershed ridge lines\" in an image by taking it as a surface where light pixels are high and dark pixels are low [30]. It is a natural way to segment neurons with the watershed-based algorithm under the hypothesis that the neurons and membranes are \"catchment basins\" and \"watershed ridge lines\", respectively. Segmentation using the watershed transform works better if we can identify, or \"mark\", foreground objects and background locations. Therefore, to make the segmentation result more accurate, we extracted a part of each neuron as the foreground mark. Here, we do not give the background mark. For each probability map of the neuronal membrane \(I\) (as shown in Figure 8A) whose pixel values in \(I\) varied from 0-255, we used the modified marker-controlled watershed segmentation following these basic procedures. Firstly, we computed its complement \(I^{\prime}\) (as shown in Figure 8B):  
\[I^{\prime}=255-I. \tag{7}\]  
Next, we found the markers of the foreground objects. These markers should be connected speckle pixels inside each of the neurons. We used opening-by-reconstruction and closing-by-reconstruction to make the internal part of each neuron \"flatter\" and denoted by \(I^{\prime}_{oltrcp}\) the clean image. The opening-by-reconstruction is an erosion followed by a morphological reconstruction,  
Figure 8: The workflow of segmenting neurons based on the probability map of the neuronal membrane. (**A**) Input probability map of the neuronal membrane; (**B**) the complement of the input probability map; (**C**) foreground marker; (**D**) rectified foreground marker; (**E**) neuron segmentation). Figure 7: The network architecture for recognition of the neuronal membrane [29]. Red and green blocks annotated \(M\), \(N\), and \(S\) represent convolutional layers with channels \(M\), kernel size \(N\times N\), and stride \(S\); yellow blocks denoted \(N\) and \(S\) imply max pooling over \(N\times N\) patches with stride \(S\); blue blocks with \(M\), \(N\), and \(S\) denote deconvolution layers, and the parameters are similar to that of the convolutional layers; the purple box indicates the softmax layer; the red numbers above straight arrows imply the size of feature maps, while the numbers below straight arrows imply the channels of feature maps, and the numbers above curved arrows represent the repetitions of residual units. while the closing-by-reconstruction is a dilation followed by a morphological reconstruction. Reconstruction-based opening and closing are more effective than standard opening and closing at removing small blemishes without affecting the overall shapes of the objects. The dark spots and stem marks on the probability map of the neuronal membrane can be removed efficiently by performing these two operations. The detailed process is shown in Equation (8):  
\[ \begin{array}{l}I^{\prime}_{e}=I^{\prime}\ominus se,\\ I^{\prime}_{obr}=I^{\prime}_{e}\odot I^{\prime},\\ I^{\prime}_{obr}=I^{\prime}_{obr}\oplus se,\\ I^{\prime}_{obrbr}=255-(255-I^{\prime}_{obr})\odot(255-I^{\prime}_{obr}), \end{array}  \tag{8}\]  
where \(\ominus,\oplus,\odot\) are the erosion, dilation, and reconstruction operations, respectively. \(se\) is a disk-shaped structuring element with a radius of 10 pixels. The regional maxima of \(I^{\prime}_{obrbr}\) are foreground markers. We denoted by \(I^{\prime}_{fgm1}\) (as shown in Figure 8C) the binary image of the foreground markers.