Skeletonization and Partitioning of Digital Images Using Discrete Morse Theory