Scripting a workflow that incorporates a Weka step

Sample image and/or code

V_C_Macro.ijm.ijm.ijm (3.4 KB)

Dear ImageJ forum, I am trying to script a workflow for image analysis that includes a weka segmentation step in the middle. I am new to scripting in imageJ and BeanShell. I tried using the weka script example shown in the imageJ website but I still cannot get it to join cohesively with the pre and post steps. Is it possible to script everything in one macro? or do I have to make three separate macros: one for the steps pre weka, another for the weka steps and the third for the post weka steps? Furthermore, the weka script analyzes the images within a folder, should I keep this format throughout the whole workflow, or should I focus on getting one good workflow that works on only one image and then I batch process it to a whole folder, if that’s the case how do I modify my code so that I only analyze one image? Please feel free to make any comments or edits of the code itself if you see any error.

Any help is greatly appreciated!