Macro for Weka segmentation and quantifying output

Hi!

Recently I have created a very good classifier for my images (Segmentation settings for TWS) with the help of @iarganda.
As next step I would like to write a macro that combines three tasks:

  1. process many pictures in a folder as described here http://imagej.net/Scripting_the_Trainable_Weka_Segmentation#Example:_apply_classifier_to_all_images_in_folder
  2. quantify the total area of red, green and background pixels for each image like in this example Quantifing Weka Output
  3. and summarize the results in an excel or text file.

I have been browsing through the forum, and trying to write a script, but I didn’t manage.

Thanks for any advice!