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

Refactor project #7

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

rsanchezgarc
Copy link

@rsanchezgarc rsanchezgarc commented Aug 20, 2024

Minimal changes to easily use the library working on Fourier:

  1. _compute_dft3d_for_project extracted from project_3d_to_2d
  2. lru_cache added to central_slice_fftfreq_grid
    The cache mechanism could be made optional. Happy to discuss options.
  3. Add one test draft (that is not working) checking if the central slice theorem holds.
    So far I am not getting the exact same results using project(volume, rot) than rotating the volume and then integrating over Z. Could it be some precision-related issue?

Names and API are just tentative, feel free to suggest whatever you prefer.

Copy link
Member

@alisterburt alisterburt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome to see you here @rsanchezgarc !

Keen to get this PR in - fine with factoring out compute DFT as you have done. My only concern is the failing test

The rotation center of grid sample is not necessarily the same as that of affine grid - the rotation center is the DC component of the full DFT here. You could use torch-image-lerp to get the rotation with the same center easily.

When you test that, could you use torch-fourier-shell-correlation rather than L2 or similar? Fourier slice vs rotation then integration is quite a different approach so I wouldn't expect numerically identical results but would expect high FSC

@rsanchezgarc
Copy link
Author

Hi,

I just updated the code. The project_3d_to_2d vs sample_image_3d is more similar now but still not perfect. I guess that there are interpolation/numeric errors.

image

image

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.

2 participants