Slicer Read Transform Content


(Ong Zhen Yu) #1

Hello,

I am now writing a Slicer scripted module and I need to read only a certain element from a specified transform node. For example, I have transform node named “Transform1” and I just need to read the value of element of 3rd column from each row. How can this be done using python coding?

Thanks!


(Ong Zhen Yu) #2

Sorry, there was a typo, I just want to read the values of 4th column from each transform. I have 8 (4x4) transform


(Steve Pieper) #3

You can access the matrix and call GetElement like in this example:

https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_a_notification_if_a_transform_is_modified