A method for coding digital image data, the data comprising one or more arrays of pixels with corresponding pixel values, where pixel values of the pixels to be coded in each array are predicted by a prediction in which the predicted value of a current pixel is determined based on a weighted sum of reconstructed pixel values of reconstructed, previously processed pixels in a specific neighborhood region adjacent to the current pixel, where the weights of the weighted sum are determined based on linear and/or non-linear equations for reconstructed pixels in a specific training region adjacent to the current pixel, where a prediction error between predicted pixel values and the original pixel values is processed for generating the coded image data; characterized in that the specific neighborhood region and the specific training region for the current pixel are determined as follows: a) those pixels in a preset neighborhood region adjacent to the current pixel are determined for which reconstructed pixel values exist, resulting in a modified neighborhood region defined by the determined pixels; b) those pixels in a preset training region adjacent to the current pixel are determined for which reconstructed pixel values exist and for which the modified neighborhood region adjacent to the corresponding pixel exclusively includes pixels for which reconstructed pixel values exist, resulting in a modified training region defined by the determined pixels; c) determining a validation value which increases in dependency on an increasing number of pixels in the modified training region and which increases in dependency on a decreasing number of pixels in the modified neighborhood region; d) in case that the validation value is less than or equal to a predetermined threshold value, an iteration is performed, where otherwise the specific neighborhood region corresponds to the modified neighborhood region and the specific training region corresponds to the modified training region; e) in case that the iteration is performed, at least one additional pixel is removed in each iteration step from the modified neighborhood region, resulting in an updated modified neighborhood region in each iteration step, where the iteration terminates when the validation value determined in the corresponding iteration step based on the number of pixels in the updated modified neighborhood region exceeds or reaches the predetermined threshold value, the specific neighborhood region being the updated modified neighborhood region at the termination of the iteration and the specific training region being a region exclusively comprising pixels of the preset training region for which reconstructed pixel values exist and for which the updated modified neighborhood region adjacent to the corresponding pixel at the termination of the iteration exclusively includes pixels for which reconstructed pixel values exist. a) those pixels in a preset neighborhood region adjacent to the current pixel are determined for which reconstructed pixel values exist, resulting in a modified neighborhood region defined by the determined pixels; b) those pixels in a preset training region adjacent to the current pixel are determined for which reconstructed pixel values exist and for which the modified neighborhood region adjacent to the corresponding pixel exclusively includes pixels for which reconstructed pixel values exist, resulting in a modified training region defined by the determined pixels; c) determining a validation value which increases in dependency on an increasing number of pixels in the modified training region and which increases in dependency on a decreasing number of pixels in the modified neighborhood region; d) in case that the validation value is less than or equal to a predetermined threshold value, an iteration is performed, where otherwise the specific neighborhood region corresponds to the modified neighborhood region and the specific training region corresponds to the modified training region; e) in case that the iteration is performed, at least one additional pixel is removed in each iteration step from the modified neighborhood region, resulting in an updated modified neighborhood region in each iteration step, where the iteration terminates when the validation value determined in the corresponding iteration step based on the number of pixels in the updated modified neighborhood region exceeds or reaches the predetermined threshold value, the specific neighborhood region being the updated modified neighborhood region at the termination of the iteration and the specific training region being a region exclusively comprising pixels of the preset training region for which reconstructed pixel values exist and for which the updated modified neighborhood region adjacent to the corresponding pixel at the termination of the iteration exclusively includes pixels for which reconstructed pixel values exist.