Operating system: Win10
Slicer version:4.10.2
Expected behavior:
Actual behavior:
Hi guys,
I am new to slicer programming. I am loading two volume data( fixed and moving one). Then using slicer’s landmark registration module and selecting some landmark.
After registration is done I want to save the transformation matrix programmatically. If possible getting the transformation matrix after every landmark is selected.
can you please provide an example to do that?
You can save node to file using slicer.util.saveNode() method. Slicer saves transforms in ITK transform file format (binary .h5 file or text .txt file).
I used it like below lines:
>>> slicer.util.saveNode(transformNode,“C:\Users\Johar\Desktop\CheckIT\transmat.txt”)
> False
And as you can see, I get nothing. Can you correct me and show, how to get the transform node correctly and then save?
Hi @lassoan and @pieper
I tried both of your ideas. But I think I am not catching the transform node correctly.
>>> slicer.util.saveNode("Transform",r"C:/Users/transmat.txt")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Slicer 4.10.2\bin\Python\slicer\util.py", line 512, in saveNode
properties["nodeID"] = node.GetID();
AttributeError: 'str' object has no attribute 'GetID'
This is how transform matrix looks like after landmark registration: