Correct 3D drift: virtual variable referenced

registration
python
Tags: #<Tag:0x00007fd6ba9e07f8> #<Tag:0x00007fd6ba9e0398>

#1

Hi,
I’m trying to drift-correct a .tif movie of immobilized liposomes on a surface, however when I run the ‘Correct 3D drift’ plugin the output movie looks super strange (like it narrowed my movie into one corner and then drags it around the field of view during the time course)!
When I close the plugin the following text then appears in the console window:

Traceback (most recent call last):
  File "Plugins/Registration/Correct_3D_drift.py", line 659, in <module>
  File "Plugins/Registration/Correct_3D_drift.py", line 572, in run
UnboundLocalError: local variable 'virtual' referenced before assignment

What does this mean?
And how do I fix it? :slight_smile:


Correct 3D drift artifact
#2

It means that the variable with the name virtual was not defined when running this line:

which, looking at the code, would only happen if it wasn’t set two lines above, i.e. if options was unset. (@Christian_Tischer might want to have a look and maybe implement a better error handling?)


Is it possible that you cancelled the options dialog at some point, which led to this error appearing in the console, but you discovered it only later after closing the window that was hiding it?! In any case, I think this is unrelated to the distortion problem you’re describing.

If you observe unexpected distortions after correction, this can be due to prominent features in your image that distract the correction algorithm. It would be helpful if you can post an example image or share the full movie.


#3

Regarding the error:
The script is not handling well if the user presses the cancel button, thus the error message; I will fix this.

Regrading your drift correction issue:
Could you give us the movie?
Then I am happy to try to help you to correct it!


Correct 3D drift artifact
#4

I fixed the issue with the Cancel button:


#5

Thanks both! I think you are right that it might be because my particles are not immobile enough for the algorithm to determine the drift in this case … tried the plugin on some of my old data and that worked just fine!
I’ll contact you if it becomes a problem again :slight_smile: