function [keepcell, addcell] = validateslipsurfacepixel( MAP, index )

[row, col ] = ind2sub( size(MAP), index );


if row>1  && col>1 && row<size(MAP,1) && col<size(MAP,2),
   block = MAP( row-1:row+1, col-1:col+1 );
   
   connectionsthroughface = sum( block( 2:2:8 ) );
   connectionsdiagonal = sum( block( [1,3,7,9] ) );
   
   if connectionsthroughface > 2 ,
       keepcell = false;
   else
       keepcell = true;
   end
   
   addcell = 0;
  
else
    keepcell = true;
    addcell = 0;    
end
    