Chromatic Aberration Correction Batch Processing Macro


Thanks so much for organising the amazing webinar on SMLM the other day.It was really informative and very helpful. From which I learnt the useful Chromatic Aberration Correction made by Jalink-lab(

So far, it works the best on my data among all those methods I have tried before. And I am working on integrating it into my analysis pipeline.

However, I failed to make a macro for batch analyse all xxxxx-647.csv files in a folder. Fiji didn’t complain but the processed file is not saved. I just wonder whether there is a solution for this, please? The code is attached.

It would be lifechanging for me if it works out. Thanks so much!!! : )

Chromatic correction-batch-1.ijm (615 Bytes)


Hi @Julieyue,

Welcome to the forum! :partying_face:

Thanks for trying our tools for single-molecule localization microscopy. And great to hear that you find them useful!

There is a small mistake in your code: In line 17 the input csv file should be dir+list[i] instead of just list[i].
To make things more ‘symmetric’ for input and output I would exclude dir from output as well. Line 16 and 17 then become:
output=replace(list[i],"647.csv", "647-corrected.csv");
run("Do Affine", "csvfile1=["+dir+list[i]+"] csvfile2=["+dir+output+"] affine_file=[Y:\\AffineTransform647.json]");

The reason why the Do Affine command doesn’t complain has to do with our complete failure of meaningful IO exeption catching: it just doesn’t do anything when any of the files is not found! :flushed: We will fix that soon.

Let me know if the chromatic aberration correction works from the macro now. And also if I can help further integrating it into your analysis pipeline. On the main page you can find a macro that we use to tie SMLM tools together.


Hi Bram,

Thanks so much for your prompt reply! Such a fantastic forum I wish I could joint earlier.

Everything works perfectly now! Thanks so much for helping out ‘dumb coder’ :joy:. You can’t imagine it is such a life-changing for my analysis pipeline. :partying_face:


1 Like