function MAPOUT = removeslipsurfaces( MAP, slipsurfacevalue )
% MAPOUT = RemoveSlipSurfaces( MAP, slipsurfacevalue )


% MAP = MAP == slipsurfacevalue; 

slipsurfacepixels = find( MAP == slipsurfacevalue );

for idx = 1: length( slipsurfacepixels ),
    
    MAP( slipsurfacepixels(idx) ) = nearestnonslipsurface( MAP, slipsurfacepixels(idx), slipsurfacevalue);
    
end;

MAPOUT = MAP;