I would move this function below `_slic_cython`. Also, rename `nearest_segments` to `segments` or `segment_map`.