• Keine Ergebnisse gefunden

Post-processing of synapse segmentations in MATLAB

The synapse segmentation results exported from ilastik in Experiment I (section 2.2.7) was postprocessed and corrected in MATLAB before making the volumetric and geometrical measurements. The custom workflow will be described in this section.

First, to visualize the synapse segmentation results, a 3D image stack viewer was written as mentioned previously (Figure 2. 9). Briefly, the synapse segmentation results were superimposed onto the original FIB-SEM images in red. The connected voxels (with connectivity specified as 26-connected neighbors in 3D) were calculated in order to recognize the segmented 3D objects. Each object that was a potential segmented synapse was assigned a unique numerical ID, which was also displayed in the superimposed image stack. To enable quick browsing of the different 2D slices of the 3D image stack, a scroll bar was implemented (Figure 2.

9).

Additionally a synapse viewer was written so that it would display around individual synapses, or around any arbitrary locations within the 3D image stack (Figure S. 6).

This viewer facilitates the verification of segmented synapses. It displayed the superimposed image on the left subpanel and the original EM image on the right panel. The scroll bar controlled the slice in order to display it in both panels simultaneously. The center coordinate of the displayed image was provided in the title of the image window.

172

Figure S. 6: Visualization of the syanpse segmentation result with MATLAB. A 3D image viewer was written with a graphical user interface to facilitate the evaluation and postprocessing of the synapse segmentation result. The synapse segmentation was superimposed in red onto the original FIB-SEM stacks. Each segmented synapse was assigned a numerical ID to track its identity. The viewer simutaneously displays the same 2D slice of the segmentation-synapse pixellated EM image (left panel) and the original FIB-SEM image (right panel). The center of the synapse was indicated by either a green cross or a white circle in the two images respectively. The center coordinate of the displayed synapse was provided on top of the viewer window. A scroll bar was implemented at the bottom of the viewer to enable quick browsing of adjacent slices.

The two images are always updated simutaneously.

The synapses within the FIB-SEM datasets were already manually identified in TrakEM2 during synapse subtype classification steps (section 2.2.6). Thus I took advantage of this to automatically guide the verification of the potential segmented synapses. The center coordinates of each potential segmented synapse were compared with the identified synapse coordinates. For each segmented object, the distance to all manually identified synapses were calculated and sorted in ascending order (close to far away). An agreement between the automatic segmented synapse and manually identified synapse should be reached, as one-to-one pair (close to 0 value of the inter-pair distance) was found. This can be visualized in the comparison results (Figure S. 7).

173

Figure S. 7: Synapse verification based on coordinate comparisons between manual identified synapses and segmented synapses. The inter-pair distances between the segmented and identified synapses were plotted in a heatmap. The color represents the distance, with pure blue being 0 and red being distance larger than 8 pixels. The row of blue values at the top of the figure represents one-to-one pairs between the segmented and identified synapses. Note that there are nonzero values (light blue, green, or yellow) that could be a result of false-negative (missing) or false-split objects.

Nonzero values of the inter-pair distance comparisons could result from several conditions: 1. The synapse was missing from the segmentation results; 2. The geometrical center of the synapse locates outside of it (e.g.: a donut-shaped synapse);

3. Falsely merged or split synapses in the segmentation result.

These conditions were verified manually. The first condition was noted and excluded from the analysis. If there was considerable amount of missing synapses in the segmentation result, the current results would be discarded, and a new segmentation procedure would be performed until the quality reached a satisfactory level. In the end less than 3% of the synapses were missing in the processed segmentation results of all the samples. The second condition was recognized and assigned as a correct segmentation. The third condition was much more complicated and could introduce systematic bias into the final analysis of synapse size and Feret diameter (e.g., falsely merged synapses recognized as a single synapse would

174

significantly increase the final estimation of synapse size in the end, and vice versa).

These types of segmentation errors were recognized and corrected in MATLAB.

Figure S. 8: Falsely merged synapses in the segmentation result. Object 76, which is shown in red in the left panel, actually comprised two synapses that can be chceked in the right panel. The two synapses were located next to each other. Therefore, they were recognized as one object by the connected-component analysis. a, b, and c are three different slices with the Z locations visible in the scroll bar to show more 3D context of the two synapses.

Falsely merged synapses, such as the example in Figure S. 8, were firstly identified visually with the stack viewer and confirmed. The merged synapses were then separated in 3D with a custom written script based on user input. The script

175

displayed the merged synapses in the stack viewer, and enabled the user to click freely on the images and recorded the clicked coordinates. The user was informed and required to assess the 3D shape and location of the two jointed synapses and then click on the image at a plausible splitting point. The script allows user to click multiple times in one 2D image and browse through the images to mark points on different slices; Further the user can mark as many split points as desired. All the splitting points were then displayed in 3D (Figure S. 9, a), for the user to evaluate.

Ideally, the original EM stack should also enabled as 3D background with a transparency (α-level) level. However, because the 3D rendering and transformation plus the visibility of both the split point clouds with the image stack required considerable amount of computation and programming, this was not implemented.

Instead, the current method to visualize the split points involves the use of an interaction tool with which the user can easily rotate the image, as well as zoom in and out, with simple mouse actions. Upon confirmation from the user, a 3D fitting plane was computed and fit onto the split-point-clouds (Figure S. 9 - b). The fitting plane was computed with a least square fitting algorithm that minimized the summed distances of all the points to the plane. The fitting plane was displayed as a mesh surface on the same plotting window as the splitting points so that the user could still manually change the viewing location, angle, or zoom to verify the fitting quality in 3D.

Figure S. 9: Artificial split of falsely merged synapses with a 3D fitting plane. (a), clouds of splitting points manually defined by the user that are marked on the 3D image stack viewer. (b), Computed fitting plane based on the least-squre fit of the clouds of splitting points, as viewed as mesh surface.

Upon verification and confirmation by the user, the falsely merged segmentation was then artificially separated by the fitting plane, stored and processed separately thereafter. The geometrical center, volume and diameter were all recomputed, prior to the synapse size and Feret diameter measurements.

176

Figure S. 10: A falsely split synapse in the segmentation result. Object 137, 140 and 142, which are shown in red in the left panel, were actually belonged to one synapse that can be checked in the right panel. This usually happens in case of perforated synapses because the membrane specialization is often disconnected or there is a hole in the synapse (Figure 2.10 – a).

The falsely split synapses as the example in Figure S. 10, was also visually identified and confirmed. The split synapse was artificially merged in 3D with another MATLAB script. All segmentations that belonged to this synapse were identified and located, and their joint Euclidean center was recomputed. All the voxels in all the located segmentation objects were then grouped together to form a new segmentation object that represented the original synapse. The synapse size and Feret diameter were then measured with the new merged segmentation object.

The quality of the synapse segmentation after postprocessing and correction were evaluated with the image viewer. It can also be reconstructed in 3D to visualize and evaluate (Figure 2.10). The borders of the original FIB-SEM dataset were also imported and used during the synapse geometrical analysis. A synapse segmentation that touches one of the borders will be displayed automatically in the image viewer for the user to verify. If the synapse was dissected by the border and therefore was incompletely contained in the dataset, it would be excluded from the volume and Feret diameter measurements.

I wrote all of the MATLAB scripts discussed. I performed half of the visual verifications and manual corrections of the synapse segmentation results without knowledge of the bird or group identity of the dataset. The other half was performed by Houda Khaled (Neuroscience Program, Wellesley College) who was shared no knowledge of the bird or group identity of the dataset during this process.