An algorithm for tumor delineation in positron emission tomography (PET) is presented. Segmentation is achieved by a local active contour algorithm, integrated and optimized with the k-nearest neighbor (KNN) classification method, which takes advantage of the stratified k-fold cross-validation strategy. The proposed approach is evaluated considering the delineation of cancers located in different body districts (i.e. brain, head and neck, and lung), and considering different PET radioactive tracers. Data are pre-processed in order to be expressed in terms of standardized uptake value, the most widely used PET quantification index. The algorithm uses an initial, operator selected region containing the lesion, and automatically identifies an operator-independent optimal region of interest around the tumor. Successively, a slice-by-slice marching local active contour segmentation algorithm is used. The key novelty of the proposed approach consists of a novel form of the energy to be minimized during segmentation, which is enhanced by incorporating the information provided by a KNN classifier. The delineation process and its termination are fully automatic, so that intervention from the user is reduced to a minimum. Due to the high level of automation, the final segmented lesion is independent of inter-operator variation in the initial user input, making the entire process robust and the result completely repeatable. In order to assess the performance under different contrast ratio scenarios, we first evaluate the proposed method on five phantom datasets. Next, we assess the applicability of the method in the radiotherapy environment by investigating fifty clinical cases and two different PET radio-tracers. Our investigation shows that the proposed method can be applied in clinical settings and produces accurate and operator-independent segmentations, attaining good accuracy in realistic conditions.