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

1D line extraction from 2D images #10

Merged
merged 9 commits into from
Nov 16, 2024

Conversation

McHaillet
Copy link
Member

I worked on the 2D to 1D Fourier slice extraction, which is functional (I tried it for tttsa, see teamtomo/tttsa#19).

One thing that I haven't figured out is a 90 degrees addition to the in plane rotations for the rotation matrices for this function, compared to the affine transform I used before (link to the line of code). One of the two is interpreting it wrongly.

The dft_center also needed a fix to run on GPU, I can also put that in a separate PR if you are not sure yet about this one and want that bug fix in.

I have not added the inverse operation of 1D to 2D slice insertion. Should that be added here as well?

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 - really clean (but I would say that... it mirrors my own implementation 😆)

few minor notes but happy for this to be merged when you're ready

re: the 90 degree rotation I can't see anything obvious - the difference I would expect between conventions/implementations would be an inversion of rotation angle rather than a 90 degree shift, is this actually what is happening? does a zero degree projection produce an image projected along y as expected? what about 90 and x?

src/torch_fourier_slice/project.py Outdated Show resolved Hide resolved
@alisterburt
Copy link
Member

I don't mind about the bugfix

@alisterburt
Copy link
Member

slice insertion can wait/come in a separate PR - no need to overload this one

@McHaillet
Copy link
Member Author

McHaillet commented Nov 16, 2024

awesome - really clean (but I would say that... it mirrors my own implementation 😆)

Haha, I was about to say, its mostly your implementation :p which is indeed clean!

few minor notes but happy for this to be merged when you're ready

I updated those things!

re: the 90 degree rotation I can't see anything obvious - the difference I would expect between conventions/implementations would be an inversion of rotation angle rather than a 90 degree shift, is this actually what is happening? does a zero degree projection produce an image projected along y as expected? what about 90 and x?

Double checked the projection at 0 and 90, and at 0 it is projected along the y-axis and at 90 along the x-axis. So that makes sense.

For the reconstruction, the tilt-axis is aligned with the y-axis, so to find the common line the projection from 2d to 1d needs to happen along the x-axis, i.e. the 90 addition makes sense. (the common line is perpendicular to the tilt axis)

The real-space 2d to 1d projection I wrote before in tttsa was also projecting along the x-axis after the affine transform: https://github.com/teamtomo/tttsa/blob/ecaa1bc0a92d0f17cc80c51734ebe46e045ed860/src/tttsa/projection/project_real.py#L52

So in conclusion, it is correct like this. And, I need to add 90 degrees to project along the x-axis!

@McHaillet
Copy link
Member Author

For my part ready to merge, but please let me know if you have other things that should be fixed.

@alisterburt
Copy link
Member

Glad you got to the bottom of the 90 degree offset - it makes sense and everything matches expectations here

Awesome work as always!

@alisterburt alisterburt merged commit bf1588b into teamtomo:main Nov 16, 2024
5 checks passed
@McHaillet McHaillet deleted the 1d_slice_extraction branch November 16, 2024 14:42
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