Inverse affine transformation from .xml after RVSS

Dear users,
Kindly ask you to look through my problem.I want to find inverse affine transformations and save them to .xml files.
I used RVSS tool in FIJI and saved transformations in .xml files to use after. Now I have info of affine tranformations structure and know createInverse() method and toXML method which allow to find inverse transform, write it to another .xml file and save it, but I m not java or whatever script writer and do not know how to perform it. I tried to use Record plugin in FIJI, but it did not help me. All useful links:

Hi Kirill,
If both are Fiji compatible then just download them to your plugins folder ( the full plug in not the truncated version, restart Fiji (or ImageJ) and they should be in your Plugins menu.

Hi @Kirill_Simonov,

I think I can help with this, but first a question - what would you like to do with the xml’s storing the inverses?

Also, would you mind posting the text of one of your xml’s to this thread, so that I can make sure we’re on the same page?


Dear Bob,
Thanks you! Unfortunately it did not work out.

Dear John,
Currently I managed to use createinverse() function for AffineModel2D. It look like this:
transf_dir = “C:/Users/Kirill/Desktop/on Research Term 5/Tests/Test No 2 05.11.2018/Test with Slice/Input/”
transf_name = “0001.xml”
input_CoordinateTransformList = Transform_Virtual_Stack_MT.readCoordinateTransform(transf_dir + transf_name);
input_AffineModel2D = input_CoordinateTransformList.get(0);
print “Initial direct transformation parameters are :”
print (input_CoordinateTransformList.toXML(""));

shows transforms in"C:/Users/Kirill/Desktop/Test/Input/0000.xml"

output_AffineModel2D = input_AffineModel2D.createInverse();
output_CoordinateTransformList = CoordinateTransformList();

print ("\n Inverse transformations are parameters:" )

#Creates new .XML file and writes transformations to it.
New_xml = open(“C:/Users/Kirill/Desktop/on Research Term 5/Tests/Test No 2 05.11.2018/Test with Slice/Input Inverse/0001.xml”,“w+”);

So now I searching how to find Inverse for TranslationModel2D and make it cycle for batch of .xml files.
Surely, have a look a this one .xml:
<iict_transform class=“mpicbg.trakem2.transform.AffineModel2D” data=“0.9997599304420619 4.030862279563358E-4 -0.0021506696697330976 1.0044515955071915 16.048494915486707 -3.172515615209477” />
<iict_transform invertible=“true” class=“mpicbg.trakem2.transform.TranslationModel2D” data="-15.0 3.0" />

1 Like


It looks like you’re most of the way there. TranslationModel2D's also have a createInverse method.

Just keep in mind that to get the total inverse of a list of concatenated transforms is a list of the individual inverses in reverse order.

E.g. inverse([ A, B ]) = [ inverse(B), inverse(A) ]


Yes, it was hard to find use to toXML() methods, as TranslationModel2D do not cast it to .xml file directly as AffineModel2D does.
Finding inverse took me several methods, while writing to .xml took almost half of day.