Automatic image segmentation and analysis with applications to diatom identification door