Hi there,
I am creating a module that will continually calculate the angle between two planes as one is moved. I followed the tutorial on the wiki to add an observer to the transform which is getting moved and it works great but I am having trouble removing the observer. My code to remove the observer doesn’t seem to work as after I run it the angle is still continually calculated. I have copied my code below:
The problem is that you did not add any check that would prevent adding multiple observers. Before you add a new observation, usually you remove previous observation (because it might have been added for a different node). You also need to remove the observation on Cleanup. See these examples (the syntax is slightly different syntax, as VTKObservationMixin is used, so you don’t need to store observation tags):
You can create a new skeleton for your module using the Extension Wizard in latest Slicer Stable Release. It has the observation mixin preconfigured.
If you send a link to your repository then we can have a look at your source code and give advice. These incomplete code snippets give a very vague idea of what might happen in your code.