Export TrakEM2 transform (non-linear) to Distortion Correction plugin (load)

Hello fellows, (my 2nd post here)

I have been experimenting with communicating TrakEM2 and Distortion Correction (Kaynig et al., 2010) plugin in Fiji for using the calculated non-linear transform of the lens correction in the second one. I have a feeling that the first plugin is more dynamic and arrives at a better approximation of the lens distortion. My objective is to run the correction in a much larger tile collection (500 tiles or High-resolution tiles) than the calibration tileset (3x3 with 50% overlap) before reimportation to TrakEM2 for the final montaging.

I have written a MatLab code to write a file called ‘distCorr.txt’ equal to the formatted text saved at the Distortion Correction ‘Save’ input menu (link attached).

link.m (2.5 KB)

However, the file is not recognized properly by Distortion Correction and either saves the images as zero matrices (empty images) or the Log windows shows:
java.lang.NullPointerException
at lenscorrection.NonLinearTransform.print(NonLinearTransform.java:281)
at lenscorrection.Distortion_Correction.run(Distortion_Correction.java:423)
at ij.IJ.runUserPlugIn(IJ.java:235)
at ij.IJ.runPlugIn(IJ.java:198)
at ij.Executer.runCommand(Executer.java:150)
at ij.Executer.run(Executer.java:65)
at java.lang.Thread.run(Thread.java:748)

Could a TrakEM2 user point in the right direction? I will be grateful. Have a nice day.

Cheers,
Marco

Hi @Marco_Andres_Acevedo

Happy second forum post.

Can you explain how you generated the transformation with trakem2?

I’m not so familiar with the distortion correction plugin, so if it is very particular about it’s input, then what you want to do might be very difficult/impossible. I’ll have to up it’s coden

But If it ends up not being possible now, maybe I can help find an alternative that fits your needs.

John

1 Like

Thanks Jhon,

The transformation with trakEM2 was generated using 3 or 4 rounds including: phase-correlation, least square, lens distortion, and least square for final adjustments (<1px offset). Then, I saved the project as a xml.gz (zipped file) in a location. The same folder is the working directory in the MatLab script that parse the relevant transform information and writes a clone text file to the one saved in the other plugin (Distortion Correction). I think it doesnt recognize the lens distortion text file because of number formatting (different between MatLab and the guts of the plugin).

I dont have Java knowledge at the moment and I hope is not impossible to fix this issue. On the other hand, I have the data I need to apply the methodology explained in Kaynig et al. (2010), so I will try using the non-linear transform in MatLab to fix the tiles. The underlining problem is that I am not sure TrakEM2 (in my PC) can handle large High-resolution WSI montages and I would like having an alternative in those cases.

It would be grant having alternatives. Thanks John.

Marco

1 Like