Command line command to batch process images based on color

Hi,

I have a folder with x images stained for CD34, scanned with either Roche iScan HT Ventana (i.e. TIF) or Hamamatsu (i.e. NDPI). As it turns out, part of these are counter-stained with either DAB or LPR.

But … upon scanning this was not marked in the barcode and so I have no way of telling simply based on the barcode, meta-data or image-name.

One solution could be to split the images into two groups based on the amount of brown or red in the whole image. I could do this manually, but going over x images manually is no fun. I can imagine one could do this using CellProfiler, but that would require building a pipeline.

So I am looking for a clever way batch-processing command to group the images based on the counter-stain (color) using the command line.

Thanks,

Sander