The development of a 3D mesoscopic model of metallic foam based on an improved watershed algorithm