function MAPOUT = validateslipsurface( MAP, slipsurfacevalue )

MAP = MAP == slipsurfacevalue; 

slipsurfacepixels = find( MAP );

MAPOUT = zeros(size(MAP));

for idx = 1: length( slipsurfacepixels ),
    
    [keepcell, addcell] = validateslipsurfacepixel( MAP, slipsurfacepixels(idx) );
    
    
    MAP( slipsurfacepixels(idx) ) = keepcell;
end;

MAPOUT = MAP;