Connections between size functions and morphological transformations