Added a count pixels by type function