In this paper we describe an application of the granulometric mixing theorem to the problem of counting different types of white blood cells in bone marrow images. In principle, an iterative algorithm based on the mixing theorem can be used to count the proportion of cells in each class without explicitly segmenting and classifying them. The algorithm does not converge well for more than two classes. Therefore, a new algorithm based on the theorem is proposed. The proposed algorithm uses prior statistics to initially segment the mixed pattern spectrum and then applies the one-primitive mixing theorem to each initial component. Applying the mixing theorem to one class at a time results in better convergence. The counts produced by the proposed algorithm on 6 classes of cell -- Myeloblast, Promyelocyte, Myelocyte, Metamyelocyte, Band, and PMN -- are very close to the actual numbers; the deviation of the algorithm counts is not larger than deviation of counts produced by human experts. An important technical point is that, unlike previous algorithms, the proposed algorithm does not require prior knowledge of the total number of cells in an image.