Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Correct_3D_drift.py #137

Merged
merged 1 commit into from Jan 26, 2016
Merged

Update Correct_3D_drift.py #137

merged 1 commit into from Jan 26, 2016

Conversation

tischi
Copy link
Contributor

@tischi tischi commented Jan 22, 2016

Encouraged by Albert Cardona I added functionality to Correct_3D_drift.py. This was motivated by various fluorescence microscopy data requiring these additions (the changed code has same macro recording behavior as old code => if Fiji users have macros using Correct_3D_drift they will not notice the changes).

Changed code:

  • also works now for 2D time-series (used to be 3D only)
  • added option: measure drift on multiple timescales. This allows to also find slow drift components of less than 1 pixel per frame (used to not be detected).
  • added option: correct sub-pixel drift computing the shifted images using the Translate() function of TransformJ (used to do integer shifts only)
  • added option: compute drift on edge filtered images (for some of my data the underlying "PhaseCorrelation" algorithm finds the drift better in edge filtered images than in the raw data)
  • added option: if a ROI is put on the image, only this part of the image is considered for drift computation; the ROI is moved along with the detected drift thereby tracking the structure of interest and keeping it stable in the corrected time-series.

Encouraged by Albert Cardona I added functionality to Correct_3D_drift.py. This was motivated by various fluorescence microscopy data requiring these additions.

Changed code:
- has same macro recording behavior as old code => old macros will run as is 
- also works now for 2D time-series (used to be 3D only)
- added option: measure drift on multiple timescales. This allows to also find slow drift components of less than 1 pixel per frame (used to not be detected).
- added option: correct sub-pixel drift computing the shifted images using the Translate() function of TransformJ (used to do integer shifts only)
- added option: compute drift on edge filtered images (for some of my data the underlying "PhaseCorrelation" algorithm finds the drift better in edge filtered images than in the raw data)
- added option: if a ROI is put on the image, only this part of the image is considered for drift computation; the ROI is moved along with the detected drift thereby tracking the structure of interest and keeping it stable in the corrected time-series.
@ctrueden
Copy link
Member

Thanks @tischi, this is awesome. The only issue is the change of org.scijava.vecmath back to javax.vecmath. I will merge, and then push a change back to the org.scijava vecmath again. And then I will upload this improved script to the Java-8 update site.

ctrueden added a commit that referenced this pull request Jan 26, 2016
@ctrueden ctrueden merged commit 4d9108c into fiji:master Jan 26, 2016
@ctrueden
Copy link
Member

I uploaded the new version.

I did some brief tests, and noticed that when no ROI is present on a 2D time series, the script now fails with:

ROI is at
Traceback (most recent call last):
  File "/Applications/Science/Fiji-Java-8.app/plugins/Scripts/Plugins/Registration/Correct_3D_drift.py", line 599, in <module>
    run()
  File "/Applications/Science/Fiji-Java-8.app/plugins/Scripts/Plugins/Registration/Correct_3D_drift.py", line 553, in run
    dt = 1; shifts = compute_and_update_frame_translations_dt(imp, channel, dt, process)
  File "/Applications/Science/Fiji-Java-8.app/plugins/Scripts/Plugins/Registration/Correct_3D_drift.py", line 141, in compute_and_update_frame_translations_dt
    print "ROI is at",roi.getBounds()   
AttributeError: 'NoneType' object has no attribute 'getBounds'

I never used this script before, but I assume this is not desired behavior? @tischi If you agree, could you please see about fixing it?

@tischi
Copy link
Contributor Author

tischi commented Jan 27, 2016

I found the bug and fixed it. It would have also occurred on 3D data.
I staged a new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants