How to judge a roinode changed or not by python code?

How to judge a roinode changed or not?

markupsROInode 可以很方便地在slice里调节大小, 我想在程序里判断这个node是否发生改变, 我该怎么做呢?

markupsROInode can easily adjust the size in slice, I want to judge whether this node has changed or not in the program, what should I do?

Can you tell a bit more about your use case? Do you want to prevent changes, get notified about changes when they happen, or just want to check at some point that the ROI was changed compared to some previous state?

I “want to check at some point that the ROI was changed compared to some previous state”.

The simplest is to check the modification time of the MRML node (you can get it by calling node.GetMTime()). Any modification of the node will make the timestamp value larger.

If you need to be more specific, for example only check control point position changes: you can then save the old positions in a variable and compare it to the current positions when you want to check if there were modifications.

thanks for the awesome information.

1 Like