Inverse affine transformation from .xml after RVSS

fiji
imagej
affine-transform

#1

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:


https://docs.oracle.com/javase/7/docs/api/java/awt/geom/AffineTransform.html#createInverse()


#2

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.
Bob


#3

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?

Thanks
John


#4

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


#5

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();

output_CoordinateTransformList.add(output_AffineModel2D);
print ("\n Inverse transformations are parameters:" )
print(output_CoordinateTransformList.toXML(""));

#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+”);
New_xml.write(output_CoordinateTransformList.toXML(""));
New_xml.close()

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:
ict_transform_list>
<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" />
</ict_transform_list>


#6

@Kirill_Simonov,

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) ]

John


#7

@bogovicj,
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.