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

leaptorch Projector's bp and fbp error #143

Open
fang-2020-github opened this issue Dec 26, 2024 · 3 comments
Open

leaptorch Projector's bp and fbp error #143

fang-2020-github opened this issue Dec 26, 2024 · 3 comments

Comments

@fang-2020-github
Copy link

Hi, when I use Projector class in leaptorch:
proj = Projector(forward_project=False, use_static=True, use_gpu=True, gpu_device=device, batch_size=batchSize)
f = proj(g)
proj.leapct.fbp(g, f0)
I found that f is in the order of 10^3, while f0 is in the order 10^(-4), is here any mistake I made? Actually I need to use f= proj(g) in my program, but the result's order is far from the order of FBP's result.

@kylechampley
Copy link
Collaborator

I may need some clarification on what the issue is here.

What I can tell you is that f is the backprojection of g and f0 is the FBP reconstruction of g, so the scaling and appearance of f and f0 should definitely be different. Note that backprojection is NOT the inverse of forward projection. Backprojection is the ADJOINT of forward projection.

@fang-2020-github
Copy link
Author

I may need some clarification on what the issue is here.

What I can tell you is that f is the backprojection of g and f0 is the FBP reconstruction of g, so the scaling and appearance of f and f0 should definitely be different. Note that backprojection is NOT the inverse of forward projection. Backprojection is the ADJOINT of forward projection.
In my iterative unrolling program, I need to call the forward projection A, and the transpose of A, i.e. A_T, which Class in the leaptorch can I use?

@kylechampley
Copy link
Collaborator

Sorry for the slow response; I was on vacation.

You may just want to use the tomographicModels class in leapctype.py. leaptorch has the PyTorch autograd stuff in it, but if all you want is to perform forward and back projections, just use leapctype; it works with both PyTorch tensors and numpy arrays. Just use it like this;

from leapctype import *
leapct = tomographicModels()
...
g = leapct.allocate_projections()
f = leapct.allocate_volume()
...

Forward Projection

leapct.project(g,f)

Backprojection

leapct.backproject(g,f)

There are several examples of this in the leapctype demos folder. For example, see here.

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

No branches or pull requests

2 participants