## 2 Materials and Methods
### Cyst Detection and Motion Artifacts Elimination Algorithm  
As discussed in the Introduction section, discrimination of the cysts from surrounding tissue based only on the gray level values on OCT-A angiograms is not easily achievable, since they can be similar, in particular in cases where non-perfused areas are present. Some considerations could be made regarding the different morphology of the dark elements. Concerning the cysts, they appear as a group of contiguous black pixels of different and sometimes irregular shape, that can displace retinal vessels because of a mechanical effect on surrounding tissue. Non-vascularized areas, on the other hand, were described as dark regions as well, but with some internal signal noise (white pixels) and delimited by capillaries [13]. Motion artifacts appear as horizontal black bands. However, even these considerations could not be enough to correctly differentiate dark elements on OCT-A angiograms. Therefore, in the present paper, a novel approach was developed and tested to detect intra-retinal cysts and motion artifacts using the structural information from the same slab used to image the blood flow in the SCP and DCP. Figure 1 shows the SCP and DCP flow and structural enface images obtained with the adopted acquisition system. Figure 2 shows two enface structural SCP and DCP images of the same patient with macular edema. The former (Figure 2A) represents an enface structural SCP image with cysts but without motion artifacts, while the latter (Figure 2B) represents an enface structural DCP image with cysts and  
Figure 1: 3 mm \(\times\) 3 mm OCT-A images of the left eye of a patient with center-involving CME. (**A**) Original enface flow SCP image and (**B**) corresponding enface structural image; (**C**) Original enface flow DCP image and (**D**) corresponding enface structural image. OCT-A = optical coherence tomography angiography; CME = cystoid macular edema; SCP/DCP = superficial/deep capillary plexus. a motion artifact in the inferior part of the image, highlighted by a red box. Some of the biggest and most visible cysts in the two images are highlighted by blue boxes. In order to identify the cysts and to compensate for the potential presence of motion artifacts in enface flow OCT-A images, the authors developed a novel algorithm based on filters and morphological operations, which uses information of corresponding structural enface images of the SCP and DCP OCT-A slabs. In order to be used in the clinical practice, the algorithm should not be heavy from the computational point of view, allowing a fast analysis of the OCT-A images. Algorithm 1 shows the main steps of the proposed method. The algorithm has been developed in Matlab R2019a, MathWorks, Natick, MA, using the Image Processing Toolbox. The proposed algorithm starts filtering the image with a 2-D Gaussian filter kernel (line 1), characterized by a standard deviation of 0.5 and a dimension of \(5\times 5\). This filter has been chosen since it is typically used in OCT-A imaging where it has been demonstrated to be a computationally efficient solution to reduce the noise. Moreover, this filter is widely used in applications targeted at detecting the edges/contours of different objects [14; 15; 16]. In fact, the Gaussian filter has a low-pass response, which attenuates high frequency signal components. This step can be seen as a pre-processing phase needed to better extract the features from the images. The filtered image is then binarized (line 2) in order to identify the areas related to the cysts and the motion artifacts, since, as previously mentioned, they are characterized by dark pixels. In this case, the algorithm binarizes the image on the basis of a global threshold, which has been chosen after evaluating the results of different experiments. In particular, the best results are achieved when the threshold is calculated with [PERSON]'s method, which computes the threshold value by minimizing the intraclass variance of the thresholded black and white pixels.