Optical Coherence Tomography (OCT) constitutes an imaging technique that is increasing its popularity in the ophthalmology field, since it offers a more complete set of information about the main retinal structures. Hence, it offers detailed information about the eye fundus morphology, allowing the identification of many intraretinal pathological signs. For that reason, over the recent years, Computer-Aided Diagnosis (CAD) systems have spread to work with this image modality and analyze its information. A crucial step for the analysis of the retinal tissues implies the identification and delimitation of the different retinal layers. In this context, we present in this work a fully automatic method for the identification of the main retinal layers that delimits the retinal region. Thus, an active contour-based model was completely adapted and optimized to segment these main retinal boundaries. This fully automatic method uses the information of the horizontal placement of these retinal layers and their relative location over the analyzed images to restrict the search space, considering the presence of shadows that are normally generated by pathological or non-pathological artifacts. The validation process was done using the groundtruth of an expert ophthalmologist analyzing healthy as well as unhealthy patients with different degrees of diabetic retinopathy (without macular edema, with macular edema and with lesions in the photoreceptor layers). Quantitative results are in line with the state of the art of this domain, providing accurate segmentations of the retinal layers even when significative pathological alterations are present in the eye fundus. Therefore, the proposed method is robust enough to be used in complex environments, making it feasible for the ophthalmologists in their routine clinical practice.