Macro for batch processing image conversion

when I used the record macro to capture my command for batch convert, I got a message that said that the variable “output” was redundant in the command - because both the output file directory and the output formats are both called “output”.
I think it wants me to use a different variable like output_dir, but that does not seem to work (it defaults to the last place I wrote the files to when I try and substitute into the macro)
what is the correct name for the output_directory or is there another way to solve this (I have a script that essentially edits the macro for a series of directories, but it just keeps writing to that same directory as if it isn’t hearing the output directory in the macro. (using bioformats with image by the way because the bfconvert is too slow)

thanks

Have a look at this description. It might be helpful:

Can you post the macro code you’ve tried? That makes helping you a lot easier.

Here is my macro code:
(Sorry I didn’t put it before)

    $macro="run("Convert...", "input=[".$ARGV[0]."] "

    $macro=$ARGV[0][/is2/projects/RAS-intl/archive/Project 3/RP3/TT_DC/PR3_2016/RP3_060216_Hela_Halo-KRAS-Mutant-act_CB_SNAP-KRAS/Hela_KRAS-A
ct/] outputi=/is2/projects/RAS-intl/static/rp3_ifx/smt/RP3_060216_Hela_Halo-KRAS-Mutant-act_CB_SNAP-KRAS/batch_test/ output=TIFF interpolation=
Bilinear scale=1 read");    

Invocation:

imagej -x 3500 -b <macro>

oops - sorry, my paste buffer isn’t working at the moment. here is the actual macro:

run("Convert...", "input=[/is2/projects/RAS-intl/archive/Project 3/RP3/tt_DC/PR3_2016/RP3_Hela_Halo-KRAS-Mutant-act_CB_SNAP-KRAS/Hela_Y40C-Act/] output=/is2/projects/RAS-intl/static/rp3_ifx/smt/new/  output=TIFF interpolation=Bilinear scale=1  read");

This message isn’t actually caused by your macro code, but by the Process > Batch > Convert… command (in ij.plugin.BatchConverter) that is not compatible with macro recording (due to its duplicate use of the ‘output’ keyword).
This would have to be fixed in the BatchConverter class by @Wayne:

For any batch processing that’s more complicated than just running on a single input and a single output folder, I recommend using the batch template (Templates > ImageJ 1.x > Examples > Process Folder (IJ Macro) in the Script Editor and following the link @Bio7 posted), or using the KNIME framework which makes this kind of task very easy.

1 Like

Thanks so much for the help - I adopted the batch template as suggested and it is working now. newbie learning.

2 Likes