Adaptive region algorithm based on a ternary optical computer | Synapse